PtokaX forum

Development Section => Your Developing Problems => Topic started by: Davey on 18 July, 2007, 12:57:06

Title: Little error maybe :?
Post by: Davey on 18 July, 2007, 12:57:06
When i past the code to the script I get an error
this is the code
function ChatArrival(user, data)
  if user.bOperator then
    local data=string.sub(data,1,string.len(data)-1)
    local _,_,cmd = string.find(data,"%b<>%s+(%S+)")
    if cmd =="!aan" then
SendPmToAll(Botname,"\r\n\tI'm be activated !.")
if SendMain == "off" then
              SendMain = "on"
return 1
    elseif cmd =="!uit" then
      SendPmToAll(Bot,"\r\n\tI'm off now bye bye.")
if SendMain == "on" then
              SendMain = "off"
      StopTimer()
return 1
end
end
collectgarbage()
end


and this is the hole script maybe some one can help me


------------------------------------Configuration------------------------------------------------
BotName = "MesseGe?"    -- The Name of your bot [ duhh ]
Start = 1               -- Start with script restarting 1 = yes  0 = no
Mins = 15                -- Interval between the message's if Start = 1
SendMain = "on"         -- Send Message to Main on/off
-------------------------------------------------------------------------------------------------

MessaGe = {
"Welcome to "..frmHub:GetHubName()..".",


}

function Main()
frmHub:RegBot(BotName)
SetTimer(Mins*60000)
if Start == 1 then
StartTimer()
OnTimer()
end
end

function OnTimer()
if Start==1 then
MessaGe = MessaGe[math.random(1,table.getn(MessaGe))]
SendToAll(BotName, " "..MessaGe.."  ")
end
end

OnError = function(ErrorMsg)
if ErrorMsg then
SendPmToOps(Botname, "Hi. I have found a error, Please notify [NL]Davey with the follow message :: Error: "..ErrorMsg)
end
end

function ChatArrival(user, data)
  if user.bOperator then
    local data=string.sub(data,1,string.len(data)-1)
    local _,_,cmd = string.find(data,"%b<>%s+(%S+)")
    if cmd =="!aan" then
SendPmToAll(Botname,"\r\n\tI'm be activated !.")
if SendMain == "off" then
              SendMain = "on"
return 1
    elseif cmd =="!uit" then
      SendPmToAll(Bot,"\r\n\tI'm off now bye bye.")
if SendMain == "on" then
              SendMain = "off"
      StopTimer()
return 1
end
end
collectgarbage()
end
Title: Re: Litle error maybe :?
Post by: blastbeat on 18 July, 2007, 13:02:30
what error do you get in which line?
Title: Re: Litle error maybe :?
Post by: Davey on 18 July, 2007, 13:03:36
sorry forgot to post
this the error
TestBot.lua:59: 'end' expected (to close 'function' at line 40) near '<eof>'
Title: Re: Litle error maybe :?
Post by: blastbeat on 18 July, 2007, 13:11:11
try this:


function ChatArrival(user, data)
if user.bOperator then
    local data=string.sub(data,1,string.len(data)-1)
    local _,_,cmd = string.find(data,"%b<>%s+(%S+)")
    if cmd =="!aan" then
SendPmToAll(Botname,"\r\n\tI'm be activated !.")
if SendMain == "off" then
              SendMain = "on"
return 1
    elseif cmd =="!uit" then
      SendPmToAll(Bot,"\r\n\tI'm off now bye bye.")
if SendMain == "on" then
              SendMain = "off"
      StopTimer()
return 1
end
end
end
end
collectgarbage()
end

but the code makes no sense i think because the "!uit" if block is inside of the "!aan" if block
Title: Re: Litle error maybe :?
Post by: Leun on 18 July, 2007, 13:12:36
or try this :-)


function ChatArrival(user, data)
if user.bOperator then
local data = string.sub(data,1,-2)
local _,_,cmd = string.find(data,"%b<>%s+(%S+)")
if cmd =="!aan" then
SendPmToAll(BotName,"\r\n\tI'm be activated !.")
if SendMain == "off" then
SendMain = "on"
return 1
end
elseif cmd =="!uit" then
SendPmToAll(BotName,"\r\n\tI'm off now bye bye.")
if SendMain == "on" then
SendMain = "off"
StopTimer()
return 1
end
end
end
collectgarbage("collect")
end
Title: Re: Litle error maybe :?
Post by: blastbeat on 18 July, 2007, 13:14:51
 ;)
Title: Re: Litle error maybe :?
Post by: Davey on 18 July, 2007, 13:19:14
Hi thnx 4 the reply's

I have test all the 2 functions.
Get no error on it
But if I do  now !aan or !uit then the script doesn't nothing
But it must send with !aan the follow message
SendPmToAll(Botname,"\r\n\tI'm be activated !.")

and with !uit SendPmToAll(Bot,"\r\n\tI'm off now bye bye.")

But I get this
Blasbeast :::

[ :-: ] 13:04:17 [ :-: ] <Davey> !aan
[ :-: ] 13:04:19 [ :-: ] <Davey> !uit
Leun :::

[ :-: ] 13:09:06 [ :-: ] <Davey> !aan
and the command !uit doesn't show

So I think I must add the cmd's to the bot configuration :?
Or have you peepz any other idea :?
Or change the cmd to !boton and !botoff
Title: Re: Litle error maybe :?
Post by: blastbeat on 18 July, 2007, 13:24:18
it is a good idea to add the commands to bot configuration but it is no must.
i think the error is: you use Botname and Bot in SendPmToAll..., not BotName.
try this:


function ChatArrival(user, data)
if user.bOperator then
local data = string.sub(data,1,-2)
local _,_,cmd = string.find(data,"%b<>%s+(%S+)")
if cmd =="!aan" then
SendPmToAll(BotName,"\r\n\tI'm be activated !.")
if SendMain == "off" then
SendMain = "on"
return 1
end
elseif cmd =="!uit" then
SendPmToAll(BotName,"\r\n\tI'm off now bye bye.")
if SendMain == "on" then
SendMain = "off"
StopTimer()
return 1
end
end
end
collectgarbage("collect")
end
Title: Re: Litle error maybe :?
Post by: Leun on 18 July, 2007, 13:27:47
lolz that must work =)
Title: Re: Litle error maybe :?
Post by: Davey on 19 July, 2007, 14:04:39
hahaha
Lolz one litle misstake and the bot doesn't work perfectly lol
But anyway thnx 4 the help peepz ;-)

