I understand that if I put:
Return 1 in the DataArrival function, it stops the hubsoft from processing cmds.
Now what if I want to stop the hubsoft processing some commands but not others?
Example:
!help - will use hubsoft !help. If I have my own !help, it processes both unless I return 1 in the DA but that turns all Hubsoft processing off so I loose commands like !ban user.
I thought this would work, but doesn't:
function DataArrival(user, data)
if( strsub(data, 1, 1) == "<" ) then
data=strsub(data,1,strlen(data)-1)
local s,e,cmd = strfind(data, "%b<>%s+(%S+)")
if cmd == prefix .."help" then
MainCommands(user, data)
return 1
else
MainCommands(user, data)
end
end
but it doesn't work. When I tried that, any hubsoft command worked except !help.
Any Idea's please?
Thanks
Woosh
it all depends where you place the return 1.
for a hint take a look @ crazy bot and then specialy what the global sssst does.
i'll make the hint a bit more clear, sssst starts with being 0.
if a bot command it found it's changed to 1.
next when your done with all the commands you check sssst in dataarrival, if it's 1 you do a return 1.
plop
Thank you Plop, my idea was right, but scripting wrong....
I have done it as per Cracy Bot and it works a treat... Thanks :-)
Solution:
function DataArrival(user, data)
xtracmd = 0
if( strsub(data, 1, 1) == "<" ) then
MainCommands(user, data)
if xtracmd == 1 then
return 1
end
end
end
-- cmds file ----
if cmd == prefix .."help" then
help(user,data) --- go and do !help cmd
xtracmd = 1 -- make sure hubsoft ignores !help and does not run its own !help
end
Thanks again Plop :-)
Nice solusions. but you can do it simpler if you want to.
your code Woosh:
function DataArrival(user, data)
xtracmd = 0
if( strsub(data, 1, 1) == "<" ) then
MainCommands(user, data)
if xtracmd == 1 then
return 1
end
end
end
-- cmds file ----
if cmd == prefix .."help" then
help(user,data) --- go and do !help cmd
xtracmd = 1 -- make sure hubsoft ignores !help and does not run its own !help
end
my code:
function DataArrival(user, data)
if( strsub(data, 1, 1) == "<" ) then
MainCommands(user, data)
end
end
-- cmds file ----
if cmd == prefix .."help" then
help(user,data) --- go and do !help cmd
return 1 -- make sure hubsoft ignores !help and does not run its own !help
end
just so you learn m8.
Talk soon. Visit sometime when hub is up.
/NL