--------------------------------------------- -- -- -- -- -- "The One Armed Bandit" -- -- Created by: FlipDeluXe -- -- Date: May 10 2003 -- -- -- -- -- --------------------------------------------- botName="Bandit" wins="bandit_wins.txt" plays="bandit_plays.txt" A=5 credit=0 player="foo" function Main() OnOrOff="off" end function DataArrival(user, data) if( strsub(data, 1, 1) == "<" ) then -- remove end pipe data=strsub(data,1,strlen(data)-1) -- parse the command s,e,cmd = strfind( data, "%b<>%s+(%S+)" ) if (cmd=="!insert") and (OnOrOff=="off") then OnOrOff="on" A=3 player=user.sName SendToAll(botName, "Yeah!! "..player.." just threw in a buck!") SendToAll(botName, "started. Pull with >> !hit << in Main Chat!") SendToAll("credits left:",A) elseif (cmd=="!hit") and A == 0 then OnOrOff="off" SendToAll(botName, "Outta credits, insert coin.") elseif (cmd=="!hit") and (OnOrOff=="off") then SendToAll(botName, "Outta credits, insert coin!") elseif (cmd=="!hit") and (OnOrOff=="on") and (player~=user.sName) then SendToAll(botName, "Sorry "..user.sName.." you must wait until "..player.." is done with his round.") elseif (cmd=="!hit") and (OnOrOff=="on") and (player==user.sName) then local first=random(1,8) local second=random(1,8) local third=random(1,8) local rollone="@" local rolltwo="@" local rollthree="@" A=A-1 SendToAll("credits left:",A) if first == 1 and second == 1 and third == 1 then SendToAll(botName, "Cool " ..user.sName.. ", you just won 10 bucks!") credit=credit+10 elseif first == 2 and second == 2 and third == 2 then SendToAll(botName, "Great!! " ..user.sName.." 20 bucks for you!") credit=credit+20 elseif first == 3 and second == 3 and third == 3 then SendToAll(botName, user.sName..", just won 30 bucks...") credit=credit+30 elseif first == 4 and second == 4 and third == 4 then SendToAll(botName, "Wow! "..user.sName.." it must be your lucky day, 40 bucks!!") credit=credit+40 elseif first == 5 and second == 5 and third == 5 then SendToAll(botName, "yeah!! " ..user.sName.." cha-ching 50 bucks!!!") credit=credit+50 elseif first == 6 and second == 6 and third == 6 then SendToAll(botName, "Woohoo!! " ..user.sName.." You're on a winning spree!! 70 bucks!!!") credit=credit+70 elseif first == 7 and second == 7 and third == 7 then SendToAll(botName, "Wow, you won 90 bucks " ..user.sName.."!!") credit=credit+90 elseif first == 8 and second == 8 and third == 8 then SendToAll(botName, "Awesome!! " ..user.sName.." You just hit the jackpot! cha-ching 100 bucks!!!") credit=credit+100 elseif first == 1 and second == 1 and third ~= 1 then SendToAll(botName, "Great!! " ..user.sName.." a buck for you!") credit=credit+1 elseif first == 2 and second == 2 and third ~= 2 then SendToAll(botName, "Great!! " ..user.sName.." a buck for you!") credit=credit+1 elseif first == 3 and second == 3 and third ~= 3 then SendToAll(botName, "Great!! " ..user.sName.." a buck for you!") credit=credit+1 elseif first == 4 and second == 4 and third ~= 4 then SendToAll(botName, "Great!! " ..user.sName.." a buck for you!") credit=credit+1 elseif first == 5 and second == 5 and third ~= 5 then SendToAll(botName, "Great!! " ..user.sName.." a buck for you!") credit=credit+1 elseif first == 6 and second == 6 and third ~= 6 then SendToAll(botName, "Great!! " ..user.sName.." a buck for you!") credit=credit+1 elseif first == 7 and second == 7 and third ~= 7 then SendToAll(botName, "Great!! " ..user.sName.." a buck for you!") credit=credit+1 elseif first == 8 and second == 8 and third ~= 8 then SendToAll(botName, "Great!! " ..user.sName.." a buck for you!") credit=credit+1 elseif first ~= 1 and second == 1 and third == 1 then SendToAll(botName, "Great!! " ..user.sName.." a buck for you!") credit=credit+1 elseif first ~= 2 and second == 2 and third == 2 then SendToAll(botName, "Great!! " ..user.sName.." a buck for you!") credit=credit+1 elseif first ~= 3 and second == 3 and third == 3 then SendToAll(botName, "Great!! " ..user.sName.." a buck for you!") credit=credit+1 elseif first ~= 4 and second == 4 and third == 4 then SendToAll(botName, "Great!! " ..user.sName.." a buck for you!") credit=credit+1 elseif first ~= 5 and second == 5 and third == 5 then SendToAll(botName, "Great!! " ..user.sName.." a buck for you!") credit=credit+1 elseif first ~= 6 and second == 6 and third == 6 then SendToAll(botName, "Great!! " ..user.sName.." a buck for you!") credit=credit+1 elseif first ~= 7 and second == 7 and third == 7 then SendToAll(botName, "Great!! " ..user.sName.." a buck for you!") credit=credit+1 elseif first ~= 8 and second == 8 and third == 8 then SendToAll(botName, "Great!! " ..user.sName.." a buck for you!") credit=credit+1 elseif first == 1 and second ~= 1 and third == 1 then SendToAll(botName, "Great!! " ..user.sName.." a buck for you!") credit=credit+1 elseif first == 2 and second ~= 2 and third == 2 then SendToAll(botName, "Great!! " ..user.sName.." a buck for you!") credit=credit+1 elseif first == 3 and second ~= 3 and third == 3 then SendToAll(botName, "Great!! " ..user.sName.." a buck for you!") credit=credit+1 elseif first == 4 and second ~= 4 and third == 4 then SendToAll(botName, "Great!! " ..user.sName.." a buck for you!") credit=credit+1 elseif first == 5 and second ~= 5 and third == 5 then SendToAll(botName, "Great!! " ..user.sName.." a buck for you!") credit=credit+1 elseif first == 6 and second ~= 6 and third == 6 then SendToAll(botName, "Great!! " ..user.sName.." a buck for you!") credit=credit+1 elseif first == 7 and second ~= 7 and third == 7 then SendToAll(botName, "Great!! " ..user.sName.." a buck for you!") credit=credit+1 elseif first == 8 and second ~= 8 and third == 8 then SendToAll(botName, "Great!! " ..user.sName.." a buck for you!") credit=credit+1 elseif first ~= second and first ~= third then SendToAll(botName,"Ahhh, too bad "..user.sName.." you won nothing...") end if first == 1 then rollone="@" elseif first == 2 then rollone="$" elseif first == 3 then rollone="#" elseif first == 4 then rollone="&" elseif first == 5 then rollone="B" elseif first == 6 then rollone="O" elseif first == 7 then rollone="%" elseif first == 8 then rollone="€" end if second == 1 then rolltwo="@" elseif second == 2 then rolltwo="$" elseif second == 3 then rolltwo="#" elseif second == 4 then rolltwo="&" elseif second == 5 then rolltwo="B" elseif second == 6 then rolltwo="O" elseif second == 7 then rolltwo="%" elseif second == 8 then rolltwo="€" end if third == 1 then rollthree="@" elseif third == 2 then rollthree="$" elseif third == 3 then rollthree="#" elseif third == 4 then rollthree="&" elseif third == 5 then rollthree="B" elseif third == 6 then rollthree="O" elseif third == 7 then rollthree="%" elseif third == 8 then rollthree="€" end SendToAll(" ----------------------------------") SendToAll(" One-Armed-Bandit \r\n") SendToAll(" >>>> "..rollone.." - "..rolltwo.." - "..rollthree.." <<<< \r") --SendToAll(" "..first.." "..second.." "..third.." \r\n") SendToAll(" ----------------------------------") if A == 0 then OnOrOff="off" SendToAll(botName, "Outta credits, insert coin.") end if (credit~=0) and (OnOrOff=="off") then appendto(wins) write("\t"," "..user.sName.." won "..credit.." Bucks \r\n") writeto() credit=0 end if (A==0) and (OnOrOff=="off") then appendto(plays) write("",""..player.." \r\n") writeto() end end end end