The bots works now :-)
lolz
get now a new error :-(
TestBot.lua:42: bad argument #1 to 'getn' (table expected, got string)

Error Fixed !
Thnx to blastbeat !


Ok ok, after long time getting no errors, I have get another one :-(

Now I get the follow message :
TestBot.lua:110: 'end' expected (to close 'if' at line 103) near 'else'
And I have try a lot of things, but nothing that helps

Can somebody help me with this error :?

--// FunBot and Helpfully bot made by [NL]Davey
--// blastbeat ::--> thnx 4 your help.. with the function Ontimer !
--// If you found report please notify me with it
--// Added Joke's, Right Click, Login Message, Help Commands !
--// Turning Bot on/off Only avaible for Ops// Other commands avaible for every one !
--//                  EnjoY With It

------------------------------------Configuration------------------------------------------------
BotName = "MesseGe?"    -- The Name of your bot [ duhh ]
Start = 1               -- Start with script restarting 1 = yes  0 = no
Mins = 1                -- Interval between the message's if Start = 1
SendMain = "on"         -- Send Message to Main on/off
LogiN = "on"            -- Send Login Message on/off
RC_Name = "MesseGe?"    -- The name of your RIght Click
Owner = "Davey"         -- Owner Name
-------------------------------------------------------------------------------------------------

MessaGe = {
"\r\n\t\ Welcome to "..frmHub:GetHubName()..".",
"\r\n\t\ Whiiiiii, im so happy today :-D",
"\r\n\t\ Girl Rock Your Boddy",
"\r\n\t\ I think that [NL]Davey a Great scripter is",
"\r\n\t\ If you think im a bot then..... you have it fucKinG wronG !",
"\r\n\t\ WAZZZZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"\r\n\t\ Ownooo, I lose all my money",
"\r\n\t\ Ask A Operator for VIP status or check you right click commands",
"\r\n\t\ Im The BOM MUHAHAHAHAHAHA",
"\r\n\t\ 24 hours in a day ... 24 beers in a case ... coincidence?",
"\r\n\t\ The village called for ya ................... they want their idiot back",
"\r\n\t\ Don't piss me off! I'm running out of places to hide the bodies.",
"\r\n\t\ This hub is running Talk and HelpFullY Bot by [NL]Davey",
"\r\n\t\ The best hub owner is "..Owner.." ",
}


function Main()
frmHub:RegBot(BotName)
SetTimer(Mins*60000)
if Start == 1 then
StartTimer()
OnTimer()
end
end

function OnTimer()
if Start==1 then
local MessaGe = MessaGe[math.random(1,table.maxn(MessaGe))]
SendToAll(BotName, " "..MessaGe.."  ")
end
end

OnError = function(msg)
SendPmToOps(BotName,"Hi. I have found an error. Please notify [NL]Davey with the follow message : "..msg)
end

function ChatArrival(user, data)
                local data = string.sub(data,1,-2)
local _,_,cmd = string.find(data,"%b<>%s+(%S+)")
if cmd =="!askvip" then
SendPmToOps(BotName,"\r\n\t "..user.sName.." want become a vip in this hub .")
                        user:SendData(BotName,"Your request has been send! please be Patient !")
return 1
                   end
                if cmd =="!showhub" then
               dofile("FriendlyHubs.txt")
if next(FriendlyTable) then
local disp = "\r\n\t"..string.rep("- -",20).." FriendlyHubs "..string.rep("- -",20).."\r\n"
disp = disp.."\t\r\n"
for v, i in pairs(FriendlyTable) do
disp = disp.."\t\tName:  "..v.."\tAddress: "..FriendlyTable[v][3].."\tMinshare: "..FriendlyTable[v][1]..""..FriendlyTable[v][2].."\r\n"
end
disp = disp.."\r\n\t"..string.rep("- -",49)..""
user:SendPM(BotName, disp)
else
user:SendData(BotName,"ERROR! There are no friendly hubs added")
return 1
end
end
          if user.bOperator then
if cmd =="!aan" then
SendToAll(BotName,"\r\n\t "..user.sName.." is calling the bot to talk again !!")
if SendMain == "off" then
SendMain = "on"
return 1
end
elseif cmd =="!uit" then
SendToAll(BotName,"\r\n\t "..user.sName.." Says to the bot: Leace this hub for a while !!")
if SendMain == "on" then
SendMain = "off"
StopTimer()
return 1
end
                elseif cmd =="!mhelp" then
                        user:SendPM(BotName,"\r\n\t This is the Help Menu for Talker.\r\n\t !aan   -- The bot go On\r\n\t !uit   -- The bot go Off \r\n\t !mhelp -- Show this page")
return 1
end
                elseif cmd =="!addhub" then
                local s,e,cmd,minshare,what,addy,name = string.find( data, "%b<>%s+(%S+)%s+(%S+)%s+(%S+)%s+(%S+)%s+(.*)")
if FriendlyTable[name]== nil then
if minshare then
if what then
if addy then
if name then
FriendlyTable[name] ={minshare,what,addy}
saveTableToFile(FriendlyHubs,FriendlyTable,"FriendlyTable")
SendToOps(BotName,""..user.sName.." has added : "..name.." to the Friendly Hub List !!")
else
user:SendData(BotName, "Command is ::  !addfriendly <minshare> <b/kb/mb/gb/tb> <address> <hub name>!!!")
else
user:SendData(BotName, "Sorry, but the hub : "..name.." is allready in my Friendly List !!")
       return 1
  end

collectgarbage("collect")
end

function NewUserConnected(user)
                user:SendData("$UserCommand 1 3 "..RC_Name.."\\Show Avaible Commands for me$<%[mynick]> !help&#124;")
                user:SendData("$UserCommand 1 3 "..RC_Name.."\\Ask for Vip Satus$<%[mynick]> !askvip&#124;")
                user:SendData("$UserCommand 1 3 "..RC_Name.."\\Show Friendly Hubs$<%[mynick]> !showhub&#124;")
          if user.bOperator then
user:SendData("$UserCommand 1 3 "..RC_Name.."\\Talker On$<%[mynick]> !aan&#124;")
                user:SendData("$UserCommand 1 3 "..RC_Name.."\\Talker Off$<%[mynick]> !uit&#124;")
                user:SendData("$UserCommand 1 3 "..RC_Name.."\\Talker Help$<%[mynick]> !mhelp&#124;")
                user:SendData("$UserCommand 1 3 "..RC_Name.."\\Add a Friendly Hub$<%[mynick]> !addhub&#124;")
                user:SendData("$UserCommand 1 3 "..RC_Name.."\\?Login And Register MessaGe By [NL]Davey?$<%[mynick]>&#124;")
end
end
OpConnected = NewUserConnected
Title: Re: Litle error maybe :?
Post by: 6Marilyn6Manson6 on 19 July, 2007, 16:44:54
Try now:

--// FunBot and Helpfully bot made by [NL]Davey
--// blastbeat ::--> thnx 4 your help.. with the function Ontimer !
--// If you found report please notify me with it
--// Added Joke's, Right Click, Login Message, Help Commands !
--// Turning Bot on/off Only avaible for Ops// Other commands avaible for every one !
--// EnjoY With It
------------------------------------Configuration------------------------------------------------
BotName = "MesseGe?"    -- The Name of your bot [ duhh ]
Start = 1               -- Start with script restarting 1 = yes  0 = no
Mins = 1                -- Interval between the message's if Start = 1
SendMain = "on"         -- Send Message to Main on/off
LogiN = "on"            -- Send Login Message on/off
RC_Name = "MesseGe?"    -- The name of your RIght Click
Owner = "Davey"         -- Owner Name
-------------------------------------------------------------------------------------------------
MessaGe = {
"\r\n\t\ Welcome to "..frmHub:GetHubName()..".",
"\r\n\t\ Whiiiiii, im so happy today :-D",
"\r\n\t\ Girl Rock Your Boddy",
"\r\n\t\ I think that [NL]Davey a Great scripter is",
"\r\n\t\ If you think im a bot then..... you have it fucKinG wronG !",
"\r\n\t\ WAZZZZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"\r\n\t\ Ownooo, I lose all my money",
"\r\n\t\ Ask A Operator for VIP status or check you right click commands",
"\r\n\t\ Im The BOM MUHAHAHAHAHAHA",
"\r\n\t\ 24 hours in a day ... 24 beers in a case ... coincidence?",
"\r\n\t\ The village called for ya ................... they want their idiot back",
"\r\n\t\ Don't piss me off! I'm running out of places to hide the bodies.",
"\r\n\t\ This hub is running Talk and HelpFullY Bot by [NL]Davey",
"\r\n\t\ The best hub owner is "..Owner.." ",
}

function Main()
frmHub:RegBot(BotName)
SetTimer(Mins*60000)
if Start == 1 then
StartTimer()
OnTimer()
end
end

function OnTimer()
if Start==1 then
local MessaGe = MessaGe[math.random(1,table.maxn(MessaGe))]
SendToAll(BotName, " "..MessaGe.."  ")
end
end

function OnError(msg)
SendPmToOps(BotName,"Hi. I have found an error. Please notify [NL]Davey with the follow message : "..msg)
end

function ChatArrival(user, data)
local data = string.sub(data,1,-2)
local _,_,cmd = string.find(data,"%b<>%s+(%S+)")
if cmd =="!askvip" then
SendPmToOps(BotName,"\r\n\t "..user.sName.." want become a vip in this hub .")
user:SendData(BotName,"Your request has been send! please be Patient !")
return 1
end
if cmd =="!showhub" then
dofile("FriendlyHubs.txt")
if next(FriendlyTable) then
local disp = "\r\n\t"..string.rep("- -",20).." Friendly Hubs "..string.rep("- -",20).."\r\n"
disp = disp.."\t\r\n"
for v, i in pairs(FriendlyTable) do
disp = disp.."\t\tName:  "..v.."\tAddress: "..FriendlyTable[v][3].."\tMinshare: "..FriendlyTable[v][1]..""..FriendlyTable[v][2].."\r\n"
end
disp = disp.."\r\n\t"..string.rep("- -",49)..""
user:SendPM(BotName, disp)
else
user:SendData(BotName,"ERROR! There are no friendly hubs added")
return 1
end
end
if user.bOperator then
if cmd =="!aan" then
SendToAll(BotName,"\r\n\t "..user.sName.." is calling the bot to talk again !!")
if SendMain == "off" then
SendMain = "on"
return 1
end
elseif cmd =="!uit" then
SendToAll(BotName,"\r\n\t "..user.sName.." Says to the bot: Leace this hub for a while !!")
if SendMain == "on" then
SendMain = "off"
StopTimer()
return 1
end
elseif cmd =="!mhelp" then
user:SendPM(BotName,"\r\n\t This is the Help Menu for Talker.\r\n\t !aan   -- The bot go On\r\n\t !uit   -- The bot go Off \r\n\t !mhelp -- Show this page")
return 1
end
elseif cmd =="!addhub" then
local s,e,cmd,minshare,what,addy,name = string.find( data, "%b<>%s+(%S+)%s+(%S+)%s+(%S+)%s+(%S+)%s+(.*)")
if FriendlyTable[name]== nil then
if minshare then
if what then
if addy then
if name then
FriendlyTable[name] ={minshare,what,addy}
saveTableToFile(FriendlyHubs,FriendlyTable,"FriendlyTable")
SendToOps(BotName,""..user.sName.." has added : "..name.." to the Friendly Hub List !!")
else
user:SendData(BotName, "Command is ::  !addfriendly <minshare> <b/kb/mb/gb/tb> <address> <hub name>!!!")
end
else
user:SendData(BotName, "Sorry, but the hub : "..name.." is allready in my Friendly List !!")
return 1
end
collectgarbage("collect")
end
end
end
end
end

function NewUserConnected(user)
user:SendData("$UserCommand 1 3 "..RC_Name.."\\Show Avaible Commands for me$<%[mynick]> !help&#124;")
user:SendData("$UserCommand 1 3 "..RC_Name.."\\Ask for Vip Satus$<%[mynick]> !askvip&#124;")
user:SendData("$UserCommand 1 3 "..RC_Name.."\\Show Friendly Hubs$<%[mynick]> !showhub&#124;")
if user.bOperator then
user:SendData("$UserCommand 1 3 "..RC_Name.."\\Talker On$<%[mynick]> !aan&#124;")
user:SendData("$UserCommand 1 3 "..RC_Name.."\\Talker Off$<%[mynick]> !uit&#124;")
user:SendData("$UserCommand 1 3 "..RC_Name.."\\Talker Help$<%[mynick]> !mhelp&#124;")
user:SendData("$UserCommand 1 3 "..RC_Name.."\\Add a Friendly Hub$<%[mynick]> !addhub&#124;")
user:SendData("$UserCommand 1 3 "..RC_Name.."\\?Login And Register MessaGe By [NL]Davey?$<%[mynick]>&#124;")
end
end

OpConnected = NewUserConnected
--// 6Marilyn6Manson6
Title: Re: Litle error maybe :?
Post by: Davey on 19 July, 2007, 19:07:40
hi,

I have test the script but the command !addhub doesn't work
I get No errors in the script but command doesn't work
[ :-: ] 18:56:47 [ :-: ] <Davey> !addhub test 10 GB

Anyway thnx 4 your help m8
Title: Re: Litle error maybe :?
Post by: 6Marilyn6Manson6 on 19 July, 2007, 20:24:21
I can test this script this evening and I fixed it, i post new version this night, c ya
Title: Re: Litle error maybe :?
Post by: Davey on 19 July, 2007, 20:44:01
Oki,

Im still working on it to the !addhub function...

Hope it is fixed soon ..

Thnx
Title: Re: Litle error maybe :?
Post by: [NL]Daddy-Bear? on 19 July, 2007, 20:54:27
Hello it?s me again.
Made some change just need some help with  !addhub
Who can help ?
--// FunBot and Helpfully bot made by [NL]Davey
--// blastbeat ::--> thnx 4 your help.. with the function Ontimer !
--// If you found report please notify me with it
--// Added Joke's, Right Click, Login Message, Help Commands !
--// Turning Bot on/off Only avaible for Ops// Other commands avaible for every one !
--//                  EnjoY With It

------------------------------------Configuration------------------------------------------------
BotName = "MesseGe?"    -- The Name of your bot [ duhh ]
Start = 1               -- Start with script restarting 1 = yes  0 = no
Mins = 11                -- Interval between the message's if Start = 1
SendMain = "on"         -- Send Message to Main on/off
LogiN = "on"            -- Send Login Message on/off
RC_Name = "MesseGe?"    -- The name of your RIght Click
Owner = "Davey"         -- Owner Name
-------------------------------------------------------------------------------------------------

MessaGe = {
"\r\n\t\ Welcome to "..frmHub:GetHubName()..".",
"\r\n\t\ Whiiiiii, im so happy today :-D",
"\r\n\t\ Girl Rock Your Boddy",
"\r\n\t\ I think that [NL]Davey a Great scripter is",
"\r\n\t\ If you think im a bot then..... you have it fucKinG wronG !",
"\r\n\t\ WAZZZZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"\r\n\t\ Ownooo, I lose all my money",
"\r\n\t\ Ask A Operator for VIP status or check you right click commands",
"\r\n\t\ Im The BOM MUHAHAHAHAHAHA",
"\r\n\t\ 24 hours in a day ... 24 beers in a case ... coincidence?",
"\r\n\t\ The village called for ya ................... they want their idiot back",
"\r\n\t\ Don't piss me off! I'm running out of places to hide the bodies.",
"\r\n\t\ This hub is running Talk and HelpFullY Bot by [NL]Davey",
"\r\n\t\ The best hub owner is "..Owner.." ",
}


function Main()
frmHub:RegBot(BotName)
SetTimer(Mins*60000)
if Start == 1 then
StartTimer()
OnTimer()
end
end

function OnTimer()
if Start==1 then
local MessaGe = MessaGe[math.random(1,table.maxn(MessaGe))]
SendToAll(BotName, " "..MessaGe.."  ")
end
end

OnError = function(msg)
SendPmToOps(BotName,"Hi. I have found an error. Please notify [NL]Davey with the follow message : "..msg)
end

function NewUserConnected(user)
                user:SendData("$UserCommand 1 3 "..RC_Name.."\\Show Avaible Commands for me$<%[mynick]> !help&#124;")
                user:SendData("$UserCommand 1 3 "..RC_Name.."\\Ask for Vip Satus$<%[mynick]> !askvip&#124;")
                user:SendData("$UserCommand 1 3 "..RC_Name.."\\Show Friendly Hubs$<%[mynick]> !showhub&#124;")
          if user.bOperator then
user:SendData("$UserCommand 1 3 "..RC_Name.."\\Talker On$<%[mynick]> !aan&#124;")
                user:SendData("$UserCommand 1 3 "..RC_Name.."\\Talker Off$<%[mynick]> !uit&#124;")
                user:SendData("$UserCommand 1 3 "..RC_Name.."\\Talker Help$<%[mynick]> !mhelp&#124;")
user:SendData("$UserCommand 1 3 "..RC_Name.."\\Add a Friendly Hub$<%[mynick]> !addword %[line:Geef minshare zonder gb etc] %[line:Geef GB MB etc] %[line:Hub naam]&#124;|")
                user:SendData("$UserCommand 1 3 "..RC_Name.."\\?Login And Register MessaGe By [NL]Davey?$<%[mynick]>&#124;")
end
end
OpConnected = NewUserConnected

function ChatArrival(user, data)
                local data = string.sub(data,1,-2)
local _,_,cmd = string.find(data,"%b<>%s+(%S+)")
if cmd =="!askvip" then
SendPmToOps(BotName,"\r\n\t "..user.sName.." want become a vip in this hub .")
                        user:SendData(BotName,"Your request has been send! please be Patient !")
return 1
                   end
                if cmd =="!showhub" then
               dofile("FriendlyHubs.txt")
if next(FriendlyTable) then
local disp = "\r\n\t"..string.rep("- -",20).." Friendly Hubs "..string.rep("- -",20).."\r\n"
disp = disp.."\t\r\n"
for v, i in pairs(FriendlyTable) do
disp = disp.."\t\tName:  "..v.."\tAddress: "..FriendlyTable[v][3].."\tMinshare: "..FriendlyTable[v][1]..""..FriendlyTable[v][2].."\r\n"
end
disp = disp.."\r\n\t"..string.rep("- -",49)..""
user:SendPM(BotName, disp)
else
user:SendData(BotName,"ERROR! There are no friendly hubs added")
return 1
end
end
          if user.bOperator then
if cmd =="!aan" then
SendToAll(BotName,"\r\n\t "..user.sName.." is calling the bot to talk again !!")
if SendMain == "off" then
SendMain = "on"
return 1
end
elseif cmd =="!uit" then
SendToAll(BotName,"\r\n\t "..user.sName.." Says to the bot: Leace this hub for a while !!")
if SendMain == "on" then
SendMain = "off"
StopTimer()
return 1
end
               elseif cmd =="!mhelp" then
                        user:SendPM(BotName,"\r\n\t This is the Help Menu for Talker.\r\n\t !aan   -- The bot go On\r\n\t !uit   -- The bot go Off \r\n\t !mhelp -- Show this page")
return 1
-- end
                elseif cmd =="!addhub" then
SendToAll ("1111111111")
                local s,e,cmd,minshare,what,addy,name = string.find( data, "%b<>%s+(%S+)%s+(%S+)%s+(%S+)%s+(%S+)%s+(.*)")
if FriendlyTable[name]== nil then
if minshare then
if what then
if addy then
if name then
SendToAll ("222222222")
FriendlyTable[name] ={minshare,what,addy}
saveTableToFile(FriendlyHubs,FriendlyTable,"FriendlyTable")
SendToOps(BotName,""..user.sName.." has added : "..name.." to the Friendly Hub List !!")
else
user:SendData(BotName, "Command is ::  !addfriendly <minshare> <b/kb/mb/gb/tb> <address> <hub name>!!!")
-- if FriendlyTable[name] ~= nil then
-- user:SendData(BotName, "Sorry, but the hub : "..name.." is allready in my Friendly List !!")
       return 1
-- end
end
end
   end
end
end
end
collectgarbage("collect")
end
end


Respectfully,

[NL]Daddy-Bear?
Title: Re: Litle error maybe :?
Post by: Davey on 21 July, 2007, 14:09:59
Hi im back with another problem :P
Somebody can fix it :?

When I add the code :
function NewUserConnected(user)
--SendToAll(MyInfoString)
       if LogiN=="on"  then

The nothings works anymore .... Only the talking Bot.. Rc =Disabled and the other Commands

Hole Code is --// FunBot and Helpfully bot made by [NL]Davey]
--// If you found report please notify me with it
--// This bot has the follow things :: Talk Bot, Right Commands, Debugger, LogiN MessaGe
--// Thnx to C??o?y?? & [NL]Daddy-Bear?4 helping with testing script
--//                  EnjoY With It

------------------------------------Configuration------------------------------------------------
BotName = "HelpFully"           -- The Name of your bot [ duhh ]
Start = 1                       -- Start with script restarting 1 = yes  0 = no
Mins = 1                        -- Interval between the message's if Start = 1
SendMain = "on"                 -- Send Message to Main on/off
LogiN = "on"                    -- Send Login Message on/off
RC_Name = "HelpFully"           -- The name of your RIght Click
Owner = "Your Name"             -- Owner Name
Debug = "on"                    -- Put it off if you don't need debug
Vote = ""                       -- Your Vote address
FriendlyHubsFile = "FriendlyHubs.txt"
MessagesFile = "Messages.txt"
-------------------------------------------------------------------------------------------------

FriendlyTable = {}
local f,e = io.open(FriendlyHubsFile, "a+" ) if f then f:write("" ) f:close() end
dofile(FriendlyHubsFile)

MessaGeTable = {}
local f,e = io.open(MessagesFile, "a+" ) if f then f:write("" ) f:close() end
dofile(MessagesFile)

function Main()
frmHub:RegBot(BotName)
SendToAll("???????????? This hub is running HelpFully Bot made by [NL]Davey !????????????")
SetTimer(Mins*60000)
dofile("Messages.txt")
if Start == 1 then
StartTimer()
end
end

function OnTimer()
if Start==1 then
local MessaGe = MessaGe[math.random(1,table.maxn(MessaGe))]
SendToAll(BotName,MessaGe)
end
end

function NewUserConnected(user)
--SendToAll(MyInfoString)
       if LogiN=="on"  then
user:SendData("???< This Hubs Is RunninG HelpFully Bot v1.0 ?y [NL]Davey >???")
user:SendData("???< You connected to "..frmHub:GetHubName().." at "..os.date("%H:%M:%S").." o'clock. Welcome!>")
if user.iProfile == 6 then -- Owner
SendToAll(BotName, "????????????Owner "..user.sName.." arrived.????????????")
elseif user.iProfile == 0 then -- Master
SendToAll(BotName, "????????????Master "..user.sName.." is back in da hub. Wacht Out ! ????????????")
elseif user.iProfile == 5 then -- Netfounder
SendToAll(BotName, "????????????Netfounder "..user.sName.." arrived with his ladies. Welcome Back ????????????")
elseif user.iProfile == 1 then -- Operator
SendToAll(BotName, "????????????Operator "..user.sName.." arrived. Check your shared files before he/she do it.???????????? ")
elseif user.iProfile == 4 then -- Moderator
SendToAll(BotName, "????????????Moderator "..user.sName.." arrived in his car. Welcome back???????????? ")
elseif user.iProfile == 2 then -- VIP
SendToAll(BotName, "????????????VIP "..user.sName.." is coming back for sharing new files!???????????? ")
elseif user.iProfile == 3 then -- Reg
SendToAll(BotName, "????????????Regged Person "..user.sName.." arrived.????????????")
end
user:SendData("$UserCommand 1 3 "..RC_Name.."\\Show Avaible Commands for me$<%[mynick]> !help&#124;")
user:SendData("$UserCommand 1 3 "..RC_Name.."\\Ask for Vip Satus$<%[mynick]> !askvip&#124;")
user:SendData("$UserCommand 1 3 "..RC_Name.."\\Show Friendly Hubs$<%[mynick]> !showhub&#124;")
if user.bOperator then
user:SendData("$UserCommand 1 3 "..RC_Name.."\\Debugger On$<%[mynick]> !debugon&#124;")
user:SendData("$UserCommand 1 3 "..RC_Name.."\\Debugger Off$<%[mynick]> !debugoff&#124;")
user:SendData("$UserCommand 1 3 "..RC_Name.."\\LogiN Messages On$<%[mynick]> !LogiNOn&#124;")
user:SendData("$UserCommand 1 3 "..RC_Name.."\\LogiN Messages Off$<%[mynick]> !LogiNOff&#124;")
user:SendData("$UserCommand 1 3 "..RC_Name.."\\Talker On$<%[mynick]> !talkon&#124;")
user:SendData("$UserCommand 1 3 "..RC_Name.."\\Talker Off$<%[mynick]> !talkoff&#124;")
user:SendData("$UserCommand 1 3 "..RC_Name.."\\Show me the Bot Commands$<%[mynick]> !mhelp&#124;")
user:SendData("$UserCommand 1 3 "..RC_Name.."\\Add a Friendly Hub$<%[mynick]> !addhub %[line:Minshare NO Ammount!] %[line:b/kb/mb/gb/tb] %[line:Adress] %[line:Hubname]&#124;")
user:SendData("$UserCommand 1 3 "..RC_Name.."\\?Login And Register MessaGe By [NL]Davey?$<%[mynick]>&#124;")
end
end

OpConnected = NewUserConnected

OnError = function(msg)
SendPmToOps(BotName,"Hi. I have found an error. Please notify [NL]Davey with the follow message : "..msg)
end

ChatArrival = function(user,data)
local data = string.sub(data,1,-2)
local _,_,cmd = string.find(data,"%b<>%s+(%S+)")
if cmd =="!askvip" then
if Debug == "on" then
SendToAll("debugger",data)
end
SendPmToOps(BotName,"\r\n\t "..user.sName.." want become a vip in this hub .")
user:SendData(BotName,"Your request has been send! please be Patient !")
return 1
end
if cmd =="!showhub" then
if next(FriendlyTable) then
local disp = "\r\n\t"..string.rep("- -",20).." Friendly Hubs "..string.rep("- -",20).."\r\n"
disp = disp.."\t\r\n"
for v, I in pairs(FriendlyTable) do
disp = disp.."\t\tName:  "..v.."\tAddress: "..FriendlyTable[v][3].."\tMinshare: "..FriendlyTable[v][1]..""..FriendlyTable[v][2].."\r\n"
end
disp = disp.."\r\n\t"..string.rep("- -",49)..""
user:SendPM(BotName, disp)
else
user:SendData(BotName,"ERROR! There are no friendly hubs added")
end
return 1
end
if user.bOperator then
if cmd =="!talkon" then
if Debug == "on" then
SendToAll("debugger",data)
end
SendToAll(BotName,"\r\n\t "..user.sName.." is calling the bot to talk again !!")
if SendMain == "off" then
SendMain = "on"
end
return 1
end
if cmd =="!talkoff" then
if Debug == "on" then
SendToAll("debugger",data)
end
SendToAll(BotName,"\r\n\t "..user.sName.." Says to the bot: Leave this hub for a while !!")
if SendMain == "on" then
SendMain = "off"
StopTimer()
end
return 1
end
if cmd =="!mhelp" then
if Debug == "on" then
SendToAll("debugger",data)
end
user:SendPM(BotName,"\r\n\t This is the Help Menu for Talker.\r\n\t !talkon   -- The bot go On\r\n\t !talkoff   -- The bot go Off \r\n\t !mhelp -- Show this page \r\n\t !help  -- All avaible commands for your pofile ")
return 1
end
if cmd =="!addhub" then
if Debug == "on" then
SendToAll("debugger",data)
end
local _,_,cmd,minshare,what,addy,name = string.find(data,"%b<>%s+(%S+)%s+(%S+)%s+(%S+)%s+(%S+)%s+(.*)")
if FriendlyTable[name]== nil then
if minshare and what and addy and name then
FriendlyTable[name] ={minshare,what,addy}
saveTableToFile(FriendlyHubsFile,FriendlyTable,"FriendlyTable")
SendToOps(BotName,""..user.sName.." has added : "..name.." to the Friendly Hub List !!")
else
user:SendData(BotName, "Command is ::  !addhub <minshare> <b/kb/mb/gb/tb> <address> <hub name>!!!")
end
else
user:SendData(BotName, "Sorry, but the hub : "..name.." is allready in my Friendly List !!")
end
return 1
end
else
user:SendData(BotName,"This was Operator command... you are not allowed to use it!")
return 1
end
if cmd =="!debugoff" then
if Debug == "on" then
Debug = "off"
SendToAll(BotName, " "..user.sName.." has disabled the debugger ! ")
end
return 1
end
if cmd =="!debugon" then
            if Debug == "off" then
Debug = "on"
SendToAll(BotName, " "..user.sName.." has enabled the debugger !")
end
return 1
end
if cmd =="!LogiNOn" then
            if LogiN == "off" then
LogiN = "on"
SendToAll(BotName, " "..user.sName.." has enabled the LogiN messages!")
end
return 1
    end
if cmd =="!LogiNOff" then
            if LogiN == "on" then
LogiN = "off"
SendToAll(BotName, " "..user.sName.." has disabled the LogiN messages !")
end
return 1
end
collectgarbage("collect")
end

Serialize = function(tTable,sTableName,hFile,sTab)
sTab = sTab or ""
hFile:write(sTab..sTableName.." = {\n")
for key,value in pairs(tTable) do
if (type(value) ~= "function") then
local sKey = (type(key) == "string") and string.format("[%q]",key) or string.format("[%d]",key)
if(type(value) == "table") then
Serialize(value,sKey,hFile,sTab.."\t")
else
local sValue = (type(value) == "string") and string.format("%q",value) or tostring(value)
hFile:write(sTab.."\t"..sKey.." = "..sValue)
end
hFile:write(",\n")
end
end
hFile:write(sTab.."}")
end

saveTableToFile = function(file, table, tablename)
local handle = io.open(file,"w")
Serialize(table,tablename,handle)
    handle:close()
io.flush()
end
end



can somebody help ;x ;-)
Title: Re: Litle error maybe :?
Post by: blastbeat on 21 July, 2007, 14:22:38
i guess an "end" is missing:


function NewUserConnected(user)
--SendToAll(MyInfoString)
       if LogiN=="on"  then
             .
             .
             .
             .
       end
end
Title: Re: Litle error maybe :?
Post by: Davey on 21 July, 2007, 14:26:19
End is here

user:SendData("$UserCommand 1 3 "..RC_Name.."\\Add a Friendly Hub$<%[mynick]> !addhub %[line:Minshare NO Ammount!] %[line:b/kb/mb/gb/tb] %[line:Adress] %[line:Hubname]&#124;")
user:SendData("$UserCommand 1 3 "..RC_Name.."\\?Login And Register MessaGe By [NL]Davey?$<%[mynick]>&#124;")
end
end


But it doesn't works :-(
Title: Re: Litle error maybe :?
Post by: blastbeat on 21 July, 2007, 14:31:34
no it isnt


function NewUserConnected(user)
       if LogiN=="on"  then

if user.iProfile == 6 then -- Owner

end

if user.bOperator then

end
end


try this:


function NewUserConnected(user)
--SendToAll(MyInfoString)
       if LogiN=="on"  then
user:SendData("•••< This Hubs Is RunninG HelpFully Bot v1.0 ?y [NL]Davey >•••")
user:SendData("•••< You connected to "..frmHub:GetHubName().." at "..os.date("%H:%M:%S").." o'clock. Welcome!>")
if user.iProfile == 6 then -- Owner
SendToAll(BotName, "?˜”??•?˜”??•Owner "..user.sName.." arrived.•??”˜?•??”˜?")
elseif user.iProfile == 0 then -- Master
SendToAll(BotName, "?˜”??•?˜”??•Master "..user.sName.." is back in da hub. Wacht Out ! •??”˜?•??”˜?")
elseif user.iProfile == 5 then -- Netfounder
SendToAll(BotName, "?˜”??•?˜”??•Netfounder "..user.sName.." arrived with his ladies. Welcome Back •??”˜?•??”˜?")
elseif user.iProfile == 1 then -- Operator
SendToAll(BotName, "?˜”??•?˜”??•Operator "..user.sName.." arrived. Check your shared files before he/she do it.•??”˜?•??”˜? ")
elseif user.iProfile == 4 then -- Moderator
SendToAll(BotName, "?˜”??•?˜”??•Moderator "..user.sName.." arrived in his car. Welcome back•??”˜?•??”˜? ")
elseif user.iProfile == 2 then -- VIP
SendToAll(BotName, "?˜”??•?˜”??•VIP "..user.sName.." is coming back for sharing new files!•??”˜?•??”˜? ")
elseif user.iProfile == 3 then -- Reg
SendToAll(BotName, "?˜”??•?˜”??•Regged Person "..user.sName.." arrived.•??”˜?•??”˜?")
end
user:SendData("$UserCommand 1 3 "..RC_Name.."\\Show Avaible Commands for me$<%[mynick]> !help&#124;")
user:SendData("$UserCommand 1 3 "..RC_Name.."\\Ask for Vip Satus$<%[mynick]> !askvip&#124;")
user:SendData("$UserCommand 1 3 "..RC_Name.."\\Show Friendly Hubs$<%[mynick]> !showhub&#124;")
if user.bOperator then
user:SendData("$UserCommand 1 3 "..RC_Name.."\\Debugger On$<%[mynick]> !debugon&#124;")
user:SendData("$UserCommand 1 3 "..RC_Name.."\\Debugger Off$<%[mynick]> !debugoff&#124;")
user:SendData("$UserCommand 1 3 "..RC_Name.."\\LogiN Messages On$<%[mynick]> !LogiNOn&#124;")
user:SendData("$UserCommand 1 3 "..RC_Name.."\\LogiN Messages Off$<%[mynick]> !LogiNOff&#124;")
user:SendData("$UserCommand 1 3 "..RC_Name.."\\Talker On$<%[mynick]> !talkon&#124;")
user:SendData("$UserCommand 1 3 "..RC_Name.."\\Talker Off$<%[mynick]> !talkoff&#124;")
user:SendData("$UserCommand 1 3 "..RC_Name.."\\Show me the Bot Commands$<%[mynick]> !mhelp&#124;")
user:SendData("$UserCommand 1 3 "..RC_Name.."\\Add a Friendly Hub$<%[mynick]> !addhub %[line:Minshare NO Ammount!] %[line:b/kb/mb/gb/tb] %[line:Adress] %[line:Hubname]&#124;")
user:SendData("$UserCommand 1 3 "..RC_Name.."\\•Login And Register MessaGe By [NL]Davey•$<%[mynick]>&#124;")
end
      end
end
Title: Re: Litle error maybe :?
Post by: Davey on 21 July, 2007, 14:34:40
Oki i will try it :-)

