Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAfkDeath(true)
- tfm.exec.disableAutoShaman(true)
- admins={"Mousetat", "Reshman", "Merrennor"}
- keys={32,72,75,74}
- tfm.exec.newGame('<C><P D="x_transformice/x_evt/x_evt_10/YIKDFERT/Fond.jpg" d="x_transformice/x_evt/x_evt_10/YIKDFERT/OL_AnvilGod.png" Ca="" /><Z><S><S P="0,0,0.3,0.2,0,0,0,0" i="0,0,x_transformice/x_evt/x_evt_10/YIKDFERT/PLTFRM_AnvilGod.png" L="50" o="324650" X="25" c="4" Y="114" T="12" H="50" /><S P="0,0,0.3,0.2,-1,0,0,0" L="281" o="324650" H="22" Y="208" T="12" m="" X="141" /><S L="300" o="324650" H="22" X="150" Y="375" T="12" m="" P="0,0,0.3,0.2,-0,0,0,0" /><S P="0,0,0.3,0.2,-10,0,0,0" L="90" o="324650" X="304" Y="362" T="12" m="" H="22" /><S P="0,0,0.3,0.2,-0,0,0,0" L="150" o="324650" X="421" Y="377" T="12" m="" H="40" /><S L="120" o="324650" X="415" H="100" Y="345" T="12" m="" P="0,0,0.3,0,0,0,0,0" /><S L="281" o="324650" H="22" X="141" Y="103" T="12" m="" P="0,0,0.3,0.2,-0,0,0,0" /><S L="18" X="-10" H="399" Y="201" T="1" P="0,0,0,0.2,0,0,0,0" /><S L="18" H="399" X="810" Y="201" T="1" P="0,0,0,0.2,0,0,0,0" /><S L="18" H="900" X="394" Y="-9" T="1" P="0,0,0,0.2,90,0,0,0" /><S i="0,0,x_transformice/x_evt/x_evt_10/YIKDFERT/PLTFRM_offrande.png" L="50" o="324650" H="50" c="4" N="" Y="25" T="12" X="25" P="0,0,0.3,0.2,0,0,0,0" /><S L="30" o="324650" X="497" H="10" Y="265" T="12" m="" P="0,0,0.3,0.2,200,0,0,0" /><S P="0,0,0.3,0.2,110,0,0,0" L="50" o="324650" H="10" Y="338" T="12" m="" X="507" /><S P="0,0,20,0.2,80,0,0,0" L="50" o="324650" H="10" Y="291" T="12" m="" X="511" /><S L="30" o="324650" H="10" X="480" Y="153" T="12" m="" P="0,0,0.3,0.2,0,0,0,0" /><S P="0,0,0.3,0.2,-40,0,0,0" L="30" o="324650" X="489" Y="150" T="12" m="" H="10" /><S P="0,0,0,0.2,0,0,0,0" L="10" o="" X="359" Y="233" T="12" H="500" /><S P="0,0,,,,0,0,0" L="76" X="317" Y="186" T="9" m="" H="374" /><S P="0,0,0.3,0.2,0,0,0,0" L="100" o="" X="415" Y="260" T="12" H="10" /><S P="0,0,0.3,0.2,0,0,0,0" L="30" o="" X="410" Y="280" T="12" H="30" /><S P="0,0,0.3,0.2,0,0,0,0" L="10" o="" X="460" Y="283" T="12" H="44" /></S><D><DS Y="343" X="55" /></D><O /></Z></C>')
- p={}
- players={}
- player1=""
- player2=""
- spstimes=5
- ui.addTextArea(3,"<font size='25' color='#ffffff'> H:</font",nil,680,130,50,50,nil,nil,0,true)
- ui.addTextArea(2,"<font size='25' color='#ffffff'> J:</font",nil,680,185,50,50,nil,nil,0,true)
- ui.addTextArea(1,"<font size='25' color='#ffffff'> K:</font",nil,680,245,50,50,nil,nil,0,true)
- noid=tfm.exec.addImage("153f8d06d84.jpg", "&1", 735, 130)
- tfm.exec.addImage("153f8d05236.jpg", "&3", 735, 185)
- tfm.exec.addImage("153f8d00af1.jpg", "&2", 735, 245)
- function eventPlayerDied(name)
- tfm.exec.respawnPlayer(name)
- end
- function eventPlayerLeft(playerName)
- for i=#players, 1, -1 do
- table.remove(players)
- end
- for name, player in pairs(tfm.get.room.playerList) do
- table.insert(players, name)
- end
- if playerName==player1 or playerName==player2 then
- randomplayer()
- end
- end
- function eventNewPlayer(name)
- print(name)
- tfm.exec.respawnPlayer(name)
- p[name]={chosen1=false, chosen2=false, sps=0, ready1=false, ready2=false, id=99999999999, admin=false}
- table.insert(players, name)
- for i=#keys,1,-1 do
- tfm.exec.bindKeyboard(name,keys[i],true,true)
- end
- tfm.exec.chatMessage("<font color='#2ECF73'>Welcome to the game of SPS!</font>",name)
- tfm.exec.chatMessage("<font color='#2ECF73'>Press SPACE to throw scissors, paper or stone randomly. Alternatively, press H for stone, J for scissors, K for paper</font>",name)
- tfm.exec.chatMessage("<font color='#2ECF73'>The first to reach "..spstimes.." scores wins!</font>",name)
- tfm.exec.chatMessage("<font color='#2ECF73'>Type !help to see this again, and !mods to see the list of mods in this room.</font>",name)
- local count=0
- while count<=#admins do
- count=count+1
- if name==admins[count] then
- p[name].admin=true
- tfm.exec.chatMessage("<font color='#FEB1FC'>You are an admin, type !c (new score) to change the score that a player must attain to win, and !t (message) to say something, !skip to skip someone's turn.</font>",name)
- end
- end
- tfm.exec.chatMessage("<font color='#ffffff'>The current players competing are: "..player1.." versus "..player2.."</font>",name)
- end
- tfm.exec.chatMessage("<font color='#2ECF73'>Welcome to the game of SPS!</font>")
- tfm.exec.chatMessage("<font color='#2ECF73'>Press SPACE to throw scissors, paper or stone randomly. Alternatively, press H for stone, J for scissors, K for paper</font>")
- tfm.exec.chatMessage("<font color='#2ECF73'>The first to reach "..spstimes.." scores wins!</font>")
- tfm.exec.chatMessage("<font color='#2ECF73'>Type !help to see this again, and !mods to see the list of mods in this room.</font>")
- for name,player in pairs(tfm.get.room.playerList) do
- p[name]={chosen1=false, chosen2=false, sps=0, ready1=false, ready2=false, id=9999999999999, admin=false}
- tfm.exec.setPlayerScore(name,0,false)
- table.insert(players, name)
- for i=#keys,1,-1 do
- tfm.exec.bindKeyboard(name,keys[i],true,true)
- end
- local count=0
- while count<=#admins do
- count=count+1
- if name==admins[count] then
- p[name].admin=true
- end
- end
- if p[name].admin==true then
- tfm.exec.chatMessage("<font color='#FEB1FC'>You are an admin, type !c (new score) to change the score that a player must attain to win, and !t (message) to say something, !skip to skip someone's turn.</font>",name)
- end
- end
- space=true
- bufferr=false
- function eventRPS(random3,random4)
- ui.updateTextArea(69, "<font size='30' color='#ffffff'> "..p[player1].sps.." : "..p[player2].sps.."</font>", nil)
- if os.time()<timestamp+2000 then
- space=false
- tfm.exec.playEmote(player1,27,nil)
- tfm.exec.playEmote(player2,27,nil)
- elseif os.time()>timestamp+3000 and os.time()<timestamp+4000 then
- space=true
- if random3==1 then
- p[player1].id=tfm.exec.addImage("153f8d06d84.jpg","$"..player1,-25,-80) --stone
- elseif random3==2 then
- p[player1].id=tfm.exec.addImage("153f8d05236.jpg","$"..player1,-25,-80) --scissors
- elseif random3==3 then
- p[player1].id=tfm.exec.addImage("153f8d00af1.jpg","$"..player1,-25,-80) --paper
- end
- if random4==1 then
- p[player2].id=tfm.exec.addImage("153f8d06d84.jpg","$"..player2,-25,-80) --stone
- elseif random4==2 then
- p[player2].id=tfm.exec.addImage("153f8d05236.jpg","$"..player2,-25,-80) --scissors
- elseif random4==3 then
- p[player2].id=tfm.exec.addImage("153f8d00af1.jpg","$"..player2,-25,-80) --paper
- end
- if (random3%3)+1==random4 then
- p[player1].sps=p[player1].sps +1
- tfm.exec.setPlayerScore(player1,1,true)
- elseif (random4%3)+1==random3 then
- p[player2].sps=p[player2].sps +1
- tfm.exec.setPlayerScore(player2,1,true)
- end
- if p[player1].sps<spstimes and p[player2].sps<spstimes then
- p[player1].ready1=false
- p[player2].ready2=false
- ui.updateTextArea(69, "<font size='30' color='#ffffff'> "..p[player1].sps.." : "..p[player2].sps.."</font>", nil)
- elseif p[player1].sps==spstimes then
- p[player1].sps=p[player1].sps
- ui.updateTextArea(69,"<font size='15' color='#ffffff'>"..player1.." won!")
- tfm.exec.chatMessage("<font color='#BABD2F'>"..player1.." won! Restarting game...</font>")
- space=false
- bufferr=true
- p[player1].ready1=false
- p[player2].ready2=false
- ui.updateTextArea(69, "<font size='30' color='#ffffff'> "..p[player1].sps.." : "..p[player2].sps.."</font>", nil)
- elseif p[player2].sps==spstimes then
- p[player2].sps=p[player2].sps
- ui.updateTextArea(69,"<font size='15' color='#ffffff'>"..player2.." won!")
- tfm.exec.chatMessage("<font color='#BABD2F'>"..player2.." won! Restarting game...</font>")
- space=false
- bufferr=true
- p[player1].ready1=false
- p[player2].ready2=false
- ui.updateTextArea(69, "<font size='30' color='#ffffff'> "..p[player1].sps.." : "..p[player2].sps.."</font>", nil)
- end
- ui.removeTextArea(30, nil)
- ui.removeTextArea(31, nil)
- end
- end
- randomplayering=0
- function buffer()
- if os.time()>timestamp+8000 then
- tfm.exec.removeImage(p[player1].id)
- tfm.exec.removeImage(p[player2].id)
- randomplayer()
- bufferr=false
- end
- end
- function randomplayer()
- space=true
- ui.updateTextArea(69, "<font size='30' color='#FFFFFF'>Ready?</font>", nil)
- randomplayering=randomplayering+1
- for name, player in pairs(tfm.get.room.playerList) do
- p[name].sps=0
- tfm.exec.movePlayer(name,55,343,false,0,50,false)
- end
- if randomplayering==#players then
- for name, player in pairs(tfm.get.room.playerList) do
- p[name]={chosen1=false, chosen2=false, sps=0, ready1=false, ready2=false}
- randomplayering=0
- end
- end
- local random1=math.random(1,#players)
- player1=players[random1]
- while p[player1].chosen1==true do
- random1=math.random(1,#players)
- player1=players[random1]
- end
- player2=player1
- local random2=math.random(1,#players)
- while player1==player2 do
- player2=players[random2]
- random2=math.random(1,#players)
- end
- p[player1].chosen1=true
- p[player2].chosen2=true
- tfm.exec.movePlayer(player1,380,279,false,0,50,false)
- tfm.exec.movePlayer(player2,440,279,false,0,50,false)
- for name, player in pairs(tfm.get.room.playerList) do
- tfm.exec.removeImage(p[name].id)
- local count=0
- while count<=#admins do
- count=count+1
- if name==admins[count] then
- p[name].admin=true
- end
- end
- end
- tfm.exec.chatMessage("<font color='#ffffff'>The current players competing are: "..player1.." versus "..player2.."</font>")
- end
- randomplayer()
- ui.addTextArea(69, "<font size='30' color='#FFFFFF'>Ready?</font>", nil, 360, 310, 120, 50, nil, nil, 0.8, true)
- timestamp=0
- choose1=0
- choose2=0
- function eventKeyboard(name, key, down, x, y)
- if space==true then
- if name==player1 and tfm.get.room.playerList[name].isFacingRight then
- p[name].ready1=true
- ui.addTextArea(30, "<font size='10' color='#FFFFFF'>I'm ready</font>", nil, 345, 200, 60, 20, nil, nil, 0.8, true)
- timestamp=os.time()
- tfm.exec.removeImage(p[player1].id)
- if key==32 then
- choose1=math.random(1,3)
- elseif key==72 then
- choose1=1
- elseif key==74 then
- choose1=2
- elseif key==75 then
- choose1=3
- end
- elseif name==player2 and not tfm.get.room.playerList[name].isFacingRight then
- p[name].ready2=true
- ui.addTextArea(31, "<font size='10' color='#FFFFFF'>I'm ready</font>", nil, 415, 200, 60, 20, nil, nil, 0.8, true)
- timestamp=os.time()
- tfm.exec.removeImage(p[player2].id)
- if key==32 then
- choose2=math.random(1,3)
- elseif key==72 then
- choose2=1
- elseif key==74 then
- choose2=2
- elseif key==75 then
- choose2=3
- end
- else
- tfm.exec.chatMessage("You have to face your opponent and press space.",name)
- end
- end
- end
- function eventLoop(time,remaining)
- if bufferr==true then
- buffer()
- end
- if #players==1 then
- tfm.exec.chatMessage("1 person cannot play this game. Exiting game...",nil)
- system.exit()
- end
- if p[player1].ready1==true and p[player2].ready2==true then
- eventRPS(choose1,choose2)
- end
- end
- system.disableChatCommandDisplay("t",true)
- system.disableChatCommandDisplay("c",true)
- system.disableChatCommandDisplay("admin",true)
- function eventChatCommand(name, message)
- if string.sub(message,0,1)=="c" and p[name].admin==true then
- spstimes=tonumber(string.sub(message,3))
- tfm.exec.chatMessage("<font color='#C53DFF'>[~SPS Moderation] The score to be attained to win has been changed to "..spstimes.." scores.</font>")
- elseif string.sub(message,0,1)=="t" and p[name].admin==true then
- tfm.exec.chatMessage("<font color='#C53DFF'>[~SPS Moderation] "..string.sub(message,3).."</font>")
- elseif string.sub(message,0,5)=="admin" and p[name].admin==true then
- for name, player in pairs(tfm.get.room.playerList) do
- if name==string.sub(message,7) then
- tfm.exec.chatMessage("<font color='#C53DFF'>[~SPS Moderation] "..name.." is now an SPS moderator! Congrats!.</font>")
- p[name].admin=true
- end
- end
- elseif message=="mods" then
- local mnm=""
- for name, player in pairs(tfm.get.room.playerList) do
- if p[name].admin==true then
- mnm=mnm..name..", "
- end
- end
- mnm=string.sub(mnm,0,string.len(mnm)-2)
- tfm.exec.chatMessage("The SPS Moderators are: "..mnm..".",name)
- elseif message=="skip" then
- randomplayer()
- ui.removeTextArea(30)
- ui.removeTextArea(31)
- elseif message=="help" then
- tfm.exec.chatMessage("<font color='#2ECF73'>Press SPACE to throw scissors, paper or stone randomly. Alternatively, press H for stone, J for scissors, K for paper</font>",name)
- tfm.exec.chatMessage("<font color='#2ECF73'>The first to reach "..spstimes.." scores wins!</font>",name)
- tfm.exec.chatMessage("<font color='#2ECF73'>Type !help to see this again, and !mods to see the list of mods in this room.</font>", name)
- if p[name].admin==true then
- tfm.exec.chatMessage("<font color='#FEB1FC'>You are an admin, type !c (new score) to change the score that a player must attain to win, and !t (message) to say something, !skip to skip someone's turn.</font>",name)
- end
- elseif message=="players" then
- for i=#players, 1, -1 do
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment