something simple
 

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

something simple

Started by XPMAN, 17 January, 2004, 17:42:26

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

XPMAN

I have tried myself...(newbie).... I was needing a simple script with the +slap command.

for example  +slap

would like for it not appear in the userlist as a bot either.

No rush on this, just something i would like some help with. I know its in some of the packaged chat progies.


kepp

#1
Bot = "Slapper"

function DataArrival(curUser, data)
   if strsub(data,1,1) == "<" then
   data=strsub(data,1,strlen(data)-1)
   s,e,cmd,arg = strfind(data,"%b<>%s+(%S+)%s+(.*)")
   
      if cmd=="+slap" then
         SendToAll(Bot, curUser.sName.." slaps "..arg.." with a fresh herring") return 1
       end
    end
end

Hope this help
Guarding    

XPMAN

Thnx....just what i was looking for.   :))

pHaTTy

dont forget you can use randomization as well ;)

Bot = "Slapper"

prefix = "!"
command = "slap"

function DataArrival(curUser, data)
	if strsub(data,1,1) == "<" then
		data=strsub(data,1,strlen(data)-1)
		s,e,cmd,arg = strfind(data,"%b<>%s+(%S+)%s+(.*)")
   
		if cmd == prefix..command then
			local spin = random(4) --//how many will be random in spin
			if spin == 1 then
				SendToAll(Bot, curUser.sName.." slaps "..arg.." with a fresh herring") return 1
			elseif spin == 2 then
				SendToAll(Bot, curUser.sName.." slaps "..arg.." with a razar blade") return 1
			elseif spin == 3 then
				SendToAll(Bot, curUser.sName.." slaps "..arg.." with a strawberry jam jar :p") return 1
			else
				SendToAll(Bot, curUser.sName.." wips "..arg.." ass") return 1
			end
		end
	end
end
Resistance is futile!

pHaTTy

you also will want to do checks otherwise slapping will be unreal, youlll be only slappung text ;)

ie !slap him will say

phatty slapped him

so you need to check

Bot = "Slapper"

prefix = "+"
command = "slap"

function DataArrival(slapped, dstring)
	if strsub(dstring,1,1) == "<" then
		dstring=strsub(dstring,1,strlen(dstring)-1)
		s,e,cmd,arg = strfind(dstring,"%b<>%s+(%S+)%s+(%S+)") --// no need to find more words after it
   
		if cmd == prefix..command then
			if arg == nil then
				user:SendData(Bot,"Please enter nick of who you want to slap")
				
			else
				if GetItemByName(arg) then
					local spin = random(4) --//how many will be random in spin
					if spin == 1 then
						SendToAll(Bot, slapped.sName.." slaps "..arg.." with a fresh herring") return 1
					elseif spin == 2 then
						SendToAll(Bot, slapped.sName.." slaps "..arg.." with a razar blade") return 1
					elseif spin == 3 then
						SendToAll(Bot, slapped.sName.." slaps "..arg.." with a strawberry jam jar :p") return 1
					else
						SendToAll(Bot, slapped.sName.." wips "..arg.." ass") return 1
					end
				else
					user:SendData(Bot,"This user does not exist")
				end
			end
		end
	end
end
Resistance is futile!

XPMAN

Very nice indeed.........Thank u very much.

SMF spam blocked by CleanTalk