-------------------------------------------------------------------------------------
Ok I have test it and now its works perfect.
Thnx 4 your help blastbeat ;-)
;D
Title: Re: Litle error maybe :?
Post by: 6Marilyn6Manson6 on 21 July, 2007, 14:39:39
Quote from: blastbeat on 21 July, 2007, 14:22:38
i guess an "end" is missing:


function NewUserConnected(user)
--SendToAll(MyInfoString)
       if LogiN=="on"  then
             .
             .
             .
             .
       end


Quote, you missing one "end" in your function
Title: Re: Litle error maybe :?
Post by: Davey on 24 July, 2007, 13:19:57
Thnx 4 the replys...
The bot is now finished ;-)

Thnx 4 all helping with it :-)
Hi

I have got an error with random messages...
I have never before get this error,

It is fixed

Ok I thought it was fixed, but now doesn't the script check badnicknames
Can somebody help me with it ?

this it the table
FriendlyTable = {}
MessaGeTable = {}
BadnicknameTable = {}

tables = {
FriendlyHubsFile,
MessagesFile,
BadnicknameFile
}

for _,file in pairs(tables) do
local f,e = io.open(file, "a+" ) if f then f:write("" ) f:close() end
dofile(file)
end


and this is the code of myinfo
MyINFOArrival = function(user,data)
for _,bad in pairs(tables) do
local bad,nick = bad:lower(),user.sName:lower()
if nick:find(bad) then
user:SendData(frmHub:GetHubBotName(),"bye jerk")
SendPmToOps(BotName," "..user.sName.." with ip "..user.sIP.." is been disconnected because: He use a Bad Nick Name!")
user:Disconnect()
end
end
end
Title: Re: Litle error maybe :?
Post by: Leun on 24 July, 2007, 15:04:37
try this (not tested)


