PtokaX forum

Archive => Archived 5.0 boards => Request for scripts => Topic started by: bp on 21 August, 2005, 17:44:32

Title: Need Help with Custom Info Script, to change it in lua 5
Post by: bp on 21 August, 2005, 17:44:32
Hello Guys.............
Can ne1 hemp me in convertin followin script in Lua 5 ......
I Edited this Script from Database_v1.3 script ....
but its fuctions r totally diff........
The Script is as fallows ...............

-- Start of Script
-----------------------------------------------------------------------------------------------
-- Script Converted by bp from Script Database_v1.3 its totally changed and edited by bp ------
--          By this Script u will be able to add user personal info such as            ------
--      name education address Email_id........                       ------
-----------------------------------------------------------------------------------------------
-------------------
-- Main function --
-------------------
function Main()
   Bot="![Info]?"
   gr=strrep("-",100)
   frmHub:RegBot(Bot)
end
------------------
-- New User     --
------------------
function NewUserConnected(user)
      local s,e,share = strfind(user.sMyInfoString, "$(%d+)%$")
         if share ~= nil then
                 share = format("%0.2f", ( share / (1024*1024*1024)))
         else
            share = 0
         end

      local hubshare = format("%0.2f",  ( frmHub:GetCurrentShareAmount() / (1024*1024*1024)))

DoShowOp(user,share,hubshare)
   if list ~= nil then
      SendToOps("![Info]?" ,list)      
      
   else
      SendToOps("![Info]?", "Info Of user "..user.sName.." is not avialable in the database")

   end
      
DoShow(user,share,hubshare)

      if list ~= nil then
         user:SendData(Bot,list)         
      else
         user:SendPM(Bot,"Dear user " ..user.sName.." ,We dont have u r info in Database Pls pm u r info to Bp or any other operator in format !info Fullname#Address#Education#Email Id#nick#  ")
      end
end

function OpConnected(user)
   user:SendData(Bot,"\tFor Registering the user first PM to ![Info]? bot then type \r\n\r\n \t\t\t!info  full name#address(dont say thane)#edaucation(if doing job then what job)#Email-Id#Nick#\r\n\t Then type \r\n\r\n\t\t\t !addreguser nick pass reg \r\n\r\n\t in main to reg that user. Pls try to add as many ppl as u can")

      local s,e,share = strfind(user.sMyInfoString, "$(%d+)%$")
         if share ~= nil then
                 share = format("%0.2f", ( share / (1024*1024*1024)))
         else
            share = 0
         end

      local hubshare = format("%0.2f",  ( frmHub:GetCurrentShareAmount() / (1024*1024*1024)))

   DoShow(user,share,hubshare)

      if list ~= nil then
         user:SendData(Bot,list)
         
      else
         user:SendPM(Bot,"Dear user " ..user.sName.." ,We dont have u r info in Database Pls pm u r info to Bp or any other op in format !info Fullname # Address # Education # Email Id # nick #  ")

      end
end
------------------
-- Data Arrival --
------------------
function DataArrival(user, data)

   returndata = 0

   if(strsub(data, 1, 4) == "$To:") then
      data=strsub(data,1,strlen(data)-1)
      s,e,whoTo = strfind(data,"$To:%s+(%S+)")
      s,e,To,from,cmd = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(.*)")
      if (whoTo == Bot) then
         s,e,whoTo,from,cmd = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)")

         if (cmd=="!helpd")then
            user:SendPM(Bot,"\r\n?fullinfo\t\t\t- Show all users info\r\n?info \t\t- Read a info of specific User\r\n!info full name#place#education#email#nick#\t- For Adding U r Info eg. !info mangesh pathare  # brindavan  # SY BCOM ( ruparel) # mang@yahoo.com\r\n!delinfo \t\t- Delete a info\r\n!helpd\t\t\t- This help again\r\n")

         elseif (cmd=="?fullinfo") then
            if user.bOperator then
               DoShowAllNews(user)
            end

         elseif (cmd=="?info") then
            if user.bOperator then
               ShowNew(user,data)
            end
               

         elseif (cmd=="!info") then
            if user.bOperator then
               New(user,data)
            else
               user:SendPM(Bot,"\r\n U dont have Authority to add u r Info just pm to any operator to Add info\r\n")
            end

         elseif (cmd=="!delinfo") then
            if user.bOperator then
               DeleteNew(user,data)
            end
         end
      end
   end
end
-- New User Connected --

function New(user,data)
   arg = GetLongArgPM(data)
   if arg ~= nil then
      arg2,arg3,arg4,arg5 = GetLongArgRemnantsPM(user,data)
      if arg2 ~= nil and arg3 ~= nil and arg4 ~= nil then
         DoShowNew(arg5)
         
         if list ~= nil then
            user:SendPM(Bot,"his info is Already present in the database if u want to change it then delet it first then again add ")
         else
            DoNew(user,arg,arg2)
         end
      else
         user:SendPM(Bot,"Wrong synthax: !info name#place#education#emailid#nick#")
      end
   else
      user:SendPM(Bot,"Wrong synthax: !info name#place#education#emailid#nick#")
   end
end

function DoNew(user,arg,arg2)
   GetnewId()
   Date = GetTime()
   k=strlower(arg5)
   entry = arg.."|"..arg2.."|"..arg3.."|"..arg4.."|"..Date.."|"..k.."|"..newnb
   local temp={}
   TextLoad("database/info/info.lst",temp)
   tinsert(temp,entry)
   TextSave("database/info/info.lst",temp)
   user:SendPM(Bot,"User is Successfully entered in database")
end
-- Show info  By NewId ----

function ShowNew(user,data)
   arg = GetArgPM(data)
   if arg ~= nil then
      if user.bOperator or user.sName==arg then
         DoShowNew(arg)
      end
      
      if list ~= nil then
         user:SendPM(Bot,list)
         if user.sName ~= "bp" then                  -- If op other than bp serch for info it will dispay in Main
            SendToOps("[info?]","The "..user.sName.." searched for info of nick "..sender )
         end
      else
         user:SendPM(Bot,"u dont have authority to see his info "..arg)
      end
   else
      user:SendPM(Bot,"Wrong synthax: ?info or u r not allowed to view others data")
   end
end
-- Search For User Nick In The Database

function DoShowNew(number)
   newname,place,education,email_id,newdate,sender,newid=nil,nil,nil,nil,nil,nil,nil
   list=""
   new=""
   local temp={}
   r=0

   TextLoad("database/info/info.lst",temp)
      for x=1,getn(temp) do s,e,newname,place,education,email_id,newdate,sender,newid=strfind(temp
  • ,"(.-)|(.-)|(.-)|(.-)|(.-)|(%S+)|(.-)")
         if (strlower(number)==sender) then
            r=r+1
            break
         end
      end

   if (r==0) then
      list=nil
   else

      list=list.."\r\nnick:"..sender.."\r\nname:"..newname.."\r\nplace:"..place.."\r\neducation:"..education.."\r\nemail_id:"..email_id.."\r\ndate:"..newdate.."\r\n no:"..newid.."\r\n"
   end

   return list
end

