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.
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
Thnx....just what i was looking for. :))
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
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
Very nice indeed.........Thank u very much.