-- load table from file
dofile(BadnicknameFile)



or


tables = {
FriendlyHubsFile,
MessagesFile,
BadnicknameFile
}

for _,file in pairs(tables) do
local f,e = io.open(file, "a+" ) if f then f:write("" ) f:close() end
dofile(file)
end



and


MyINFOArrival = function(user,data)
for _,bad in pairs(BadnicknameTable) do
local bad,nick = bad:lower(),user.sName:lower()
if nick:find(bad) then
user:SendData(frmHub:GetHubBotName(),"bye jerk")
SendPmToOps(BotName," "..user.sName.." with ip "..user.sIP.." is been disconnected because: He use a Bad Nick Name!")
user:Disconnect()
end
end
end
Title: Re: Litle error maybe :?
Post by: Davey on 25 July, 2007, 20:13:11
Hey,

I have test it but it doesn't work.
I get No error message but the bot doesn't disconnect the user who used a badnickname

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

It's fixed now :-)
Hi,

When I add the function check bad words, the scripts give me this error messages ::->
HelpFullyv1.2.lua:195: bad argument #1 to 'gmatch' (string expected, got nil)
Can Somebody help me ??

Problem Solved :-)
Title: Re: Litle error maybe :?
Post by: Madman on 25 July, 2007, 21:34:59
Code (lua) Select
local s,e,msg = string.find(string.lower(data), "^%b<>(.+)")
Change 194 to that
Title: Re: Litle error maybe :?
Post by: Davey on 25 July, 2007, 21:46:20
Hi madman,