function DoShow(user,share,hubshare)
   number=user.sName
   newname,place,education,email_id,newdate,sender,newid=nil,nil,nil,nil,nil,nil,nil
   list=""
   new=""
   local temp={}
   r=0

   TextLoad("database/info/info.lst",temp)
      for x=1,getn(temp) do s,e,newname,place,education,email_id,newdate,sender,newid=strfind(temp
  • ,"(.-)|(.-)|(.-)|(.-)|(.-)|(%S+)|(.-)")
         if (strlower(number)==sender) then
            r=r+1
            break
         end
      end

   if (r==0) then
      list=nil
   else
      count = frmHub:GetUsersCount()
      count1 = count - 1

      list=list.."\r\n\t\t\tWelcome " ..newname.." ,Your nick:"..sender.." your IP is : " ..user.sIP.."\r\n\t\t\t At Present there are "..count1.." users Online. You are "..count.."th User.\r\n\t\t\t Our Total Hubshare Size is" ..hubshare.." Gb. Your Share Size is "..share.."Gb.\r\n"
   end

   return list
end

function DoShowOp(user,share,hubshare)
   number=user.sName
   newname,place,education,email_id,newdate,sender,newid=nil,nil,nil,nil,nil,nil,nil
   list=""
   new=""
   local temp={}
   r=0

   TextLoad("database/info/info.lst",temp)
      for x=1,getn(temp) do s,e,newname,place,education,email_id,newdate,sender,newid=strfind(temp
  • ,"(.-)|(.-)|(.-)|(.-)|(.-)|(%S+)|(.-)")
         if (strlower(number)==sender) then
            r=r+1
            break
         end
      end

   if (r==0) then
      list=nil
   else
      count = frmHub:GetUsersCount()
      count1 = count - 1
      list=list.."\r\n\t\t\tUser " ..newname.." Connected With nick:"..sender.." & IP:" ..user.sIP.."\r\n"
   end

   return list
end
-- Show All Users Info From The Database --

function DoShowAllNews(user)
   newname,place,education,email_id,newdate,sender,newid=nil,nil,nil,nil,nil,nil,nil
   local temp={}
   r=0
   TextLoad("database/info/info.lst",temp)
   list="\r\n\r\n\tnick\t\tname\t\t\tplace\t\t\teducation\t\t\temail_id\t\t\tDate\t\t\NewsId\r\n\t"..gr.."\r\n"
      for x=1,getn(temp) do s,e,newname,place,education,email_id,newdate,sender,newid=strfind(temp
  • ,"(.-)|(.-)|(.-)|(.-)|(.-)|(.-)|(%S+)")
         list=list.."\t"..sender.."\t"..newname.."\t\t"..place.."\t\t"..education.."\t\t"..email_id.."\t\t"..newdate.."\t\t"..newid.."\r\n"
         r=r+1
      end
      if (r==0) then
         list="No output."
      else
         list=list.."\t"..gr.."\r\n\tinfo Record count: "..r.."\r\n"
      end
   user:SendPM(Bot,list)
end
-- Get NewId --

function GetnewId()
   newname,place,education,email_id,newdate,sender,newid=nil,nil,nil,nil,nil,nil,nil
   local temp={}
   newnb=1
   TextLoad("database/info/info.lst",temp)
      for x=1,getn(temp) do s,e,newname,place,education,email_id,newdate,sender,newid=strfind(temp
  • ,"(.-)|(.-)|(.-)|(.-)|(.-)|(.-)|(%S+)")
      
         if newid == nil then
         else
            newnb=newnb+1
         end
      end
   return newnb
end
-- Delete A Info by NewId --

function DeleteNew(user,data)
   arg = GetArgPM(data)
   if arg ~= nil then
      if user.sName==arg or user.bOperator then
      DoShowNew(arg)
      if list ~= nil then
         DoDeleteNew(arg)
         user:SendPM(Bot,"info of nick "..arg.." deleted :o)")
         user:SendPM(Bot,"Now pls put command !add to add users name in the database so that he will disconnect when !disconnect command exicuted")
         SendToAll(Bot,"Dear user"..arg.." , your info is deleted by operator "..user.sName.." . pls Ask him Abt this And enter u r info again or tell him to do that.")
      else
         user:SendPM(Bot,arg.." can't be find as nick")
      end
      else
         user:SendPM(Bot,"u dont have authority to delete this id")
      end
   else
      user:SendPM(Bot,"Wrong synthax: !delinfo ")
      
   end
end

function DoDeleteNew(number)
   newname,place,education,email_id,newdate,sender,newid=nil,nil,nil,nil,nil,nil,nil
   local temp={}
   newnb=1

   TextLoad("database/info/info.lst",temp)
      for x=1,getn(temp) do s,e,newname,place,education,email_id,newdate,sender,newid=strfind(temp
  • ,"(.-)|(.-)|(.-)|(.-)|(.-)|(%S+)|(.-)")
         if (strlower(number)==sender) then
            break
         end
      end

   TextLoad("database/info/info.lst",temp)
      for x=1,getn(temp) do s,e,newname,place,education,email_id,newdate,sender,newid=strfind(temp
  • ,"(.-)|(.-)|(.-)|(.-)|(.-)|(%S+)|(.-)")
         if (strlower(number)==sender) then
         else
            newlist=newname.."|"..place.."|"..education.."|"..email_id.."|"..newdate.."|"..sender.."|"..newnb
            newnb=newnb+1
            local temp={}
            TextLoad("database/info/info.temp.lst",temp)
            tinsert(temp,newlist)
            TextSave("database/info/info.temp.lst",temp)
         end
      end

   remove("database/info/info.lst")

   newname,place,education,email_id,newdate,sender,newid=nil,nil,nil,nil,nil,nil,nil
   local temp={}
   TextLoad("database/news/news.temp.lst",temp)
   for x=1,getn(temp) do s,e,newname,place,education,email_id,newdate,sender,newid=strfind(temp
  • ,"(.-)|(.-)|(.-)|(.-)|(.-)|(%S+)|(.-)")
      newlist=newname.."|"..place.."|"..education.."|"..email_id.."|"..newdate.."|"..sender.."|"..newnb
      local temp={}
      TextLoad("database/info/info.lst",temp)
      tinsert(temp,newlist)
      TextSave("database/info/info.lst",temp)
   end

   remove("database/info/info.temp.lst")
end

--------- Text Loaded ---------

function TextLoad(file,array,text) array[0]="" local x=0
   readfrom(file)
   repeat if (text) then text=text..array
  • .."\r\n" end x=x+1 array
  • =read() until (array
  • ==nil)
   readfrom() return text
end

--------- Text Written ---------

function TextSave(file,array)
   writeto(file)
   for x=1,getn(array) do write(array
  • .."\n") end
   writeto()
end
----------------------------------

function GetSingleNumPM(data)
   s,e,cmd,arg = strfind(data,"$%b<>%s+(%S+)%s+(%d+)")
   return arg
end

function GetArgPM(data)
   s,e,cmd,arg = strfind(data,"$%b<>%s+(%S+)%s+(%S+)")
   return arg
end

function GetLongArgPM(data)
   s,e,cmd,arg = strfind(data,"$%b<>%s+(%S+)%s+(.*)#")
   return arg
end

function GetLongArgRemnantsPM(user, data)
   s,e,cmd,arg,arg2,arg3,arg4,arg5 = strfind(data,"$%b<>%s+(%S+)%s+(.*)#+(.*)#+(.*)#+(.*)#+(.*)#")
   return arg2,arg3,arg4,arg5
end
--------- Get Time ---------
function GetTime()

