PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: Smulf on 08 February, 2004, 13:45:31

Title: "!OPreport" from normal user
Post by: Smulf on 08 February, 2004, 13:45:31
Is there a script so a normal user can write "!opreport " in the main chat and then all online OPs will get the message...?

Thanks...
Title:
Post by: nErBoS on 08 February, 2004, 15:51:53
Hi,

--- Requested by Smulf ----
--- Made by nErBoS ------

Bot = "OPReport"

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=="!opreport") 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 mensage has been send to all Ops online.")
elseif (msg == nill) then
user:SendPM(Bot, "You must write a msg, !OPreport ")
end
end

Hope it helps you.

Best regards, nErBoS
Title: Thx
Post by: Smulf on 08 February, 2004, 19:28:00
Thanks alot nErBoS... Just what I wanted ;)  Thanks for your time...