I have test it but when I say a bad word, nothing that happend, only that the word doesn't show
Only by the bad word Fuck he is disconnecting me, but with my other words nothing...
I have found allready the trouble
on line 202 return 1 <<--- this must be deleted
Now he works with all the words ;-)

Thnx madman with your help
Title: Re: Litle error maybe :?
Post by: Madman on 25 July, 2007, 21:51:34

Yup, i was just going to tell you that,
the return 1 blocks the loop.
besides your return SendPmToOps line allready have a return 1, so the word still won't show
Title: Re: Litle error maybe :?
Post by: Davey on 25 July, 2007, 22:27:12
Hmm when adding a new function to it i get this error
HelpFullyv1.2.lua:225: unexpected symbol near '='
And if I remove the = I must go remove >
Can somebody Help.

Trouble Solved ;-)
Title: Re: Litle error maybe :?
Post by: 6Marilyn6Manson6 on 25 July, 2007, 22:46:20
Change:

for key,a in BlockAdverFile do =>for key,a in pairs(BlockAdverTable) do

with:

for key,a in pairs(BlockAdverTable) do
Title: Re: Litle error maybe :?
Post by: Davey on 26 July, 2007, 09:43:38
thnx m8
it is working perfectly now :-)
Title: Re: Litle error maybe :?
Post by: 6Marilyn6Manson6 on 26 July, 2007, 11:36:35
 ;D