s = date("%S")
h = date("%H")
m = date("%M")
d = date("%d")
mm = date("%m")
y = date("%y")

Date = d.."."..mm.."."..y.." Time: "..h..":"..m..":"..s
return Date
end

-- End Of Script

This is too good Script for Small network users ........
Pls help me in changing it in Lua5 .........
i think madman u can do it bcos u changed Database 1.3  to Lua 5.........
Pls help me .....
pls somebody gimme link for lua 5 converted script ......
Thnx in advanced............... 8)
Title:
Post by: Markitos on 21 August, 2005, 18:06:05
I tryed to convert it (manually) and i think it fail in total, anways here's the script
-----------------------------------------------------------------------------------------------
-- Script Converted by bp from Script Database_v1.3 its totally changed and edited by bp ------
-- By this Script u will be able to add user personal info such as ------
-- name education address Email_id........ ------
-----------------------------------------------------------------------------------------------
-------------------
-- Main function --
-------------------
function Main()
Bot="![Info]?"
gr=str.rep("-",100)
frmHub:RegBot(Bot)
end
------------------
-- New User --
------------------
function NewUserConnected(user)
local s,e,share = str.find(user.sMyInfoString, "$(%d+)%$")
if share ~= nil then
share = format("%0.2f", ( share / (1024*1024*1024)))
else
share = 0
end

local hubshare = format("%0.2f", ( frmHub:GetCurrentShareAmount() / (1024*1024*1024)))

DoShowOp(user,share,hubshare)
if list ~= nil then
SendToOps("![Info]?" ,list)

else
SendToOps("![Info]?", "Info Of user "..user.sName.." is not avialable in the database")

end

DoShow(user,share,hubshare)

if list ~= nil then
user:SendData(Bot,list)
else
user:SendPM(Bot,"Dear user " ..user.sName.." ,We dont have u r info in Database Pls pm u r info to Bp or any other operator in format !info Fullname#Address#Education#Email Id#nick# ")
end
end

function OpConnected(user)
user:SendData(Bot,"\tFor Registering the user first PM to ![Info]? bot then type \r\n\r\n \t\t\t!info full name#address(dont say thane)#edaucation(if doing job then what job)#Email-Id#Nick#\r\n\t Then type \r\n\r\n\t\t\t !addreguser nick pass reg \r\n\r\n\t in main to reg that user. Pls try to add as many ppl as u can")

local s,e,share = str.find(user.sMyInfoString, "$(%d+)%$")
if share ~= nil then
share = format("%0.2f", ( share / (1024*1024*1024)))
else
share = 0
end

local hubshare = format("%0.2f", ( frmHub:GetCurrentShareAmount() / (1024*1024*1024)))

DoShow(user,share,hubshare)

if list ~= nil then
user:SendData(Bot,list)

else
user:SendPM(Bot,"Dear user " ..user.sName.." ,We dont have u r info in Database Pls pm u r info to Bp or any other op in format !info Fullname # Address # Education # Email Id # nick # ")

end
end
------------------
-- Data Arrival --
------------------
function ChatArrival(user, data)

returndata = 0

