elseif (cmd=="+ban") or (cmd=="?ban") then
s,e,cmd,Name,reason = strfind(data,"%b<>%s+(%S+)%s+(%S+)%s*(.*)")
rsn = reason
if victim ~= nil then
SendToAll(BotName, user.sName.." banned "..victim.sName..", Reason: "..rsn)
victim:SendPM(BotName, "You are banned by: "..user.sName..", Reason: "..rsn)
victim:Ban() return 1
else
user:SendData("*** User is not in the list.") return 1 end
I want to protect OP's in this code from being banned...
Questions is: How would i do that...?
I've tried the same way as i did with if the user dosen't exist, but that will just block other things or nothing will happen at all.
Thanks
Try this:
elseif (cmd=="+ban") or (cmd=="?ban") then
s,e,cmd,Name,reason = strfind(data,"%b<>%s+(%S+)%s+(%S+)%s*(.*)")
rsn = reason
if victim~=nil then
if victim.bOperator then
user:SendData("*** You can't ban a OP")
victim:SendData("*** User "..user.sName.." has tried to ban you!!!")
return 1
else
SendToAll(BotName, user.sName.." banned "..victim.sName..", Reason: "..rsn)
victim:SendPM(BotName, "You are banned by: "..user.sName..", Reason: "..rsn)
victim:Ban() return 1
end
else
user:SendData("*** User is not in the list.") return 1
end
Thanks alot Neo!!
elseif (cmd=="?addmaster") or (cmd=="!addmaster") or (cmd=="+addmaster") then
s,e,cmd,newuser,pass = strfind(data,"%b<>%s+(%S+)%s+(%S+)%s+(.+)")
ProFile = GetProfileName(0)
AddRegUser(newuser, pass, 0)
user:SendData(BotName, newuser.." Was sucessfully added as a "..ProFile) return 1
How would i do to send a pm to the user that i added?
I tried, and it worked, Untill i tried with a user that was not there, And it gave me a nil value
write this: (it's very simple)
SendPmToNick(newuser,BotName,"HERE MESSAGE")
where
newuser is the variable that you have spicified here :"s,e,cmd,newuser,pass = strfind(data,"%b<>%s+(%S+)%s+(%S+)%s+(.+)")"
BotName is your bot
"HERE MESSAGE" is the message you would send to.
Then syntax is :
SendPmToNick(whoto,from,mex)
Check scripting.txt in doc folder of ptokax...
Byez!!!
he he, Ok :)
Thanks alot!
I tried with:
newuser:SendPM(BotName, "Bla bla bla")
But SendPmToNick solved the problem! :D