Title: Re: Litle error maybe :?
Post by: Davey on 26 July, 2007, 15:31:17
Hey,

I have add bad search detection to it, but when a user search to it, nothing happend...  :'(
I get No errors in it, but I think im forgot something ?? But what ?? Can't find it out lol
Can somebody help ?
SearcArrivel begins from line 240
This is the code of hole script

--// FunBot and Helpfully bot made by [NL]Davey?]
--// Version 1.2 has the follow things :-->
--// New Commands: 1) Check for bad nick name, 2) Who get rc commands, 3) Block Advertise in PM!
--// Removed :: Debugger
--// Thnx to [NL]Daddy-Bear with reporting the follow message ::
--// Important if you running the opsecurity lua then this lua must be above it in the list from PX other wile you get no RC

------------------------------------Configuration------------------------------------------------
BotName = "HelpFully"           -- The Name of your bot [ duhh ]
Start = 1                       -- Start with script restarting 1 = yes  0 = no
Mins = 1                        -- Interval between the message's if put on by !talkon or RC command
SendMain = "on"                 -- Send Message to Main on/off
LogiN = "on"                    -- Send Login Message on/off
RC_Name = "HelpFully"           -- The name of your RIght Click
Owner = "Your Name"             -- Owner Name
FriendlyHubsFile = "FriendlyHubs.txt"
MessagesFile = "Messages.txt"
BadnicknameFile = "BadNick.txt"
BadWordsFile = "BadWords.txt"
BlockAdverFile = "BlockAdver.txt"
BadSearch = "BadSearch.txt"
--------------------------------------End Configuration------------------------------------------

