Protect my op's
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Protect my op's

Started by kepp, 09 November, 2003, 19:51:13

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

kepp

      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
Guarding    

Neo

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
(Sorry for my bad english!!)

-->ITA The Matrix Hub<--
->maxstorm.no-ip.com<-

kepp

Thanks alot Neo!!
Guarding    

kepp

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
Guarding    

Neo

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!!!
(Sorry for my bad english!!)

-->ITA The Matrix Hub<--
->maxstorm.no-ip.com<-

kepp

he he, Ok :)

Thanks alot!

I tried with:
newuser:SendPM(BotName, "Bla bla bla")

But SendPmToNick solved the problem! :D
Guarding    

SMF spam blocked by CleanTalk