I have some problems with a script that sends a message to all online OPs.
It's for users that wanna report a faker or other relevant stuff...
I got a script, but every time I send a msg, like; "!report ", it will only show the first word in the line to the OP it is send to.
E.g, user writes:"!report I wanna report a faker!" --> the OP is getting the line: "The user [DK][OP]Smul reported: I",
so it's only the "I" and not the rest of the line.
The conclusion is that when a user is typing "SPACE" in the line the words after that won't be there...
The script:
--- Made by nErBoS ------
Bot = "Report"
function Main()
frmHub:RegBot(Bot)
end
function DataArrival(user, data)
if (strsub(data,1,1)=="<") or (strsub(data,1,5+strlen(Bot))=="$To: "..Bot) then
data=strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data,"%b<>%s+(%S+)")
if (cmd=="!report") then
DoReport(user, data)
return 1
end
end
end
function DoReport(user, data)
s,e,cmd,msg = strfind(data, "%b<>%s+(%S+)%s+(%S+)%s*")
if (msg ~= nil) then
SendPmToOps(Bot, "The user "..user.sName.." reported: "..msg)
user:SendPM(Bot, "Your report has been send to all online OPs.")
elseif (msg == nill) then
user:SendPM(Bot, "You must write a message, '!opreport '")
end
end
If you understood anything of what I just wrote, it would be nice to here from you...
you try to put this:
s,e,cmd,msg = strfind(data, "%b<>%s(%S+)%s(.+)")
instread this:
s,e,cmd,msg = strfind(data, "%b<>%s+(%S+)%s+(%S+)%s*")
--- Made by nErBoS ------
Bot = "Report"
function Main()
frmHub:RegBot(Bot)
end
function DataArrival(user, data)
if (strsub(data,1,1)=="<") or (strsub(data,1,5+strlen(Bot))=="$To: "..Bot) then
data=strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data,"%b<>%s+(%S+)")
if (cmd=="!report") then
DoReport(user, data)
return 1
end
end
end
function DoReport(user, data)
s,e,cmd,msg = strfind(data, "%b<>%s(%S+)%s(.+)")
if (msg ~= nil) then
SendPmToOps(Bot, "The user "..user.sName.." reported: "..msg)
user:SendPM(Bot, "Your report has been send to all online OPs.")
elseif (msg == nil) then
user:SendPM(Bot, "You must write a message, '!report '")
end
end
Thanks for such a fast reply and your time. It works... :P
ehehehe... It is not a job for me, it is like a test for see if I have understood like the LUA works. :D
My bad Smulf forgot that, thanks for the correction DorianG.
Best regards, nErBoS
Well no offence:) when you have alot to do sometimes you miss something...