if(str.sub(data, 1, 4) == "$To:") then
data=str.sub(data,1,str.len(data)-1)
s,e,whoTo = str.find(data,"$To:%s+(%S+)")
s,e,To,from,cmd = str.find(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(.*)")
if (whoTo == Bot) then
s,e,whoTo,from,cmd = str.find(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)")

if (cmd=="!helpd")then
user:SendPM(Bot,"\r\n?fullinfo\t\t\t- Show all users info\r\n?info \t\t- Read a info of specific User\r\n!info full name#place#education#email#nick#\t- For Adding U r Info eg. !info mangesh pathare # brindavan # SY BCOM ( ruparel) # [EMAIL]mang@yahoo.com[/EMAIL]\r\n!delinfo \t\t- Delete a info\r\n!helpd\t\t\t- This help again\r\n")

elseif (cmd=="?fullinfo") then
if user.bOperator then
DoShowAllNews(user)
end

elseif (cmd=="?info") then
if user.bOperator then
ShowNew(user,data)
end


elseif (cmd=="!info") then
if user.bOperator then
New(user,data)
else
user:SendPM(Bot,"\r\n U dont have Authority to add u r Info just pm to any operator to Add info\r\n")
end

elseif (cmd=="!delinfo") then
if user.bOperator then
DeleteNew(user,data)
end
end
end
end
end
-- New User Connected --

function New(user,data)
arg = GetLongArgPM(data)
if arg ~= nil then
arg2,arg3,arg4,arg5 = GetLongArgRemnantsPM(user,data)
if arg2 ~= nil and arg3 ~= nil and arg4 ~= nil then
DoShowNew(arg5)

if list ~= nil then
user:SendPM(Bot,"his info is Already present in the database if u want to change it then delet it first then again add ")
else
DoNew(user,arg,arg2)
end
else
user:SendPM(Bot,"Wrong synthax: !info name#place#education#emailid#nick#")
end
else
user:SendPM(Bot,"Wrong synthax: !info name#place#education#emailid#nick#")
end
end

function DoNew(user,arg,arg2)
GetnewId()
Date = GetTime()
k=strlower(arg5)
entry = arg.."|"..arg2.."|"..arg3.."|"..arg4.."|"..Date.."|"..k.."|"..newnb
local temp={}
TextLoad("database/info/info.lst",temp)
tinsert(temp,entry)
TextSave("database/info/info.lst",temp)
user:SendPM(Bot,"User is Successfully entered in database")
end
-- Show info By NewId ----

function ShowNew(user,data)
arg = GetArgPM(data)
if arg ~= nil then
if user.bOperator or user.sName==arg then
DoShowNew(arg)
end

if list ~= nil then
user:SendPM(Bot,list)
if user.sName ~= "bp" then -- If op other than bp serch for info it will dispay in Main
SendToOps("[info?]","The "..user.sName.." searched for info of nick "..sender )
end
else
user:SendPM(Bot,"u dont have authority to see his info "..arg)
end
else
user:SendPM(Bot,"Wrong synthax: ?info or u r not allowed to view others data")
end
end
-- Search For User Nick In The Database

function DoShowNew(number)
newname,place,education,email_id,newdate,sender,newid=nil,nil,nil,nil,nil, nil,nil
list=""
new=""
local temp={}
r=0

TextLoad("database/info/info.lst",temp)
for x=1,getn(temp) do s,e,newname,place,education,email_id,newdate,sender,newid=strfind(temp[x],"(.-)|(.-)|(.-)|(.-)|(.-)|(%S+)|(.-)")
if (strlower(number)==sender) then
r=r+1
break
end
end

if (r==0) then
list=nil
else

list=list.."\r\nnick:"..sender.."\r\nname:"..newname.."\r\nplace:"..place.."\r\neducation:"..education.."\r\nemail_id:"..email_id.."\r\ndate:"..newdate.."\r\n no:"..newid.."\r\n"
end

return list
end

function DoShow(user,share,hubshare)
number=user.sName
newname,place,education,email_id,newdate,sender,newid=nil,nil,nil,nil,nil, nil,nil
list=""
new=""
local temp={}
r=0

TextLoad("database/info/info.lst",temp)
for x=1,getn(temp) do s,e,newname,place,education,email_id,newdate,sender,newid=strfind(temp[x],"(.-)|(.-)|(.-)|(.-)|(.-)|(%S+)|(.-)")
if (strlower(number)==sender) then
r=r+1
break
end
end

if (r==0) then
list=nil
else
count = frmHub:GetUsersCount()
count1 = count - 1

list=list.."\r\n\t\t\tWelcome " ..newname.." ,Your nick:"..sender.." your IP is : " ..user.sIP.."\r\n\t\t\t At Present there are "..count1.." users Online. You are "..count.."th User.\r\n\t\t\t Our Total Hubshare Size is" ..hubshare.." Gb. Your Share Size is "..share.."Gb.\r\n"
end

return list
end

function DoShowOp(user,share,hubshare)
number=user.sName
newname,place,education,email_id,newdate,sender,newid=nil,nil,nil,nil,nil, nil,nil
list=""
new=""
local temp={}
r=0

TextLoad("database/info/info.lst",temp)
for x=1,getn(temp) do s,e,newname,place,education,email_id,newdate,sender,newid=str.find(temp[x],"(.-)|(.-)|(.-)|(.-)|(.-)|(%S+)|(.-)")
if (str.lower(number)==sender) then
r=r+1
break
end
end

if (r==0) then
list=nil
else
count = frmHub:GetUsersCount()
count1 = count - 1
list=list.."\r\n\t\t\tUser " ..newname.." Connected With nick:"..sender.." & IP:" ..user.sIP.."\r\n"
end

return list
end
-- Show All Users Info From The Database --

function DoShowAllNews(user)
newname,place,education,email_id,newdate,sender,newid=nil,nil,nil,nil,nil, nil,nil
local temp={}
r=0
TextLoad("database/info/info.lst",temp)
list=& quot;\r\n\r\n\tnick\t\tname\t\t\tplace\t\t\teducation\t\t\temail_id\t\t\tDa te\t\t\NewsId\r\n\t"..gr.."\r\n"
for x=1,getn(temp) do s,e,newname,place,education,email_id,newdate,sender,newid=str.find(temp[x],"(.-)|(.-)|(.-)|(.-)|(.-)|(.-)|(%S+)")
list=list.."\t"..sender.."\t"..newname.."\t\t"..place.."\t\t"..education.."\t\t"..email_id.."\t\t"..newdate.."\t\t"..newid.."\r\n"
r=r+1
end
if (r==0) then
list="No output."
else
list=list.."\t"..gr.."\r\n\tinfo Record count: "..r.."\r\n"
end
user:SendPM(Bot,list)
end
-- Get NewId --

function GetnewId()
newname,place,education,email_id,newdate,sender,newid=nil,nil,nil,nil,nil, nil,nil
local temp={}
newnb=1
TextLoad("database/info/info.lst",temp)
for x=1,getn(temp) do s,e,newname,place,education,email_id,newdate,sender,newid=str.find(temp[x],"(.-)|(.-)|(.-)|(.-)|(.-)|(.-)|(%S+)")

if newid == nil then
else
newnb=newnb+1
end
end
return newnb
end
-- Delete A Info by NewId --

function DeleteNew(user,data)
arg = GetArgPM(data)
if arg ~= nil then
if user.sName==arg or user.bOperator then
DoShowNew(arg)
if list ~= nil then
DoDeleteNew(arg)
user:SendPM(Bot,"info of nick "..arg.." deleted :o)")
user:SendPM(Bot,"Now pls put command !add to add users name in the database so that he will disconnect when !disconnect command exicuted")
SendToAll(Bot,"Dear user"..arg.." , your info is deleted by operator "..user.sName.." . pls Ask him Abt this And enter u r info again or tell him to do that.")
else
user:SendPM(Bot,arg.." can't be find as nick")
end
else
user:SendPM(Bot,"u dont have authority to delete this id")
end
else
user:SendPM(Bot,"Wrong synthax: !delinfo ")

end
end

function DoDeleteNew(number)
newname,place,education,email_id,newdate,sender,newid=nil,nil,nil,nil,nil, nil,nil
local temp={}
newnb=1

TextLoad("database/info/info.lst",temp)
for x=1,getn(temp) do s,e,newname,place,education,email_id,newdate,sender,newid=str.find(temp[x],"(.-)|(.-)|(.-)|(.-)|(.-)|(%S+)|(.-)")
if (str.lower(number)==sender) then
break
end
end

TextLoad("database/info/info.lst",temp)
for x=1,getn(temp) do s,e,newname,place,education,email_id,newdate,sender,newid=str.find(temp[x],"(.-)|(.-)|(.-)|(.-)|(.-)|(%S+)|(.-)")
if (str.lower(number)==sender) then
else
newlist=newname.."|"..place.."|"..education.."|"..email_id.."|"..newdate.."|"..sender.."|"..newnb
newnb=newnb+1
local temp={}
TextLoad("database/info/info.temp.lst",temp)
tinsert(temp,newlist)
TextSave("database/info/info.temp.lst",temp)
end
end

remove("database/info/info.lst")

newname,place,education,email_id,newdate,sender,newid=nil,nil,nil,nil,nil, nil,nil
local temp={}
TextLoad("database/news/news.temp.lst",temp)
for x=1,getn(temp) do s,e,newname,place,education,email_id,newdate,sender,newid=str.find(temp[x],"(.-)|(.-)|(.-)|(.-)|(.-)|(%S+)|(.-)")
newlist=newname.."|"..place.."|"..education.."|"..email_id.."|"..newdate.."|"..sender.."|"..newnb
local temp={}
TextLoad("database/info/info.lst",temp)
tinsert(temp,newlist)
TextSave("database/info/info.lst",temp)
end

remove("database/info/info.temp.lst")
end

--------- Text Loaded ---------

function TextLoad(file,array,text) array[0]="" local x=0
readfrom(file)
repeat if (text) then text=text..array[x].."\r\n" end x=x+1 array[x]=read() until (array[x]==nil)
readfrom() return text
end

--------- Text Written ---------

function TextSave(file,array)
writeto(file)
for x=1,getn(array) do write(array[x].."\n") end
writeto()
end
----------------------------------

function GetSingleNumPM(data)
s,e,cmd,arg = str.find(data,"$%b<>%s+(%S+)%s+(%d+)")
return arg
end

function GetArgPM(data)
s,e,cmd,arg = str.find(data,"$%b<>%s+(%S+)%s+(%S+)")
return arg
end

function GetLongArgPM(data)
s,e,cmd,arg = str.find(data,"$%b<>%s+(%S+)%s+(.*)#")
return arg
end

function GetLongArgRemnantsPM(user, data)
s,e,cmd,arg,arg2,arg3,arg4,arg5 = str.find(data,"$%b<>%s+(%S+)%s+(.*)#+(.*)#+(.*)#+(.*)#+(.*)#")
return arg2,arg3,arg4,arg5
end
--------- Get Time ---------
function GetTime()

s = date("%S")
h = date("%H")
m = date("%M")
d = date("%d")
mm = date("%m")
y = date("%y")

Date = d.."."..mm.."."..y.." Time: "..h..":"..m..":"..s
return Date
end
ToArrival = ChatArrival
end
Title: not working ..........
Post by: bp on 22 August, 2005, 17:49:49
Markitos ...... thnx for he repy but according to me its now working........

pls try to fing what is the error in the script........ ?(

u r help will be  appreciated.......  ;)  

pls somebody hep me........ ;(
Title: not working ..........
Post by: bp on 22 August, 2005, 17:54:42
Markitos ...... thnx for he repy but according to me its not working........

pls try to find what is the error in the script........ ?(

u r help will be  appreciated.......  ;)  

pls somebody hep me........ ;(
Title:
Post by: kunal on 22 August, 2005, 18:05:37
do u know anything known as edit post
Title:
Post by: DJ Bert on 22 August, 2005, 22:09:29
Try this one
-- Start of Script
-----------------------------------------------------------------------------------------------
-- Script Converted by bp from Script Database_v1.3 its totally changed and edited by bp ------
-- By this Script u will be able to add user personal info such as ------
-- name education address Email_id........ ------
-----------------------------------------------------------------------------------------------
-------------------
-- Main function --
-------------------
function Main()
Bot="![Info]?"
gr=string.rep("-",100)
frmHub:RegBot(Bot)
end
------------------
-- New User --
------------------
function NewUserConnected(user)
local s,e,share = string.find(user.sMyInfoString, "$(%d+)%$")
if share ~= nil then
share = string.format("%0.2f", ( share / (1024*1024*1024)))
else
share = 0
end

local hubshare = string.format("%0.2f", ( frmHub:GetCurrentShareAmount() / (1024*1024*1024)))

DoShowOp(user,share,hubshare)
if list ~= nil then
SendToOps("![Info]?" ,list)
else
SendToOps("![Info]?", "Info Of user "..user.sName.." is not avialable in the database")
end

DoShow(user,share,hubshare)
if list ~= nil then
user:SendData(Bot,list)
else
user:SendPM(Bot,"Dear user " ..user.sName.." ,We dont have u r info in Database Pls pm u r info to Bp or any other operator in string.format !info Fullname#Address#Education#Email Id#nick# ")
end
end

function OpConnected(user)
user:SendData(Bot,"\tFor Registering the user first PM to ![Info]? bot then type \r\n\r\n \t\t\t!info full name#address(dont say thane)#edaucation(if doing job then what job)#Email-Id#Nick#\r\n\t Then type \r\n\r\n\t\t\t !addreguser nick pass reg \r\n\r\n\t in main to reg that user. Pls try to add as many ppl as u can")
local s,e,share = string.find(user.sMyInfoString, "$(%d+)%$")
if share ~= nil then
share = string.format("%0.2f", ( share / (1024*1024*1024)))
else
share = 0
end

local hubshare = string.format("%0.2f", ( frmHub:GetCurrentShareAmount() / (1024*1024*1024)))

DoShow(user,share,hubshare)
if list ~= nil then
user:SendData(Bot,list)
else
user:SendPM(Bot,"Dear user " ..user.sName.." ,We dont have u r info in Database Pls pm u r info to Bp or any other op in string.format !info Fullname # Address # Education # Email Id # nick # ")
end
end
------------------
-- Data Arrival --
------------------
function ChatArrival(user, data)

returndata = 0

if(string.sub(data, 1, 4) == "$To:") then
data=string.sub(data,1,string.len(data)-1)
s,e,whoTo = string.find(data,"$To:%s+(%S+)")
s,e,To,from,cmd = string.find(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(.*)")
if (whoTo == Bot) then
s,e,whoTo,from,cmd = string.find(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)")

if (cmd=="!helpd")then
user:SendPM(Bot,"\r\n?fullinfo\t\t\t- Show all users info\r\n?info \t\t- Read a info of specific User\r\n!info full name#place#education#email#nick#\t- For Adding U r Info eg. !info mangesh pathare # brindavan # SY BCOM ( ruparel) # [EMAIL]mang@yahoo.com[/EMAIL]\r\n!delinfo \t\t- Delete a info\r\n!helpd\t\t\t- This help again\r\n")

elseif (cmd=="?fullinfo") then
if user.bOperator then
DoShowAllNews(user)
end

elseif (cmd=="?info") then
if user.bOperator then
ShowNew(user,data)
end

elseif (cmd=="!info") then
if user.bOperator then
New(user,data)
else
user:SendPM(Bot,"\r\n U dont have Authority to add u r Info just pm to any operator to Add info\r\n")
end

elseif (cmd=="!delinfo") then
if user.bOperator then
DeleteNew(user,data)
end
end
end
end
end
-- New User Connected --

function New(user,data)
arg = GetLongArgPM(data)
if arg ~= nil then
arg2,arg3,arg4,arg5 = GetLongArgRemnantsPM(user,data)
if arg2 ~= nil and arg3 ~= nil and arg4 ~= nil then
DoShowNew(arg5)

if list ~= nil then
user:SendPM(Bot,"his info is Already present in the database if u want to change it then delet it first then again add ")
else
DoNew(user,arg,arg2)
end
else
user:SendPM(Bot,"Wrong synthax: !info name#place#education#emailid#nick#")
end
else
user:SendPM(Bot,"Wrong synthax: !info name#place#education#emailid#nick#")
end
end

function DoNew(user,arg,arg2)
GetnewId()
Date = GetTime()
k=string.lower(arg5)
entry = arg.."|"..arg2.."|"..arg3.."|"..arg4.."|"..Date.."|"..k.."|"..newnb
local temp={}
TextLoad("database/info/info.lst",temp)
table.insert(temp,entry)
TextSave("database/info/info.lst",temp)
user:SendPM(Bot,"User is Successfully entered in database")
end
-- Show info By NewId ----

function ShowNew(user,data)
arg = GetArgPM(data)
if arg ~= nil then
if user.bOperator or user.sName==arg then
DoShowNew(arg)
end

if list ~= nil then
user:SendPM(Bot,list)
if user.sName ~= "bp" then -- If op other than bp serch for info it will dispay in Main
SendToOps("[info?]","The "..user.sName.." searched for info of nick "..sender )
end
else
user:SendPM(Bot,"u dont have authority to see his info "..arg)
end
else
user:SendPM(Bot,"Wrong synthax: ?info or u r not allowed to view others data")
end
end
-- Search For User Nick In The Database

function DoShowNew(number)
newname,place,education,email_id,newdate,sender,newid=nil,nil,nil,nil,nil, nil,nil
list=""
new=""
local temp={}
r=0

TextLoad("database/info/info.lst",temp)
for x=1,table.getn(temp) do s,e,newname,place,education,email_id,newdate,sender,newid=string.find(temp[x],"(.-)|(.-)|(.-)|(.-)|(.-)|(%S+)|(.-)")
if (string.lower(number)==sender) then
r=r+1
break
end
end

if (r==0) then
list=nil
else
list=list.."\r\nnick:"..sender.."\r\nname:"..newname.."\r\nplace:"..place.."\r\neducation:"..education.."\r\nemail_id:"..email_id.."\r\ndate:"..newdate.."\r\n no:"..newid.."\r\n"
end
return list
end

function DoShow(user,share,hubshare)
number=user.sName
newname,place,education,email_id,newdate,sender,newid=nil,nil,nil,nil,nil, nil,nil
list=""
new=""
local temp={}
r=0

TextLoad("database/info/info.lst",temp)
for x=1,table.getn(temp) do s,e,newname,place,education,email_id,newdate,sender,newid=string.find(temp[x],"(.-)|(.-)|(.-)|(.-)|(.-)|(%S+)|(.-)")
if (string.lower(number)==sender) then
r=r+1
break
end
end

if (r==0) then
list=nil
else
count = frmHub:GetUsersCount()
count1 = count - 1

list=list.."\r\n\t\t\tWelcome " ..newname.." ,Your nick:"..sender.." your IP is : " ..user.sIP.."\r\n\t\t\t At Present there are "..count1.." users Online. You are "..count.."th User.\r\n\t\t\t Our Total Hubshare Size is" ..hubshare.." Gb. Your Share Size is "..share.."Gb.\r\n"
end
return list
end

function DoShowOp(user,share,hubshare)
number=user.sName
newname,place,education,email_id,newdate,sender,newid=nil,nil,nil,nil,nil, nil,nil
list=""
new=""
local temp={}
r=0

TextLoad("database/info/info.lst",temp)
for x=1,table.getn(temp) do s,e,newname,place,education,email_id,newdate,sender,newid=string.find(temp[x],"(.-)|(.-)|(.-)|(.-)|(.-)|(%S+)|(.-)")
if (string.lower(number)==sender) then
r=r+1
break
end
end

if (r==0) then
list=nil
else
count = frmHub:GetUsersCount()
count1 = count - 1
list=list.."\r\n\t\t\tUser " ..newname.." Connected With nick:"..sender.." & IP:" ..user.sIP.."\r\n"
end
return list
end
-- Show All Users Info From The Database --

function DoShowAllNews(user)
newname,place,education,email_id,newdate,sender,newid=nil,nil,nil,nil,nil, nil,nil
local temp={}
r=0
TextLoad("database/info/info.lst",temp)
list=& quot;\r\n\r\n\tnick\t\tname\t\t\tplace\t\t\teducation\t\t\temail_id\t\t\tDa te\t\t\NewsId\r\n\t"..gr.."\r\n"
for x=1,table.getn(temp) do s,e,newname,place,education,email_id,newdate,sender,newid=string.find(temp[x],"(.-)|(.-)|(.-)|(.-)|(.-)|(.-)|(%S+)")
list=list.."\t"..sender.."\t"..newname.."\t\t"..place.."\t\t"..education.."\t\t"..email_id.."\t\t"..newdate.."\t\t"..newid.."\r\n"
r=r+1
end
if (r==0) then
list="No output."
else
list=list.."\t"..gr.."\r\n\tinfo Record count: "..r.."\r\n"
end
user:SendPM(Bot,list)
end
-- Get NewId --

function GetnewId()
newname,place,education,email_id,newdate,sender,newid=nil,nil,nil,nil,nil, nil,nil
local temp={}
newnb=1
TextLoad("database/info/info.lst",temp)
for x=1,table.getn(temp) do s,e,newname,place,education,email_id,newdate,sender,newid=string.find(temp[x],"(.-)|(.-)|(.-)|(.-)|(.-)|(.-)|(%S+)")

if newid == nil then
else
newnb=newnb+1
end
end
return newnb
end
-- Delete A Info by NewId --

function DeleteNew(user,data)
arg = GetArgPM(data)
if arg ~= nil then
if user.sName==arg or user.bOperator then
DoShowNew(arg)
if list ~= nil then
DoDeleteNew(arg)
user:SendPM(Bot,"info of nick "..arg.." deleted :o)")
user:SendPM(Bot,"Now pls put command !add to add users name in the database so that he will disconnect when !disconnect command exicuted")
SendToAll(Bot,"Dear user"..arg.." , your info is deleted by operator "..user.sName.." . pls Ask him Abt this And enter u r info again or tell him to do that.")
else
user:SendPM(Bot,arg.." can't be find as nick")
end
else
user:SendPM(Bot,"u dont have authority to delete this id")
end
else
user:SendPM(Bot,"Wrong synthax: !delinfo ")
end
end

function DoDeleteNew(number)
newname,place,education,email_id,newdate,sender,newid=nil,nil,nil,nil,nil, nil,nil
local temp={}
newnb=1

TextLoad("database/info/info.lst",temp)
for x=1,table.getn(temp) do s,e,newname,place,education,email_id,newdate,sender,newid=string.find(temp[x],"(.-)|(.-)|(.-)|(.-)|(.-)|(%S+)|(.-)")
if (string.lower(number)==sender) then
break
end
end

TextLoad("database/info/info.lst",temp)
for x=1,table.getn(temp) do s,e,newname,place,education,email_id,newdate,sender,newid=string.find(temp[x],"(.-)|(.-)|(.-)|(.-)|(.-)|(%S+)|(.-)")
if (string.lower(number)==sender) then
else
newlist=newname.."|"..place.."|"..education.."|"..email_id.."|"..newdate.."|"..sender.."|"..newnb
newnb=newnb+1
local temp={}
TextLoad("database/info/info.temp.lst",temp)
table.insert(temp,newlist)
TextSave("database/info/info.temp.lst",temp)
end
end

os.remove("database/info/info.lst")

newname,place,education,email_id,newdate,sender,newid=nil,nil,nil,nil,nil, nil,nil
local temp={}
TextLoad("database/news/news.temp.lst",temp)
for x=1,table.getn(temp) do s,e,newname,place,education,email_id,newdate,sender,newid=string.find(temp[x],"(.-)|(.-)|(.-)|(.-)|(.-)|(%S+)|(.-)")
newlist=newname.."|"..place.."|"..education.."|"..email_id.."|"..newdate.."|"..sender.."|"..newnb
local temp={}
TextLoad("database/info/info.lst",temp)
table.insert(temp,newlist)
TextSave("database/info/info.lst",temp)
end
os.remove("database/info/info.temp.lst")
end
--------- Text Loaded ---------

function TextLoad(file,array,text) array[0]="" local x=0
readfrom(file)
readfrom() return text
end
--------- Text Written ---------

function TextSave(file,array)
writeto(file)
for x=1,table.getn(array) do write(array[x].."\n") end
writeto()
end
----------------------------------

function GetSingleNumPM(data)
s,e,cmd,arg = string.find(data,"$%b<>%s+(%S+)%s+(%d+)")
return arg
end

function GetArgPM(data)
s,e,cmd,arg = string.find(data,"$%b<>%s+(%S+)%s+(%S+)")
return arg
end

function GetLongArgPM(data)
s,e,cmd,arg = string.find(data,"$%b<>%s+(%S+)%s+(.*)#")
return arg
end

function GetLongArgRemnantsPM(user, data)
s,e,cmd,arg,arg2,arg3,arg4,arg5 = string.find(data,"$%b<>%s+(%S+)%s+(.*)#+(.*)#+(.*)#+(.*)#+(.*)#")
return arg2,arg3,arg4,arg5
end
--------- Get Time ---------
function GetTime()

s = os.date("%S")
h = os.date("%H")
m = os.date("%M")
d = os.date("%d")
mm = os.date("%m")
y = os.date("%y")

Date = d.."."..mm.."."..y.." Time: "..h..":"..m..":"..s
return Date
end
-- End Of Script
Title: Sorry mate not working
Post by: bp on 24 August, 2005, 08:07:59
when some1 login in the hub then  i get this error  ..........

info.lua:653: attempt to call global `readfrom' (a nil value)

simply its not working  :(

pls help me somebody  ;(
Title:
Post by: Madman on 25 August, 2005, 02:11:55
--------- Text Loaded ---------

function TextLoad(file,array,text) array[0]="" local x=0
f = io.input(file)
repeat if (text) then text=text..array[x].."\r\n" end x=x+1 array[x]=io.read() until (array[x]==nil)
f:close() return text
end

--------- Text Written ---------

function TextSave(file,array)
local f = io.open(file, "w+")
for x=1,table.getn(array) do f:write(array[x].."\n") end
f:close()
end

----------------------------------

Copyed from the 1.3 Conversion i did.. called Database 1.4 on board...
Title: pls post full script
Post by: bp on 29 August, 2005, 20:54:14
madman can u edit this script and post full script bcos

i tired the fuction u posted but its not working as it used to work in lua 4

pls   ;(

and again thax for the reply    :D
Title:
Post by: Madman on 29 August, 2005, 22:44:01
-- Start of Script
-----------------------------------------------------------------------------------------------
-- Script Converted by bp from Script Database_v1.3 its totally changed and edited by bp ------
-- By this Script u will be able to add user personal info such as ------
-- name education address Email_id........ ------
-- Fully converted by Madman and DJ Bert
-----------------------------------------------------------------------------------------------
-------------------
-- Main function --
-------------------
function Main()
Bot="![Info]™"
gr=string.rep("-",100)
frmHub:RegBot(Bot)
end
------------------
-- New User --
------------------
function NewUserConnected(user)
local s,e,share = string.find(user.sMyInfoString, "$(%d+)%$")
if share ~= nil then
share = string.format("%0.2f", ( share / (1024*1024*1024)))
else
share = 0
end
local hubshare = string.format("%0.2f", ( frmHub:GetCurrentShareAmount() / (1024*1024*1024)))
DoShowOp(user,share,hubshare)
if list ~= nil then
SendToOps("![Info]™" ,list)
else
SendToOps("![Info]™", "Info Of user "..user.sName.." is not avialable in the database")
end
DoShow(user,share,hubshare)
if list ~= nil then
user:SendData(Bot,list)
else
user:SendPM(Bot,"Dear user " ..user.sName.." ,We dont have u r info in Database Pls pm u r info to Bp or any other operator in string.format !info Fullname#Address#Education#Email Id#nick# ")
end
end

function OpConnected(user)
user:SendData(Bot,"\tFor Registering the user first PM to ![Info]™ bot then type \r\n\r\n \t\t\t!info full name#address(dont say thane)#edaucation(if doing job then what job)#Email-Id#Nick#\r\n\t Then type \r\n\r\n\t\t\t !addreguser nick pass reg \r\n\r\n\t in main to reg that user. Pls try to add as many ppl as u can")
local s,e,share = string.find(user.sMyInfoString, "$(%d+)%$")
if share ~= nil then
share = string.format("%0.2f", ( share / (1024*1024*1024)))
else
share = 0
end
local hubshare = string.format("%0.2f", ( frmHub:GetCurrentShareAmount() / (1024*1024*1024)))
DoShow(user,share,hubshare)
if list ~= nil then
user:SendData(Bot,list)
else
user:SendPM(Bot,"Dear user " ..user.sName.." ,We dont have u r info in Database Pls pm u r info to Bp or any other op in string.format !info Fullname # Address # Education # Email Id # nick # ")
end
end
------------------
-- Data Arrival --
------------------
function ToArrival(user, data)
data=string.sub(data,1,string.len(data)-1)
s,e,whoTo = string.find(data,"$To:%s+(%S+)")
s,e,To,from,cmd = string.find(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(.*)")
if (whoTo == Bot) then
s,e,whoTo,from,cmd = string.find(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)")
if (cmd=="!helpd")then
user:SendPM(Bot,"\r\n?fullinfo\t\t\t- Show all users info\r\n?info \t\t- Read a info of specific User\r\n!info full name#place#education#email#nick#\t- For Adding U r Info eg. !info mangesh pathare # brindavan # SY BCOM ( ruparel) # [EMAIL]mang@yahoo.com[/EMAIL]\r\n!delinfo \t\t- Delete a info\r\n!helpd\t\t\t- This help again\r\n")
elseif (cmd=="?fullinfo") then
if user.bOperator then
DoShowAllNews(user)
end
elseif (cmd=="?info") then
if user.bOperator then
ShowNew(user,data)
end
elseif (cmd=="!info") then
if user.bOperator then
New(user,data)
else
user:SendPM(Bot,"\r\n U dont have Authority to add u r Info just pm to any operator to Add info\r\n")
end
elseif (cmd=="!delinfo") then
if user.bOperator then
DeleteNew(user,data)
end
end
end
end
-- New User Connected --

function New(user,data)
arg = GetLongArgPM(data)
if arg ~= nil then
arg2,arg3,arg4,arg5 = GetLongArgRemnantsPM(user,data)
if arg2 ~= nil and arg3 ~= nil and arg4 ~= nil then
DoShowNew(arg5)
if list ~= nil then
user:SendPM(Bot,"his info is Already present in the database if u want to change it then delet it first then again add ")
else
DoNew(user,arg,arg2)
end
else
user:SendPM(Bot,"Wrong synthax: !info name#place#education#emailid#nick#")
end
else
user:SendPM(Bot,"Wrong synthax: !info name#place#education#emailid#nick#")
end
end

function DoNew(user,arg,arg2)
GetnewId()
Date = GetTime()
k=string.lower(arg5)
entry = arg.."|"..arg2.."|"..arg3.."|"..arg4.."|"..Date.."|"..k.."|"..newnb
local temp={}
TextLoad("database/info/info.lst",temp)
table.insert(temp,entry)
TextSave("database/info/info.lst",temp)
user:SendPM(Bot,"User is Successfully entered in database")
end
-- Show info By NewId ----

function ShowNew(user,data)
arg = GetArgPM(data)
if arg ~= nil then
if user.bOperator or user.sName==arg then
DoShowNew(arg)
end
if list ~= nil then
user:SendPM(Bot,list)
if user.sName ~= "bp" then -- If op other than bp serch for info it will dispay in Main
SendToOps("[info™]","The "..user.sName.." searched for info of nick "..sender )
end
else
user:SendPM(Bot,"u dont have authority to see his info "..arg)
end
else
user:SendPM(Bot,"Wrong synthax: ?info or u r not allowed to view others data")
end
end
-- Search For User Nick In The Database

function DoShowNew(number)
newname,place,education,email_id,newdate,sender,newid=nil,nil,nil,nil,nil, nil,nil
list=""
new=""
local temp={}
r=0
TextLoad("database/info/info.lst",temp)
for x=1,table.getn(temp) do s,e,newname,place,education,email_id,newdate,sender,newid=string.find(temp[x],"(.-)|(.-)|(.-)|(.-)|(.-)|(%S+)|(.-)")
if (string.lower(number)==sender) then
r=r+1
break
end
end
if (r==0) then
list=nil
else
list=list.."\r\nnick:"..sender.."\r\nname:"..newname.."\r\nplace:"..place.."\r\neducation:"..education.."\r\nemail_id:"..email_id.."\r\ndate:"..newdate.."\r\n no:"..newid.."\r\n"
end
return list
end

function DoShow(user,share,hubshare)
number=user.sName
newname,place,education,email_id,newdate,sender,newid=nil,nil,nil,nil,nil, nil,nil
list=""
new=""
local temp={}
r=0
TextLoad("database/info/info.lst",temp)
for x=1,table.getn(temp) do s,e,newname,place,education,email_id,newdate,sender,newid=string.find(temp[x],"(.-)|(.-)|(.-)|(.-)|(.-)|(%S+)|(.-)")
if (string.lower(number)==sender) then
r=r+1
break
end
end
if (r==0) then
list=nil
else
count = frmHub:GetUsersCount()
count1 = count - 1
list=list.."\r\n\t\t\tWelcome " ..newname.." ,Your nick:"..sender.." your IP is : " ..user.sIP.."\r\n\t\t\t At Present there are "..count1.." users Online. You are "..count.."th User.\r\n\t\t\t Our Total Hubshare Size is" ..hubshare.." Gb. Your Share Size is "..share.."Gb.\r\n"
end
return list
end

function DoShowOp(user,share,hubshare)
number=user.sName
newname,place,education,email_id,newdate,sender,newid=nil,nil,nil,nil,nil, nil,nil
list=""
new=""
local temp={}
r=0
TextLoad("database/info/info.lst",temp)
for x=1,table.getn(temp) do s,e,newname,place,education,email_id,newdate,sender,newid=string.find(temp[x],"(.-)|(.-)|(.-)|(.-)|(.-)|(%S+)|(.-)")
if (string.lower(number)==sender) then
r=r+1
break
end
end
if (r==0) then
list=nil
else
count = frmHub:GetUsersCount()
count1 = count - 1
list=list.."\r\n\t\t\tUser " ..newname.." Connected With nick:"..sender.." & IP:" ..user.sIP.."\r\n"
end
return list
end
-- Show All Users Info From The Database --

function DoShowAllNews(user)
newname,place,education,email_id,newdate,sender,newid=nil,nil,nil,nil,nil, nil,nil
local temp={}
r=0
TextLoad("database/info/info.lst",temp)
list="\r\n\r\n\tnick\t\tname\t\t\tplace\t\t\teducation\t\t\temail_id\t\t\tDa te\t\t\NewsId\r\n\t"..gr.."\r\n"
for x=1,table.getn(temp) do s,e,newname,place,education,email_id,newdate,sender,newid=string.find(temp[x],"(.-)|(.-)|(.-)|(.-)|(.-)|(.-)|(%S+)")
list=list.."\t"..sender.."\t"..newname.."\t\t"..place.."\t\t"..education.."\t\t"..email_id.."\t\t"..newdate.."\t\t"..newid.."\r\n"
r=r+1
end
if (r==0) then
list="No output."
else
list=list.."\t"..gr.."\r\n\tinfo Record count: "..r.."\r\n"
end
user:SendPM(Bot,list)
end
-- Get NewId --

function GetnewId()
newname,place,education,email_id,newdate,sender,newid=nil,nil,nil,nil,nil, nil,nil
local temp={}
newnb=1
TextLoad("database/info/info.lst",temp)
for x=1,table.getn(temp) do s,e,newname,place,education,email_id,newdate,sender,newid=string.find(temp[x],"(.-)|(.-)|(.-)|(.-)|(.-)|(.-)|(%S+)")
if newid == nil then
else
newnb=newnb+1
end
end
return newnb
end
-- Delete A Info by NewId --

function DeleteNew(user,data)
arg = GetArgPM(data)
if arg ~= nil then
if user.sName==arg or user.bOperator then
DoShowNew(arg)
if list ~= nil then
DoDeleteNew(arg)
user:SendPM(Bot,"info of nick "..arg.." deleted :o)")
user:SendPM(Bot,"Now pls put command !add to add users name in the database so that he will disconnect when !disconnect command exicuted")
SendToAll(Bot,"Dear user"..arg.." , your info is deleted by operator "..user.sName.." . pls Ask him Abt this And enter u r info again or tell him to do that.")
else
user:SendPM(Bot,arg.." can't be find as nick")
end
else
user:SendPM(Bot,"u dont have authority to delete this id")
end
else
user:SendPM(Bot,"Wrong synthax: !delinfo ")
end
end

function DoDeleteNew(number)
newname,place,education,email_id,newdate,sender,newid=nil,nil,nil,nil,nil, nil,nil
local temp={}
newnb=1
TextLoad("database/info/info.lst",temp)
for x=1,table.getn(temp) do s,e,newname,place,education,email_id,newdate,sender,newid=string.find(temp[x],"(.-)|(.-)|(.-)|(.-)|(.-)|(%S+)|(.-)")
if (string.lower(number)==sender) then
break
end
end
TextLoad("database/info/info.lst",temp)
for x=1,table.getn(temp) do s,e,newname,place,education,email_id,newdate,sender,newid=string.find(temp[x],"(.-)|(.-)|(.-)|(.-)|(.-)|(%S+)|(.-)")
if (string.lower(number)==sender) then
else
newlist=newname.."|"..place.."|"..education.."|"..email_id.."|"..newdate.."|"..sender.."|"..newnb
newnb=newnb+1
local temp={}
TextLoad("database/info/info.temp.lst",temp)
table.insert(temp,newlist)
TextSave("database/info/info.temp.lst",temp)
end
end
os.remove("database/info/info.lst")
newname,place,education,email_id,newdate,sender,newid=nil,nil,nil,nil,nil, nil,nil
local temp={}
TextLoad("database/news/news.temp.lst",temp)
for x=1,table.getn(temp) do s,e,newname,place,education,email_id,newdate,sender,newid=string.find(temp[x],"(.-)|(.-)|(.-)|(.-)|(.-)|(%S+)|(.-)")
newlist=newname.."|"..place.."|"..education.."|"..email_id.."|"..newdate.."|"..sender.."|"..newnb
local temp={}
TextLoad("database/info/info.lst",temp)
table.insert(temp,newlist)
TextSave("database/info/info.lst",temp)
end
os.remove("database/info/info.temp.lst")
end
--------- Text Loaded ---------

function TextLoad(file,array,text) array[0]="" local x=0
f = io.input(file)
f:close() return text
end
--------- Text Written ---------

function TextSave(file,array)
local f = io.open(file, "w+")
for x=1,table.getn(array) do f:write(array[x].."\n") end
f:close()
end
----------------------------------

function GetSingleNumPM(data)
s,e,cmd,arg = string.find(data,"$%b<>%s+(%S+)%s+(%d+)")
return arg
end

function GetArgPM(data)
s,e,cmd,arg = string.find(data,"$%b<>%s+(%S+)%s+(%S+)")
return arg
end

function GetLongArgPM(data)
s,e,cmd,arg = string.find(data,"$%b<>%s+(%S+)%s+(.*)#")
return arg
end

function GetLongArgRemnantsPM(user, data)
s,e,cmd,arg,arg2,arg3,arg4,arg5 = string.find(data,"$%b<>%s+(%S+)%s+(.*)#+(.*)#+(.*)#+(.*)#+(.*)#")
return arg2,arg3,arg4,arg5
end
--------- Get Time ---------
function GetTime()
s = os.date("%S")
h = os.date("%H")
m = os.date("%M")
d = os.date("%d")
mm = os.date("%m")
y = os.date("%y")
Date = d.."."..mm.."."..y.." Time: "..h..":"..m..":"..s
return Date
end
-- End Of Script

Should be working now...
Title:
Post by: kunal on 03 September, 2005, 13:47:44
[17:17] Syntax C:\ptokax0.3.3.21\scripts\infobotbybp.lua:220: unexpected symbol near `&'
Title: Script not working as i want
Post by: bp on 19 September, 2005, 22:48:24
Script not working as it used to work in lua 4 i am able to add info but not able view info .............

pls can u edit script ......

i cant figure it out whats the prob is.............