Modify please
 

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

Modify please

Started by frankyk, 20 April, 2004, 07:09:02

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

frankyk

BOTNAME = "Channel Bot"

userSlaps = {
	"[USER] does not have the privilege to bitch slap.",
	"[USER] can't slap, only OPs can, BIATCH!",
	"Only ops can slap",
	"Jitters slaps [USER] upside the head, you can't slap silly!",
	"[USER] tries to slap [ARG], but misses.",
	"[USER] slaps himself/herself."
}

opsSlaps = {
	"USER slaps ARG across the face (temporary ban), because: REASON",
	"ARG got bitch slapped by USER for: REASON (temporary ban)"
}

function DataArrival(user, data) 
	
	data=strsub(data,1,strlen(data)-1) 

	s,e,cmd = strfind(data,"%b<>%s+(%S+)") 

	if (cmd=="+slap") then 

		if (user.iProfile) == 3 then
			index = random(1,getn(userSlaps))
			message, x = gsub(userSlaps[index], "%b[]", user.sName)
			SendToAll(BOTNAME, message)
			return 1
		end

		--s,e,cmd,arg, reason = strfind(data,"%b<>%s+(%S+)%s+(%S+)%s+(%S)") 
		s,e,cmd,arg,reason = strfind( data, "%b<>%s+(%S+)%s+(%S+)%s+(.+)" )
		if(arg==nil) then
			user:SendData("Usage Error. +slap  ")
			return 1
		end

		targetUser=GetItemByName(arg)

		if(targetUser==nil) then
			user:SendData(BOTNAME, "User is not in this dimension")
			return 1
		end

		if(targetUser.sName == user.sName) then
			SendToAll(""..user.sName.." slaps himself/herself")
			return 1
		end

		index = random(1,getn(opsSlaps))
		message, x = gsub(opsSlaps[index], "USER", user.sName)
		message, x = gsub(message, "ARG", arg)
		message, x = gsub(message, "REASON", reason)
		SendToAll(BOTNAME, message)
--		SendToAll(BOTNAME, ""..user.sName.." slaps "..arg.." across the face (temporary ban), because: "..reason.."")
		
		targetUser:TimeBan(120)
		return 1
	end

end

Can someone make it that a VIP can not slap someone above them?  Like, VIP can't slap Op/Master, and Op can't slap Master.

nErBoS

Hi,

Done, and also made some mod in the code, was a little deorganized in my opinion...

--Mod by nErBoS

BOTNAME = "Channel Bot"

userSlaps = {
	"[USER] does not have the privilege to bitch slap.",
	"[USER] can't slap, only OPs can, BIATCH!",
	"Only ops can slap",
	"Jitters slaps [USER] upside the head, you can't slap silly!",
	"[USER] tries to slap [ARG], but misses.",
	"[USER] slaps himself/herself."
}

opsSlaps = {
	"USER slaps ARG across the face (temporary ban), because: REASON",
	"ARG got bitch slapped by USER for: REASON (temporary ban)"
}

function DataArrival(user, data) 
	if (strsub(data,1,1) == "<") then	
		data=strsub(data,1,strlen(data)-1) 
		s,e,cmd = strfind(data,"%b<>%s+(%S+)") 
		if (cmd=="+slap") then
			s,e,arg,reason = strfind( data, "%b<>%s+%S+%s+(%S+)%s+(.+)" )
			if(arg == nil) then
				user:SendData("Usage Error. +slap  ")
			else
				targetUser=GetItemByName(arg)
				if(targetUser == nil) then
					user:SendData(BOTNAME, "User is not in this dimension")
				else
					if(targetUser.sName == user.sName) then
						SendToAll(""..user.sName.." slaps himself/herself")
					elseif(user.iProfile > targetUser.iProfile) then
						user:SendData(BOTNAME, "You don?t have Autorathy to slap this user.")
					elseif (user.iProfile == 3 or user.iProfile == 2) then
						index = random(1,getn(userSlaps))
						message, x = gsub(userSlaps[index], "%b[]", user.sName)
						SendToAll(BOTNAME, message)
					elseif (user.bOperator) then
						index = random(1,getn(opsSlaps))
						message, x = gsub(opsSlaps[index], "USER", user.sName)
						message, x = gsub(message, "ARG", arg)
						message, x = gsub(message, "REASON", reason)
						SendToAll(BOTNAME, message)
--						SendToAll(BOTNAME, ""..user.sName.." slaps "..arg.." across the face (temporary ban), because: "..reason.."")
						targetUser:TimeBan(120)
					end
				end 
			end
			return 1
		end
	end
end

Best regards, nErBoS
--## nErBoS Spot ##--

SMF spam blocked by CleanTalk