Guest User

Truth or Dare Game

a guest
Dec 21st, 2015
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 16.90 KB | None | 0 0
  1. admin="Mousetat"
  2.  
  3.  
  4.  
  5. tfm.exec.disableAutoNewGame(true)
  6. tfm.exec.disableAfkDeath(true)
  7. tfm.exec.disableAutoShaman(true)
  8. tfm.exec.disableAutoScore(true)
  9. tfm.exec.newGame("@6411544")
  10. -- stopped at line 144.
  11. players={}--respawn place is 400,320
  12. p={}
  13. timestamp=os.time()
  14. numplayers=0
  15.  
  16. begin=false
  17. answerer="lol"
  18. questioner="lol"
  19. question="lol"
  20. ans="lol"
  21. new=false
  22. restart=false
  23. choose=false
  24. start=true
  25. choosey=false
  26. skip=false
  27. message=""
  28.  
  29. truth={}--you can follow the format 'truth[number]="question"'
  30. truth[1]="Who is your crush in this game?"
  31. truth[2]="What is your favourite food?"
  32. truth[3]="Who is you model/favourite person in game?"
  33. truth[4]="What games do you play besides Transformice?"
  34. truth[5]="What would you like to be when you grow up?"
  35. truth[6]="Have you sucked your thumb before?"
  36. truth[7]="What brand of phone do you have currently?"
  37. truth[8]="Have you ever farted in front of your friends or teachers in real life?"
  38. truth[9]="If you could hack transformice, what would you do?"
  39. truth[10]="What is your favourite fur in Transformice if you have to choose?"
  40. truth[11]="Why do you like Transformice?"
  41. truth[12]="What do you dislike/hate most about yourself, whether in personality or physically?"
  42. truth[13]="What do you love most about yourself, whether in personality or physically?"
  43. truth[14]="Tell us whether you love yourself more or hate/dislike yourself more, and tell us why."
  44. truth[15]="Why do you like your current crush in real life, in personality terms AND physical terms? If you have no crush, then tell us why you hate the person you currently hate in real life, in personality terms."
  45.  
  46.  
  47. dare={}--you can follow the format 'dare[number]="Dare"'
  48. dare[1]="I dare you go into EN/EN2 room 2 and spam: I AM A GUMMY BEAR!I AM A GUMMY BEAR!I AM A GUMMY BEAR!"
  49. dare[2]="I dare you whisper a moderator a swear word."
  50. dare[3]="I dare you tell your crush, or anybody in this room that you love him/her right now"
  51. dare[4]="I dare you go into EN/EN2 room 1 and spam: www.sex.com www.sex.com www.sex.com www.sex.com www.sex.com www.sex.com"
  52. dare[5]="I dare you report a moderator for hacking"
  53. dare[6]="I dare you create an account similar to that of an online moderator and use that account to whisper to the online moderator: Hallo buddy!"
  54. dare[7]="I dare you tell your real life name to everybody in chat"
  55. dare[8]="I dare you take a picture of your real life face and send it to everyone to see."
  56. dare[9]="I dare you go into any #utility room with at least 5 people in it and crash the room."
  57. dare[10]="I dare you give me, the questioner, every ball you have in your inventory, if you have any."
  58. dare[11]="I dare you to disconnect and connect right now."
  59. dare[12]="I dare you to say who would be your most likely crush among the players in this room we are in."
  60. dare[13]="I dare you to waste all your selfies right now on yourself, if you have any balls to do it via trade"
  61.  
  62.  
  63. function eventNewPlayer(name)
  64. ui.addTextArea(1,"<b><p align = 'center'><font size='30'>Type !join to join the game.</font></p></b>",name,50,355,700,40,0x324650,0x212F36,0.8,true)
  65. p[name]={questioners=false, admin=false, spectator=true}
  66. end
  67.  
  68. function eventNewGame()
  69. ui.addTextArea(1,"<b><p align = 'center'><font size='30'>Welcome to Truth or Dare Game!</font></p></b>",nil,50,355,700,40,0x324650,0x212F36,0.8,true)
  70. ui.addPopup(999,0,"<p align = 'center'><font size='50' face='impact'>Truth or Dare</font></p><font size='30' color='#FF0000'><b>Rules</b></font>\nEvery game, everyone will have the chance to be the Asker. On the first popup as an asker, u can click 'Yes' to randomize a answerer, or 'No' to type a particular person in room. This is similar for almost all other popups, where 'Yes' is for random and 'No' is for typing out yourself. There are currently <b>10</b> random truths and <b>10</b> random dares, so if you have any feedback feel free to tell me, Mousetat.\n<b><font size='30' color='#FFFF00'>COMMANDS</font>\n!join to join the game if you are spectating or you just came into the room.\n!watch to be a spectator and get ignored in the game.\n!s to be shaman(although it is strongly not advised to do so)\n!respawn to respawn yourself.\n!admin <username> to admin a person(admins only)\n!c to speak to all(admins only)\n!restart to restart game if bugged(admins only)\n!skip to skip a person's turn(admins only)\n!help to see this popup again</b>",nil,100,20,600,true)
  71. answerer=""
  72. questioner=""
  73. begin=false
  74. start=true
  75. numplayers=0
  76. count=1
  77. for name,player in pairs(tfm.get.room.playerList) do
  78. p[name]={questioners=false, admin=false, spectator=true}
  79. players[count]=name
  80. timestamp=os.time()
  81. numplayers=numplayers+1
  82. count=count+1
  83. p[name].spectator=false
  84. p[name].questioners=false
  85. if name==admin then
  86. p[name].admin=true
  87. end
  88. end
  89. print(numplayers)
  90. system.disableChatCommandDisplay("c", hidden)
  91. system.disableChatCommandDisplay("admin", hidden)
  92. system.disableChatCommandDisplay("restart", hidden)
  93. end
  94.  
  95. function eventChatCommand(name,command)
  96. if command=="s" then
  97. tfm.exec.setShaman(name)
  98. elseif command=="join" and p[name].spectator==true then
  99. tfm.exec.respawnPlayer(name)
  100. tfm.exec.movePlayer(name,400,320,false,0,0,false)
  101. numplayers=numplayers+1
  102. players[numplayers]=name
  103. p[name].spectator=false
  104. elseif command=="skip" and p[name].admin==true then
  105. timestamp=os.time()
  106. skip=true
  107. elseif command:sub(0,1) == "c" and p[name].admin==true then
  108.     message=command:sub(3)
  109.     ui.updateTextArea(1, "<p align='center'><b><font size='15' color='#ED67EA'>[~Moderation] "..message.."</font></b></p>", nil)
  110. elseif command=="restart" and p[name].admin==true then
  111. tfm.exec.newGame("@6411544")
  112. elseif command=="watch" then
  113. p[name].spectator=true
  114. ui.updateTextArea(1, "<p align='center'><b><font size='30'>"..name.." is now a spectator :(</font></b></p>", nil)
  115. elseif command=="respawn" then
  116. tfm.exec.respawnPlayer(name)
  117. elseif command=="help" then
  118. ui.addPopup(999,0,"<p align = 'center'><font size='50' face='impact'>Truth or Dare</font></p><font size='30' color='#FF0000'><b>Rules</b></font>\nEvery game, everyone will have the chance to be the Asker. On the first popup as an asker, u can click 'Yes' to randomize a answerer, or 'No' to type a particular person in room. This is similar for almost all other popups, where 'Yes' is for random and 'No' is for typing out yourself. There are currently <b>10</b> random truths and <b>10</b> random dares, so if you have any feedback feel free to tell me, Mousetat.\n<b><font size='30' color='#FFFF00'>COMMANDS</font>\n!join to join the game if you are spectating or you just came into the room.\n!watch to be a spectator and get ignored in the game.\n!s to be shaman(although it is strongly not advised to do so)\n!respawn to respawn yourself.\n!admin <username> to admin a person(admins only)\n!c to speak to all(admins only)\n!restart to restart game if bugged(admins only)\n!skip to skip a person's turn(admins only)\n!help to see this popup again</b>",nil,100,20,600,true)
  119. elseif command:sub(0,5)=="admin" and p[name].admin==true then
  120. message=command:sub(7)
  121. message=string.upper(message:sub(0,1))..message:sub(2)
  122. for k,v in pairs(tfm.get.room.playerList) do
  123. if message==k then
  124. ui.updateTextArea(1, "<p align='center'><b><font size='15' color='#ED67EA'>[~Moderation] "..message.." is now a moderator. Congrats!</font></b></p>", nil)
  125. p[message].admin=true
  126. end
  127. end
  128. end
  129. end
  130.  
  131. function eventLoop(time,remaining)
  132. if timestamp < os.time()-10000 and begin==false then
  133. timestamp=os.time()
  134. begin=true
  135. restart=false
  136. ui.updateTextArea(1, "<p align='center'><b><font size='30'>Let's Begin the Game! </font></b></p>", nil)
  137. elseif timestamp < os.time()-5000 and begin==false then
  138. local i=1
  139. local long=""
  140. local hname=""
  141. while i<=numplayers do
  142. hname=players[i]
  143. if p[hname].spectator==false then
  144. long=long..tostring(players[i])..", "
  145. end
  146. i=i+1
  147. end
  148. ui.updateTextArea(1, "<p align='center'><b><font size='15'>The participating players are: "..string.sub(long,1,-3)..".</font></b></p>", nil)
  149. elseif timestamp < os.time()-3000 and begin==false and restart==true then
  150. ui.updateTextArea(1, "<p align='center'><b><font size='20'>Since everyone had their turn, I'll restart the game...", nil)
  151. end
  152. if begin==true then
  153. if timestamp < os.time()-3000 and start==true then
  154. tfm.exec.movePlayer(questioner,400,320,false,0,0,false)
  155. tfm.exec.movePlayer(answerer,400,320,false,0,0,false)
  156. answerer=""
  157. questioner=""
  158. local j=1
  159. local i=0
  160. while j<=numplayers do
  161. pname=players[j]
  162. if p[pname].questioners==false and tfm.get.room.playerList[pname].isDead==false and p[pname].spectator==false then
  163. i=i+1
  164. end
  165. j=j+1
  166. end
  167. if i>0 then
  168. eventTruthOrDare()
  169. else
  170. local j=1
  171. while j<=numplayers do
  172. local name=players[j]
  173. p[name].questioners=false
  174. j=j+1
  175. end
  176. restart=true
  177. timestamp=os.time()
  178. begin=false
  179. end
  180. end
  181. if choose==true then
  182.     rand=math.random(1,numplayers)
  183.     print(questioner)
  184.     answerer=players[rand]
  185.     print(answerer)
  186.     print(p[answerer].spectator)
  187.     if questioner==answerer or tfm.get.room.playerList[answerer].isDead or p[answerer].spectator==true then
  188.     ui.updateTextArea(1, "<p align='center'><b><font size='30'>Randomizing...</font></b></p>", nil)
  189.     tfm.exec.movePlayer(answerer,400,320,false,0,0,false)
  190.     answerer=""
  191.     else
  192.     choose=false
  193.     ui.updateTextArea(1, "<b><font size='15'>"..answerer.." is now the answerer! Waiting to pick truth or dare...</font></b>", nil)
  194.     ui.addPopup(3,1,"You are the answerer! Do you want Truth? If No, you will choose Dare!",answerer,250,50,300,true)
  195.     end
  196. elseif choosey==true then
  197.     rand=math.random(1,numplayers)
  198.     questioner=players[rand]
  199.     print(questioner)
  200.     print(p[questioner].questioners)
  201.     print(p[questioner].spectator)
  202.     if p[questioner].questioners==false and tfm.get.room.playerList[questioner].isDead==false and p[questioner].spectator==false then
  203.         choosey=false
  204.         p[questioner].questioners=true
  205.         ui.updateTextArea(1, "<b><font size='15'>"..questioner.." is now the asker! Waiting to pick an answerer...</font></b>", nil)
  206.         ui.addPopup(1,1,"Do you want a random Answerer? If <b>No</b>, you will have to type in your Answerer's username",questioner,250,50,300,true)
  207.     else
  208.         ui.updateTextArea(1, "<p align='center'><b><font size='30'>Randomizing...</font></b></p>", nil)
  209.         tfm.exec.movePlayer(questioner,400,320,false,0,0,false)
  210.         questioner=""
  211.     end
  212. end
  213. if skip==true then
  214. ui.updateTextArea(1, "<p align='center'><b><font size='30'>Skipping turn...</font></b></p>", nil)
  215. if timestamp < os.time()-3000 then
  216. start=true
  217. skip=false
  218. end
  219. end
  220. tfm.exec.movePlayer(questioner,120,120,false,0,0,false)
  221. tfm.exec.movePlayer(answerer,680,120,false,0,0,false)
  222. end
  223. end
  224.  
  225. function eventTruthOrDare()
  226.     start=false
  227.     ui.removeTextArea(2)
  228.     ui.removeTextArea(3)
  229.     choosey=true
  230.  
  231. end
  232.  
  233. function eventPopupAnswer(id, name, answer)
  234.     if id==1 and name==questioner then
  235.         if answer=="yes" then
  236.             choose=true
  237.         elseif answer=="no" then
  238.             ui.addPopup(2,2,"Who do you want to be the answerer?",questioner,250,50,300,true)
  239.         end
  240.     elseif id==2 and name==questioner then
  241.         x=1
  242.         found=false
  243.         while x<=numplayers do
  244.         print(players[x])
  245.             if answer==players[x] then
  246.             answerer=answer
  247.             if questioner==answerer or tfm.get.room.playerList[answerer].isDead or p[answerer].spectator==true then
  248.             answerer=""
  249.             found=false
  250.             else
  251.             ui.updateTextArea(1, "<b><font size='15'>"..answerer.." is now the answerer! Waiting to pick Truth or Dare...</font></b>", nil)
  252.             ui.addPopup(3,1,"You are the answerer! Do you want Truth? If <b>No</b>, you will choose Dare!",answerer,250,50,300,true)
  253.             found=true
  254.             end
  255.             end
  256.             x=x+1
  257.         end
  258.         if found==false then
  259.             ui.addPopup(2,2,"There is no such answerer in the room. Type out the exact username of your answerer.",questioner,250,50,300,true)
  260.         end
  261.     elseif id==3 and name==answerer then   
  262.         if answer=="yes" then
  263.             ui.updateTextArea(1, "<b><font size='15'>"..answerer.." has picked Truth! Waiting for question from "..questioner.."...</font></b>", nil)  
  264.             ui.addPopup(4,1,"Do you want a random Truth question? If <b>No</b>, you will have to submit a question.",questioner,250,50,300,true)
  265.         elseif answer=="no" then
  266.             ui.updateTextArea(1, "<b><font size='15'>"..answerer.." has picked Dare! Waiting for a dare from "..questioner.."...</font></b>", nil)
  267.             ui.addPopup(5,1,"Do you want a random Dare? If <b>No</b>, you will have to submit a Dare.",questioner,250,50,300,true)
  268.                
  269.         end
  270.     elseif id==4 and name==questioner then
  271.         if answer=="yes" then
  272.             question=truth[math.random(1,15)]
  273.             ui.updateTextArea(1, "<b><font size='15'>"..questioner.." has randomed a Truth question! Waiting for "..answerer.." to respond...</font></b>", nil)
  274.             ui.addTextArea(2,"<b><font size='20'>Truth: "..question.."</font></b>",nil,165,20,470,120,0x324650,0x212F36,0.8,true)
  275.             ui.addPopup(8,2,"<b>Type your Truth answer below</b>",answerer,250,175,300,true)
  276.             --need to ask if questioner is satisfied with answer
  277.         elseif answer=="no" then
  278.             ui.addPopup(6,2,"Type your Truth question below.",questioner,250,50,300,true)
  279.         end
  280.     elseif id==5 and name==questioner then
  281.         if answer=="yes" then
  282.             question=dare[math.random(1,13)]
  283.             ui.updateTextArea(1, "<b><font size='15'>"..questioner.." has randomed a Dare question! Waiting for "..answerer.." to respond...</font></b>", nil) 
  284.             ui.addTextArea(2,"<b><font size='20'>Dare: "..question.."</font></b>",nil,165,20,470,120,0x324650,0x212F36,0.8,true)
  285.             ui.addPopup(9,1,"<b><font size='15'>Do what "..questioner.."dares you to do! If you click 'yes' you will promise that you will do your dare!</font><b>",answerer,250,175,300,true)
  286.         elseif answer=="no" then
  287.             ui.addPopup(7,2,"Type your Dare below.",questioner,250,50,300,true)
  288.         end
  289.     elseif id==6 and name==questioner then
  290.         question=answer
  291.         ui.updateTextArea(1, "<b><font size='15'>"..questioner.." has typed a Truth question! Waiting for "..answerer.." to respond...</font></b>", nil)   
  292.         ui.addTextArea(2,"<b><font size='20'>Truth: "..question.."</font></b>",nil,165,20,470,120,0x324650,0x212F36,0.8,true)
  293.         ui.addPopup(8,2,"Type your Truth answer below",answerer,250,175,300,true)
  294.     elseif id==7 and name==questioner then
  295.         question=answer
  296.         ui.updateTextArea(1, "<b><font size='15'>"..questioner.." has typed a Dare question! Waiting for "..answerer.." to respond...</font></b>", nil)
  297.         ui.addTextArea(2,"<b><font size='15'>Dare: "..question.."</font></b>",nil,165,20,470,120,0x324650,0x212F36,0.8,true)
  298.         ui.addPopup(9,1,"<b><font size='15'>Do what "..questioner.."dares you to do! If you click 'yes' you will promise that you will do your dare!</font><b>",answerer,250,175,300,true)
  299.     elseif id==8 and name==answerer then
  300.         ans = answer
  301.         ui.addTextArea(3,"<b><font size='20'>Answer: "..ans.."</font></b>",nil,165,140,470,120,0x324650,0x212F36,0.8,true)
  302.         ui.updateTextArea(1, "<b><font size='15'>"..answerer.." has answered the question! Waiting for "..questioner.." to rate the answer</font></b>", nil)   
  303.         ui.addPopup(10,1,"<b><font size='15'>Are you satisfied with the answer?",questioner,250,50,300,true)
  304.     elseif id==9 and name==answerer then
  305.         if answer=="yes" then
  306.             ui.addTextArea(3,"<b><font size='20'>I, "..answerer..", accepts the challenge and promises to do the dare.</font></b>",nil,165,140,470,120,0x324650,0x212F36,0.8,true)
  307.             ui.updateTextArea(1, "<b><font size='15'>"..answerer.." is a warrior! Starting new game...</font></b>", nil)   
  308.             timestamp=os.time()
  309.             answerer=""
  310.             questioner=""
  311.             start=true
  312.             for name,player in pairs(tfm.get.room.playerList) do
  313.             tfm.exec.movePlayer(name,400,320,false,0,0,false)
  314.             end        
  315.         elseif answer=="no" then
  316.             ui.updateTextArea(1, "<b><font size='15'>"..answerer.." is a coward! Starting new game...</font></b>", nil)
  317.             ui.addTextArea(3,"<b><font size='20'>I, "..answerer..", am a coward so I don't dare to do what you dared me to do.</font></b>",nil,165,140,470,120,0x324650,0x212F36,0.8,true)
  318.             timestamp=os.time()
  319.             answerer=""
  320.             questioner=""
  321.             start=true
  322.             for name,player in pairs(tfm.get.room.playerList) do
  323.             tfm.exec.movePlayer(name,400,320,false,0,0,false)
  324.             end        
  325.         end
  326.     elseif id==10 and name==questioner then
  327.         if answer=="yes" then
  328.             ui.updateTextArea(1, "<b><font size='15'>"..questioner.." is a satisfied with the answer! Starting new game...</font></b>", nil)
  329.             timestamp=os.time()
  330.             answerer=""
  331.             questioner=""
  332.             start=true
  333.             for name,player in pairs(tfm.get.room.playerList) do
  334.             tfm.exec.movePlayer(name,400,320,false,0,0,false)
  335.             end
  336.         elseif answer=="no" then
  337.             ui.updateTextArea(1, "<b><font size='15'>"..questioner.." is a not satisfied with the answer...:( Starting new game...</font></b>", nil)
  338.             timestamp=os.time()
  339.             answerer=""
  340.             questioner=""
  341.             start=true         
  342.             for name,player in pairs(tfm.get.room.playerList) do
  343.             tfm.exec.movePlayer(name,400,320,false,0,0,false)
  344.             end
  345.         end
  346.     end
  347. end
  348.  
  349. function eventPlayerLeft(name)
  350. ui.updateTextArea(1, "<p align='center'><b><font size='15'>"..name.." left the room... What a coward!</font></b></p>", nil)
  351.  
  352. end
  353.  
  354. function eventPlayerDied(name)
  355. tfm.exec.respawnPlayer(name)
  356. end
  357.  
  358. function eventPlayerWon(playerName,timeElapsed)
  359. tfm.exec.respawnPlayer(playerName)
  360. end
Advertisement
Add Comment
Please, Sign In to add comment