-------------Who Get the Rc Commands?------------------------------------------------

ProFile = { -- Give a Profile Rc Commands  1 = Yes 0 = No
[0] = 1, -- Master 
[1] = 0, -- Operator 
[2] = 0, -- VIP 
[3] = 0, -- Registered 
[4] = 0, -- Moderator 
[5] = 1, -- Netfounder
[6] = 1, -- Owner 
[-1] = 0, -- Unregistered 
}
-------------End of Who get the Rc Commands--------------------------------------------

FriendlyTable = {}
MessaGeTable = {}
BadnicknameTable = {}
BadWordsTable = {}
BlockAdverTable = {}
BadSearchTable = {}

tables = {
FriendlyHubsFile,
MessagesFile,
BadnicknameFile,
BadWordsFile,
BlockAdverFile,
BadSearchFile
}
for _,file in pairs(tables) do
local f,e = io.open(file, "a+" ) if f then f:write("" ) f:close() end
dofile(file)
end

function Main()
frmHub:RegBot(BotName)
SetTimer(Mins*60000)
dofile("Messages.txt")
string.gmatch = (string.gmatch or string.gfind);
end

function OnTimer()
if Start==1 then
local MessaGe = MessaGeTable[math.random(1,table.maxn(MessaGeTable))]
SendToAll(BotName,MessaGe)
end
end

function NewUserConnected(user)
if ProFile[user.iProfile] == 0 then
user:SendData("$UserCommand 1 3 "..RC_Name.."\\Show Avaible Commands for me$<%[mynick]> !help&amp;#124;")
user:SendData("$UserCommand 1 3 "..RC_Name.."\\Ask for Vip Satus$<%[mynick]> !askvip&amp;#124;")
user:SendData("$UserCommand 1 3 "..RC_Name.."\\Show Friendly Hubs$<%[mynick]> !showhub&amp;#124;")
end
if ProFile[user.iProfile] == 1 then
user:SendData("$UserCommand 1 3 "..RC_Name.."\\HelpBot\\LogiN\\LogiN Messages On$<%[mynick]> !LogiNOn&amp;#124;")
user:SendData("$UserCommand 1 3 "..RC_Name.."\\HelpBot\\LogiN\\LogiN Messages Off$<%[mynick]> !LogiNOff&amp;#124;")
user:SendData("$UserCommand 1 3 "..RC_Name.."\\HelpBot\\Talk Bot\\Talker On$<%[mynick]> !talkon&amp;#124;")
user:SendData("$UserCommand 1 3 "..RC_Name.."\\HelpBot\\Talk Bot\\Talker Off$<%[mynick]> !talkoff&amp;#124;")
user:SendData("$UserCommand 1 3 "..RC_Name.."\\HelpBot\\Bot\\Show me the Bot Commands$<%[mynick]> !mhelp&amp;#124;")
user:SendData("$UserCommand 1 3 "..RC_Name.."\\HelpBot\\Friendly\\Add a Friendly Hub$<%[mynick]> !addhub %[line:Minshare NO Ammount!] %[line:b/kb/mb/gb/tb] %[line:Adress] %[line:Hubname]&amp;#124;")
user:SendData("$UserCommand 1 3 "..RC_Name.."\\HelpBot\\Friendly\\Delete a Friendly Hub$<%[mynick]> !delhub %[line:name or all]&#124:")
user:SendData("$UserCommand 1 3 "..RC_Name.."\\HelpBot\\Friendly\\Show Friendly Hubs$<%[mynick]> !showhub&amp;#124;")
user:SendData("$UserCommand 1 3 "..RC_Name.."\\?Login And Register MessaGe By [NL]Davey?$<%[mynick]>&amp;#124;")
end
end


OpConnected = NewUserConnected

OnError = function(msg)
SendPmToOps(BotName,"Hi. I have found an error. Please notify [NL]Davey with the follow message : "..msg)
end

ChatArrival = function(user,data)
local data = string.sub(data,1,-2)
local _,_,cmd = string.find(data,"%b<>%s+(%S+)")
if cmd =="!askvip" then
SendPmToOps(BotName,"\r\n\t"..user.sName.." with Ip "..user.sIP.." want become a vip in this hub .")
user:SendData(BotName,"Your request has been send! please be Patient !")
return 1
end
if cmd =="!showhub" then
if next(FriendlyTable) then
local disp = "\r\n\t"..string.rep("- -",20).." Friendly Hubs "..string.rep("- -",20).."\r\n"
disp = disp.."\t\r\n"
for v, I in pairs(FriendlyTable) do
disp = disp.."\t\tName:  "..v.."\tAddress: "..FriendlyTable[v][3].."\tMinshare: "..FriendlyTable[v][1]..""..FriendlyTable[v][2].."\r\n"
end
disp = disp.."\r\n\t"..string.rep("- -",49)..""
user:SendPM(BotName, disp)
else
user:SendData(BotName,"There are no friendly hubs added")
end
return 1
end
if ProFile[user.iProfile] == 0 then
if cmd =="!LogiNOff" or cmd =="!LogiNOn" or cmd =="!mhelp" or cmd =="!delhub" or cmd =="!addhub" or cmd =="!talkoff" or cmd =="!talkon" then
user:SendData(BotName,"Sorry, But you don't have acces to use this function!!!")
return 1
end
end
  if ProFile[user.iProfile] == 1 then
