PtokaX forum

Archive => Archived 5.0 boards => Finished Scripts => Topic started by: plop on 28 February, 2005, 17:48:29

Title: simpsons
Post by: plop on 28 February, 2005, 17:48:29
-- PtokaX Lua 5 version by PPK

--Script temporarily gives to users a strange nick :)
--2 options (fixed and random nicks, always for the current session); stopping command clean the memory

--Commands:
--  !simpsons on -- Let's start the random simpsons' nick party!
--  !simpsons off -- Stop the parties

anim=0

cnames = {
"Homer",
"Marge",
"Bart",
"Lisa",
"Maggie",
"patty",
"grandpa",
"Selma",
"Mr Burns",
"Smithers",
"Barney",
"Moe",
"Ned Flanders",
"Maude flanders",
"Todd flanders",
"Rod flanders",
"Apu",
"Chief Wiggum",
"Dr. Hibbert",
"Krusty the clown",
"Sideshow Bob",
"Sideshow Mel",
"Otto",
"Willie",
}

unique = {}

function ChatArrival(curUser, message)
s,e,cmd= string.find(message,"%b<>%s+(%S+)")
if anim==1 then
if unique[curUser.sName]==nil then
unique[curUser.sName]=cnames[math.random(1, table.getn(cnames))]
end
end

if curUser.bOperator ~= nil then
s,e,cmd,status= string.find(message,"%b<>%s(.+)%s(.+)")
if (cmd == "!simpsons") then
if string.find(status, "on") then
SendToAll(" The Simpsoooooooooooooooooons.")
anim=1
elseif string.find(status, "off") then
SendToAll(" Shut up, Simpsons!")
unique[curUser.sName]=nil
anim=0
end
return 1
end
end

if anim==1 then
s,e,mes = string.find(message, "%b<> (.*)")
if unique[curUser.sName]~=nil then
SendToAll(unique[curUser.sName], mes)
return 1
end
end
end

plop