if cmd =="!talkon" then
SendToAll(BotName,"\r\n\t "..user.sName.." is enabeling the TalkeR :-D, Whiiiii !!")
StartTimer()
if SendMain == "off" then
SendMain = "on"
end
return 1
end
if cmd =="!talkoff" then
SendToAll(BotName,"\r\n\t "..user.sName.." Is disabeling the TalkeR :-(, Bye !!")
if SendMain == "on" then
SendMain = "off"
StopTimer()
end
return 1
end
if cmd =="!mhelp" then
user:SendPM(BotName,"\r\n\t Here are all avaible Commands for your Profile!.\r\n\r\n\t !talkon   -- The bot go On\r\n\t !talkoff   -- The bot go Off \r\n\t !addhub   --  Add a friendly hub to your Friendly Hub List! \r\n\t !delhub   --  Remove a friendly hub from your Friendly list \r\n\t !showhub   --  Shows you the added friendly hubs! \r\n\t\ !LogiNOn  -- Enable the LogiN MessaGes \r\n\t\ !LogiNOff -- Disable the LogiN MessaGes \r\n\t !mhelp -- Show this page \r\n\t !help  -- All avaible commands for your pofile ")
return 1
end
if cmd =="!addhub" then
local _,_,cmd,minshare,what,addy,name = string.find(data,"%b<>%s+(%S+)%s+(%S+)%s+(%S+)%s+(%S+)%s+(.*)")
if FriendlyTable[name]== nil then
if minshare and what and addy and name then
FriendlyTable[name] ={minshare,what,addy}
saveTableToFile(FriendlyHubsFile,FriendlyTable,"FriendlyTable")
SendToOps(BotName,""..user.sName.." has added : "..name.." to the Friendly Hub List !!")
else
user:SendData(BotName, "Command is ::  !addhub <minshare> <b/kb/mb/gb/tb> <address> <hub name>!!!")
end
else
user:SendData(BotName,"Sorry, but the hub : "..name.." is allready in my Friendly List !!")
end
return 1
end
end
if cmd =="!delhub" then
local s,e,what = string.find(data, "%b<>%s+%S+%s+(.*)")
if what then
if what == "all" then
SendToOps(BotName,"All Friendly Hubs Are been Deleted By: "..user.sName)
FriendlyTable = {}
saveTableToFile(FriendlyHubsFile,FriendlyTable,"FriendlyTable")
return 1
end
if FriendlyTable[what] then
FriendlyTable[what] = nil
saveTableToFile(FriendlyHubsFile,FriendlyTable,"FriendlyTable")
SendToOps(BotName,"Hub NameD: "..what.." is removed from the Friendly Hub List by: "..user.sName)
end
return 1
end
end
if cmd =="!LogiNOn" then
            if LogiN == "off" then
LogiN = "on"
SendToAll(BotName, " "..user.sName.." has enabled the LogiN messages!")
end
return 1
    end
if cmd =="!LogiNOff" then
            if LogiN == "on" then
LogiN = "off"
SendToAll(BotName, " "..user.sName.." has disabled the LogiN messages !")
end
return 1
else
-- if ProFile[user.iProfile] ~= 1 then
if cmd =="!LogiNOff" or cmd =="!LogiNOn" or cmd =="!delhub" or cmd =="!addhub" or cmd =="!talkoff" or cmd =="!talkon" or cmd =="!mhelp" then
user:SendData(BotName,"Sorry, But you don't have acces to use this function!!!")
return 1
-- end
      else
      if not user.bOperator then
       local s,e,msg = string.find(string.lower(data), "^%b<>(.+)")
for word in string.gmatch(msg,"%S+") do
for key,val in ipairs(BadWordsTable) do
if word == string.lower(val) then
return SendPmToOps(BotName," "..user.sName.." Is Disconnected "..
"because he has try to say : "..data),user:SendData(BotName,user.sName..", "..
"You has try to say "..word.." This word isn't allowed in here!."),user:Disconnect(),1
end
end
collectgarbage("collect")
end
end
  end
end
end

MyINFOArrival = function(user,data)
for _,bad in pairs(BadnicknameTable) do
local bad,nick = bad:lower(),user.sName:lower()
if nick:find(bad) then
user:SendData(BotName,"You are been disconnected for using a badnickname! Change it and come back")
SendPmToOps(BotName," "..user.sName.." with ip "..user.sIP.." is been disconnected because: Using a Bad NickName!!")
user:Disconnect()
end
end
end

function ToArrival(user, data)
if user.iProfile ~= 0  and user.iProfile ~= 2 and user.iProfile ~= 3 then
for key,a in pairs(BlockAdverTable) do
if( string.find(string.lower(data), key) ) then
         user:SendPM(BotName, "No,no,no don't avdertise to other peoples!!!")
         SendPmToOps(BotName, " "..user.sName.." with Ip "..user.sIP.." has tryed to send this "..data.." ")
         return 1
         end
     end
  end
end

SearchArrival = function(user,data)
if user.iProfile ~= 0  and user.iProfile ~= 2 and user.iProfile ~= 3 then
local s,e,what = string.find(data, "$Search %S+%s%S+?%S+?%S+?%S+?(.*)|")
for deny,key in pairs(BadSearchTable) do
if string.find(what,deny) then
BadSearch_Message(user,what,deny)
SendPmToOps(BotName,BotName,"\n\n\tBAD SEARCH DETECTED !!\n\t?Info: "..user.sName.." / "..user.sIP.."\n\t?Searched: "..what.."\n\t?Blocked by: "..deny.."\n")
user:SendData("TTH:BLOCKEDBYHELPFULLY ("..frmHub:GetHubIp()..":"..frmHub:GetHubPort()..")")
return 1
end
end
end
end

saveTableToFile = function(file, table, tablename)
local handle = io.open(file,"w")
Serialize(table,tablename,handle)
    handle:close()
io.flush()
end
Title: Re: Litle error maybe :?
Post by: 6Marilyn6Manson6 on 26 July, 2007, 17:11:00
Reply SearchArrival with this: (not tested)

SearchArrival = function(user,data)
if user.iProfile ~= 0  and user.iProfile ~= 2 and user.iProfile ~= 3 then
for deny,key in pairs(BadSearchTable) do
if string.find(string.lower(what,deny)) then
local s,e,what = string.find(data, "$Search %S+%s%S+?%S+?%S+?(%S+)?(.*)")
BadSearch_Message(user,what,deny)
SendPmToOps(BotName,BotName,"\n\n\tBAD SEARCH DETECTED !!\n\t?Info: "..user.sName.." / "..user.sIP.."\n\t?Searched: "..what.."\n\t?Blocked by: "..deny.."\n")
user:SendData("TTH:BLOCKEDBYHELPFULLY ("..frmHub:GetHubIp()..":"..frmHub:GetHubPort()..")")
return 1
end
end
end
end
Title: Re: Litle error maybe :?
Post by: Davey on 26 July, 2007, 17:19:21
Hi,

I have test it but I got No messages
And it's not block the Bad Search

Title: Re: Little error maybe :?
Post by: 6Marilyn6Manson6 on 26 July, 2007, 18:31:38
Hi, now I'm doing a backup of Windows, when it has finish, I can star with test, sorry  :'(
Title: Re: Little error maybe :?
Post by: Davey on 26 July, 2007, 18:46:22
Oki, im also trying some thing to get it working, but without any suc6...
Hope whe can fix it soon!