Mousetat

Truth or dare open source lah

Apr 3rd, 2017
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 36.88 KB | None | 0 0
  1. permadmins = {"Tat#0020", "Leafileaf#0000", "Coralbee#0000", "Ykr#0000", "Yuba#2381", "Papero#9240", "Leetinsanity#0020", "Wangan#0015", "Katow#0020", "Kinhusxd#0015", "Nattorei#0010", "B1k#0020", "Hobothehill#0000", "Pikashu#0001", "Shamousey#0015", "Killerlux#0010","Secretive#0010", "Coralpearl#0000", "Link#3301", "Sebaisseba#0020"}
  2.  
  3. -- remember to put "," between each name!
  4. print(tfm.get.room.name)
  5.  
  6. tfm.exec.disableAutoNewGame(true)
  7. tfm.exec.disableAfkDeath(true)
  8. tfm.exec.disableAutoShaman(true)
  9. tfm.exec.disableAutoScore(true)
  10. tfm.exec.newGame("@6411544")
  11.  
  12. players={}--respawn place is 400,320
  13. p={}
  14. timestamp=os.time()
  15. numplayers=0
  16.  
  17. begin=false
  18. answerer="lol"
  19. questioner="lol"
  20. question="lol"
  21. ans="lol"
  22. new=false
  23. restart=false
  24. choose=false
  25. start=true
  26. choosey=false
  27. skip=false
  28. message=""
  29. others={}
  30. summonobject=false
  31. timestamplol={}
  32. answererold=""
  33. one=false
  34. dance=false
  35. mapcomplete=false
  36.  
  37. truth={}--you can follow the format 'truth[number]="question"'
  38. truth[1]="Who is your crush in this game?"
  39. truth[2]="Would you rather receive sweet lies or painful truths? Why?"
  40. truth[3]="Who is your model/favourite person in game?"
  41. truth[4]="What games do you play besides Transformice?"
  42. truth[5]="What would you like to be when you grow up?"
  43. truth[6]="What is the first thing you would do if you had the power of invisibility?"
  44. truth[7]="What brand of phone do you have currently?"
  45. truth[8]="Have you ever farted in front of your friends or teachers in real life?"
  46. truth[9]="If you could hack transformice, what would you do?"
  47. truth[10]="What is your favourite fur in Transformice if you have to choose?"
  48. truth[11]="Why do you like Transformice?"
  49. truth[12]="Would you rather have super strong arms, or super strong legs?"
  50. truth[13]="Which one would you choose: A ring that vibrates if someone it detects someone lying, or a backpack which can store infinite number of items(no humans)?"
  51. truth[14]="Tell us your name in real life"
  52. truth[15]="Why do you like your current crush in real life, in personality terms AND physical terms?"
  53. truth[16]="Tell us why you hate the person you currently hate in real life, in personality terms."
  54. truth[17]="If you had unlimited cheese and fraises, what item would you buy from the shop?"
  55. truth[18]="Which will you choose, free million of cash or living longer?"
  56. truth[19]="What is your favourite board game?"
  57. truth[20]="What is the longest that you have ever been without taking a shower?"
  58. truth[21]="Have you ever eaten an insect before? How do you think they taste like/will taste like, if you had one?"
  59. truth[22]="If you could be any super villain, who would you be?"
  60. truth[23]="If you could be any superhero, who would you be?"
  61. truth[24]="If you could be an animal, what would you be?"
  62. truth[25]="Who is your favourite staff?(Admin/Moderator/Sentinels/Mapcrew/Funcorp)"
  63. truth[26]="What is your impression of me? Do you like me?"
  64. truth[27]="Have you ever cheated on any test?"
  65. truth[28]="How many boyfriends/girlfriends have you had?"
  66. truth[29]="If you were a billionaire, what would you spend your time doing?"
  67. truth[30]="If you could be a boss of a company one day, what would you do?"
  68. truth[31]="What celebrity are you obsessed with?"
  69. truth[32]="What is your favourite sports team/player?"
  70. truth[32]="What is your favourite song that is out right now?"
  71. truth[33]="If you were on an island with a person and yourself only, who would you want the person to be?(the person must be in this room)"
  72. truth[34]="If you could marry, kiss, hug, punch and kill someone in this room, who would they be?(if there are less than 5 mice you can repeat names)"
  73. truth[35]="Would rather be rich but dumb, or poor but clever?"
  74. truth[36]="If you are driving and your break does not work, and you could either turn left and kill one young lady, or do nothing and kill 3 old people, what would you do?"
  75. truth[37]="Do you like anyone beside your soulmate? If yes, who?"
  76. truth[38]="Do have multiple crushes in real life or in tfm? If yes, how many do you have? If they are in tfm, who are they?? "
  77.  
  78. dare={}--you can follow the format 'dare[number]="Dare"'
  79. dare[1]="I dare you go into EN/EN2 room 2 and spam this message 10 times: CHARLOTTE CHARLOTTE CHARLOTTE CHARLOTTE CHARLOTTE CHARLOTTE CHARLOTTE CHARLOTTE"
  80. dare[2]="I dare you whisper a moderator a swear word."
  81. dare[3]="I dare you tell your crush, or anybody in this room that you love him/her right now"
  82. dare[4]="I dare you go into EN/EN2 room 1 and spam this message 10 times: I'M FLOODING REPORT ME!"
  83. dare[5]="I dare you report a moderator for hacking"
  84. 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!"
  85. dare[7]="I dare you tell your real life name to everybody in chat"
  86. dare[8]="I dare you take a picture of your real life face and send it to everyone to see."
  87. dare[9]="I dare you go into any #utility room with at least 3 people in it and crash the room."
  88. dare[10]="I dare you give me, the questioner, every ball you have in your inventory, if you have any."
  89. dare[11]="I dare you to disconnect and reconnect right now."
  90. dare[12]="I dare you to say who would be your most likely crush among the players in this room we are in."
  91. dare[13]="I dare you to give all your selfies to me right now, if you have any balls to do it via trade"
  92. dare[14]="I dare you complete this map without cheating!"
  93. dare[15]="I dare you type 'I LOVE YOU (username)' 30 times to a username in room/tribe in room chat or in tribe chat."
  94. dare[16]="I dare you kiss me, the questioner, 20 times :)"
  95. dare[17]="I dare you marry your closest friend, if u are not already married"
  96. dare[18]="I dare you give me, the questioner, every snowball you have in your inventory, if you have any."
  97. dare[19]="I dare you whisper a moderator, 'Ban me!'"
  98. dare[20]="I dare you kiss and hug someone in the room of the same gender"
  99. dare[21]="I dare you spam 'I AM A DUMB COWARD!' 10 times in this room's chat"
  100. dare[22]="I dare you ask your crush for a date."
  101. dare[23]="I dare you spam to a moderator, 'HEY <moderator's name>, I'M DAD'"
  102. dare[24]="I dare you go to a room in EN/EN2 and type 'I WANT WAFFLES' 5 times."
  103. dare[25]="I dare you go to cafe and create a topic: 'I LOVE UNDERTALE'"
  104. dare[26]="I dare you go to /room village1 and say to a random person there, 'OMG I LOVE YOU (insert random person's name) FRIEND ME I ALWAYS WANTED TO MEET YOU OMG!!! *-*'"
  105.  
  106. function admining(name)
  107. _,_,suffix=string.find((tfm.get.room.name:sub(1,2)=="e2" and tfm.get.room.name:sub(3)) or tfm.get.room.name,"%d+(.+)$")
  108. local roomSuffix = string.match(tfm.get.room.name, "%d+(.-)$")
  109. if (roomSuffix and string.lower(name) == string.lower(roomSuffix)) or (string.byte(tfm.get.room.name,2)==3 and (tfm.get.room.name:lower()):match(tfm.get.room.playerList[name].tribeName:lower())) then
  110. return true
  111. elseif suffix and ((suffix:lower()):match(name:lower()) or (suffix:lower()):match(tfm.get.room.playerList[name].tribeName:lower())) then
  112. return true
  113. end
  114. for _,v in pairs(permadmins) do
  115. if string.lower(v) == string.lower(name) then
  116. return true
  117. end
  118. end
  119. return false
  120. end
  121.  
  122. function eventNewPlayer(name)
  123. tfm.exec.addImage("1548ed5434f.jpg","?3",0,-25)
  124. tfm.exec.bindKeyboard(name,0,true,true)
  125. tfm.exec.bindKeyboard(name,2,true,true)
  126.  
  127. tat=0
  128. ui.addTextArea(1,"<b><p align = 'center'><font size='30'>Type !join to join the game.</font></p></b>",name,50,365,700,40,0x324650,0x212F36,0.8,true)
  129. tfm.exec.chatMessage("<font color='#2ECF73'>Welcome to Truth or Dare Game! Type <font color='#FFFFFF'>!help</font> for more information of the game and <font color='#FFFFFF'>!commands</font> to see the list of commands. \nForum Thread: atelier801.com//topic?f=6&t=814350&p=1 \n<font color='#00FF00'><b>Created by Mousetat</b></font></font>",name)
  130. tfm.exec.chatMessage("<b><font color='#BABD2F'>Type !join to join the game.</font></b>",name)
  131. ui.addPopup(999,0,"<p align = 'center'><font size='40' face='impact'>Truth or Dare</font></p><font size='20' color='#FF0000'><b>About the game</b></font><font size='15'>\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. If you are the asker, you can also type '#(number)' to give the question number of the truth/dare in the random list. There are currently <b>"..#truth.."</b> random truths and <b>"..#dare.."</b> random dares, so if you have any feedback feel free to tell me.\n<font color='#00FF00'>Created by Mousetat</font> \nForum Thread: atelier801.com//topic?f=6&t=814350&p=1 \n</font><font face='impact' size='30'>Type !commands to see the list of commands</font>",name,100,50,600,true)
  132. p[name]={questioners=false, admin=admining(name), spectator=true, ban=false, randomerino=1, out=false, new=false, id=5, cheese=false, victor=false}
  133. end
  134.  
  135. for name,player in pairs(tfm.get.room.playerList) do
  136. eventNewPlayer(name)
  137. end
  138.  
  139.  
  140.  
  141. function eventKeyboard(name,key,down,x,y)
  142. if key==0 and down==true and p[name].cheese==false and p[name].victor==false then
  143. tfm.exec.removeImage(p[name].id)
  144. p[name].id=tfm.exec.addImage("155865bc675.png","%"..name,-30,-40)
  145. end
  146. if key==2 and down==true and p[name].cheese==false and p[name].victor==false then
  147. tfm.exec.removeImage(p[name].id)
  148. p[name].id=tfm.exec.addImage("155865a7b4b.png","%"..name,-30,-40)
  149. end
  150. if key==0 and down==true and p[name].cheese==true and p[name].victor==false then
  151. tfm.exec.removeImage(p[name].id)
  152. --print(p[name].id)
  153. p[name].id=tfm.exec.addImage("155865fb4e8.png","%"..name,-25,-35)
  154. end
  155. if key==2 and down==true and p[name].cheese==true and p[name].victor==false then
  156. tfm.exec.removeImage(p[name].id)
  157. --print(p[name].id)
  158. p[name].id=tfm.exec.addImage("155865f9b10.png","%"..name,-20,-35)
  159. end
  160. if key==0 and down==true and p[name].victor==true then
  161. tfm.exec.removeImage(p[name].id)
  162. --print(p[name].id)
  163. p[name].id=tfm.exec.addImage("155865e2170.png","%"..name,-20,-25)
  164. end
  165. if key==2 and down==true and p[name].victor==true then
  166. tfm.exec.removeImage(p[name].id)
  167. --print(p[name].id)
  168. p[name].id=tfm.exec.addImage("155865e09bf.png","%"..name,-20,-25)
  169. end
  170. end
  171.  
  172. function eventPlayerGetCheese(name)
  173. p[name].cheese=true
  174. tfm.exec.removeImage(p[name].id)
  175. end
  176.  
  177.  
  178. function eventNewGame()
  179. tfm.exec.addImage("1548ed5434f.jpg","?3",0,-25)
  180. for name,player in pairs(tfm.get.room.playerList) do
  181. p[name].cheese=false
  182. tfm.exec.removeImage(p[name].id)
  183. end
  184. ui.addTextArea(1,"<b><p align = 'center'><font size='30'>Welcome to Truth or Dare Game!</font></p></b>",nil,50,365,700,40,0x324650,0x212F36,0.8,true)
  185. ui.addPopup(999,0,"<p align = 'center'><font size='40' face='impact'>Truth or Dare</font></p><font size='20' color='#FF0000'><b>About the game</b></font><font size='15'>\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. If you are the asker, you can also type '#(number)' to give the question number of the truth/dare in the random list. There are currently <b>"..#truth.."</b> random truths and <b>"..#dare.."</b> random dares, so if you have any feedback feel free to tell me.\n<font color='#00FF00'>Created by Mousetat</font> \nForum Thread: atelier801.com//topic?f=6&t=814350&p=1 \n</font><font face='impact' size='30'>Type !commands to see the list of commands</font>",nil,100,50,600,true)
  186. answerer=""
  187. questioner=""
  188. begin=false
  189. start=true
  190. numplayers=0
  191. count=1
  192. one=false
  193. tat=0
  194. for name,player in pairs(tfm.get.room.playerList) do
  195. p[name]={questioners=false, admin=admining(name), spectator=true, ban=false, randomerino=1, out=false, new=false, id=5, cheese=false, victor=false}
  196. players[count]=name
  197. timestamp=os.time()
  198. numplayers=numplayers+1
  199. count=count+1
  200. p[name].spectator=false
  201. p[name].questioners=false
  202. end
  203. system.disableChatCommandDisplay("t", hidden)
  204. system.disableChatCommandDisplay("admin", hidden)
  205. system.disableChatCommandDisplay("restart", hidden)
  206. system.disableChatCommandDisplay("ban", hidden)
  207. system.disableChatCommandDisplay("skip", hidden)
  208. system.disableChatCommandDisplay("watch", hidden)
  209. system.disableChatCommandDisplay("unban", hidden)
  210. system.disableChatCommandDisplay("unadmin", hidden)
  211. system.disableChatCommandDisplay("mods", hidden)
  212. system.disableChatCommandDisplay("help", hidden)
  213. system.disableChatCommandDisplay("commands", hidden)
  214. end
  215.  
  216. function eventChatCommand(name,command)
  217. local IDList = {}
  218. if command=="clear" then
  219. for id, object in pairs(tfm.get.room.objectList) do
  220. table.insert(IDList, id)
  221. end
  222. for i, id in pairs(IDList) do
  223. tfm.exec.removeObject(id)
  224. end
  225. end
  226. if command=="s" and p[name].admin==true then
  227. if string.sub(command,3)=="" then
  228. tfm.exec.setShaman(name)
  229. else
  230. tfm.exec.setShaman(string.sub(command,3))
  231. end
  232. elseif command=="dance" and p[name].admin==true then
  233. for name,player in pairs(tfm.get.room.playerList) do
  234. p[name].randomerino=math.random(1,4)
  235. end
  236. dance=true
  237. elseif command=="danceoff" and p[name].admin==true then
  238. dance=false
  239. elseif command=="mods" then
  240. message=""
  241. for k,v in pairs(tfm.get.room.playerList) do
  242. if p[k].admin==true then
  243. message=message..tostring(k)..", "
  244. end
  245. end
  246. tfm.exec.chatMessage("<font color='#FF69B4'>The Truth/Dare moderators are: "..string.sub(message,1,-3)..".</font>", name)
  247. elseif command=="new" and name==questioner then
  248. if p[name].new==false then
  249. tfm.exec.movePlayer(answerer,400,320,false,0,0,false)
  250. answererold=answerer
  251. answerer=""
  252. choose=true
  253. p[name].new=true
  254. else
  255. ui.updateTextArea(1, "<p align='center'><b><font size='30'>You can only !new ONCE</font></b></p>", nil)
  256. end
  257. elseif command=="join" and p[name].spectator==true then
  258. if p[name].ban==false then
  259. ui.updateTextArea(1, "<p align='center'><b><font size='30'>"..name.." joined the game! :D</font></b></p>", nil)
  260. tfm.exec.chatMessage("<b><font color='#BABD2F'>You have joined the game.</font></b>", name)
  261. tfm.exec.respawnPlayer(name)
  262. tfm.exec.movePlayer(name,400,320,false,0,0,false)
  263. p[name].spectator=false
  264. table.insert(players,name)
  265. elseif p[name].ban==true then
  266. tfm.exec.chatMessage("<b><font color='#BABD2F'>You have been banned, so u cannot join the game :(</font></b>", name)
  267. end
  268. elseif command=="skip" and p[name].admin==true then
  269. timestamp=os.time()
  270. tfm.exec.chatMessage("<font color='#FF69B4'>"..questioner.."'s turn has been skipped by Truth/Dare Moderation.</font>",nil)
  271. skip=true
  272. elseif string.sub(command,0,1) == "t" and p[name].admin==true then
  273. message=string.sub(command,3)
  274. tfm.exec.chatMessage("<font color='#FF69B4'>[~Truth/Dare Moderation] "..message.."</font>", nil)
  275. elseif command=="restart" and p[name].admin==true then
  276. tfm.exec.newGame("@6411544")
  277. elseif string.sub(command,0,5)=="watch" then
  278. if string.sub(command,7)=="" then
  279. p[name].spectator=true
  280. ui.updateTextArea(1, "<p align='center'><b><font size='30'>"..name.." is now a spectator :(</font></b></p>", nil)
  281. tfm.exec.chatMessage("<b><font color='#BABD2F'>Type !join to join the game.</font></b>",name)
  282. if name==questioner or name==answerer then
  283. questioner=""
  284. answerer=""
  285. tfm.exec.movePlayer(questioner,400,320,false,0,0,false)
  286. tfm.exec.movePlayer(answerer,400,320,false,0,0,false)
  287. timestamp=os.time()
  288. skip=true
  289. end
  290. for i=1,#players do
  291. if players[i]==name then
  292. table.remove(players,i)
  293. end
  294. end
  295. else
  296. if p[name].admin==true then
  297. message=string.sub(command,7)
  298. message=string.upper(string.sub(message,0,1))..string.sub(message,2)
  299. for k,v in pairs(tfm.get.room.playerList) do
  300. if k==message and p[k].spectator==false then
  301. if k==questioner or k==answerer then
  302. skip=true
  303. timestamp=os.time()
  304. end
  305. p[k].spectator=true
  306. ui.updateTextArea(1, "<p align='center'><b><font size='30'>"..k.." is now a spectator :(</font></b></p>", nil)
  307. tfm.exec.chatMessage("<b><font color='#BABD2F'>Type !join to join the game.</font></b>",name)
  308. for i=1,#players do
  309. if players[i]==k then
  310. table.remove(players,i)
  311. end
  312. end
  313. end
  314. end
  315. end
  316. end
  317. elseif command=="help" then
  318. ui.addPopup(999,0,"<p align = 'center'><font size='40' face='impact'>Truth or Dare</font></p><font size='20' color='#FF0000'><b>About the game</b></font><font size='15'>\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. If you are the asker, you can also type '#(number)' to give the question number of the truth/dare in the random list. There are currently <b>"..#truth.."</b> random truths and <b>"..#dare.."</b> random dares, so if you have any feedback feel free to tell me.\n<font color='#00FF00'>Created by Mousetat</font> \n</font><font face='impact' size='30'>Type !commands to see the list of commands</font>",name,100,50,600,true)
  319. elseif command=="commands" then
  320. if p[name].admin==true then
  321. ui.addPopup(999,0,"<b><font size='20' 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!mods to see the current moderators in the room.\n!clear to clear all shaman objects.\n!new to get a new answerer(only new ONCE)(asker only)\n!help to see the information about game\n<font size='20' color='#EB1D51'>ADMIN COMMANDS</font>\n!watch (username) to make the username a spectator.\n!s to become shaman\n!admin (username) to admin a person\n!dance/!danceoff to toggle dancing\n!t (message) to speak to all)\n!restart to restart game if bugged\n!skip to skip a person's turn\n!ban (username) (reason) to ban a person(highly not advised)</b>",name,100,50,600,true)
  322. elseif p[name].admin==false then
  323. ui.addPopup(999,0,"<b><font size='20' 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!mods to see the current moderators in the room.\n!clear to clear all shaman objects.\n!new to get a new answerer(only new ONCE)(asker only)\n!help to see the information about game",name,100,50,600,true)
  324. end
  325. elseif string.sub(command,0,3)=="ban" and p[name].admin==true then
  326. local c=0
  327. local reason=""
  328. if string.find(command," ",5)==nil then
  329. message=string.sub(command,5)
  330. else
  331. c=string.find(command," ",5)
  332. message=string.sub(command,5,c-1)
  333. reason=string.sub(command,c+1)
  334. end
  335. message=string.upper(string.sub(message,0,1))..string.sub(message,2)
  336. for k,v in pairs(tfm.get.room.playerList) do
  337. if message==k then
  338. tfm.exec.chatMessage("<font color='#FF69B4'>[~Truth/Dare Moderation] "..message.." has been banned for 9999 hours. Reason: "..reason.."</font>", nil)
  339. p[message].ban=true
  340. tfm.exec.killPlayer(k)
  341. for i=1,#players do
  342. if players[i]==k then
  343. table.remove(players,i)
  344. end
  345. end
  346. end
  347. end
  348. elseif string.sub(command,0,5)=="unban" and p[name].admin==true then
  349. message=string.sub(command,7)
  350. message=string.upper(string.sub(message,0,1))..string.sub(message,2)
  351. for k,v in pairs(tfm.get.room.playerList) do
  352. if message==k then
  353. tfm.exec.chatMessage("<font color='#FF69B4'>[~Truth/Dare Moderation] "..message.." has been unbanned.</font>", nil)
  354. p[message].ban=false
  355. tfm.exec.respawnPlayer(k)
  356. table.insert(players,k)
  357. end
  358. end
  359. elseif string.sub(command,0,5)=="admin" and p[name].admin==true then
  360. message=string.sub(command,7)
  361. message=string.upper(string.sub(message,0,1))..string.sub(message,2)
  362. for k,v in pairs(tfm.get.room.playerList) do
  363. if message==k then
  364. tfm.exec.chatMessage("<font color='#FF69B4'>[~Truth/Dare Moderation] "..message.." is now a Truth/Dare moderator. Congrats!</font>", nil)
  365. p[message].admin=true
  366. end
  367. end
  368. elseif string.sub(command,0,7)=="unadmin" and p[name].admin==true then
  369. message=string.sub(command,9)
  370. message=string.upper(string.sub(message,0,1))..string.sub(message,2)
  371. for k,v in pairs(tfm.get.room.playerList) do
  372. if message==k then
  373. tfm.exec.chatMessage("<font color='#FF69B4'>[~Truth/Dare Moderation] "..message.." is demoded. What a waste!</font>", nil)
  374. p[message].admin=false
  375. end
  376. end
  377. end
  378. end
  379. function eventLoop(time,remaining)
  380. if dance==true then
  381. for name,player in pairs(tfm.get.room.playerList) do
  382. if p[name].randomerino==1 then
  383. tfm.exec.playEmote(name,0,nil)
  384. p[name].randomerino=math.random(1,4)
  385. elseif p[name].randomerino==2 then
  386. tfm.exec.playEmote(name,15,nil)
  387. p[name].randomerino=math.random(1,4)
  388. elseif p[name].randomerino==3 then
  389. tfm.exec.playEmote(name,16,nil)
  390. p[name].randomerino=math.random(1,4)
  391. elseif p[name].randomerino==4 then
  392. tfm.exec.playEmote(name,24,nil)
  393. p[name].randomerino=math.random(1,4)
  394. end
  395. end
  396. end
  397. numplayers=#players
  398. for k,v in pairs(tfm.get.room.playerList) do
  399. if p[k].ban==true then
  400. ui.updateTextArea(1,"<b><p align = 'center'><font size='30'>You have been banned. :(</font></p></b>",k)
  401. elseif p[k].spectator==true then
  402. ui.updateTextArea(1,"<b><p align = 'center'><font size='30'>Type !join to join the game.</font></p></b>",k)
  403. end
  404. end
  405. local IDList={}
  406. for id, object in pairs(tfm.get.room.objectList) do
  407. table.insert(IDList, id)
  408. end
  409. for i, id in pairs(IDList) do
  410. if others[id].summonobject==true and timestamplol[id]<os.time()-3000 then
  411. tfm.exec.removeObject(id)
  412. others[id].summonobject=false
  413. end
  414. end
  415. if numplayers<2 then
  416. one=true
  417. else
  418. one=false
  419. end
  420. if one==true then
  421. ui.updateTextArea(1, "<p align='center'><b><font size='15'>Minimum of 2 players are needed for this game to proceed.</font></b></p>", nil)
  422. timestamp=os.time()-4000
  423. elseif timestamp < os.time()-10000 and begin==false then
  424. timestamp=os.time()
  425. begin=true
  426. restart=false
  427. ui.updateTextArea(1, "<p align='center'><b><font size='30'>Let's Begin the Game! </font></b></p>", nil)
  428. for name,player in pairs(tfm.get.room.playerList) do
  429. tfm.exec.movePlayer(name,400,320,false,0,0,false)
  430. end
  431. elseif timestamp < os.time()-5000 and begin==false then
  432. local i=1
  433. local long=""
  434. local hname=""
  435. while i<=numplayers do
  436. hname=players[i]
  437. if p[hname].spectator==false and tfm.get.room.playerList[hname].isDead==false and p[hname].out==false then
  438. long=long..tostring(players[i])..", "
  439. end
  440. i=i+1
  441. end
  442. ui.updateTextArea(1, "<p align='center'><b><font size='15'>The participating players are: "..string.sub(long,1,-3)..".</font></b></p>", nil)
  443. elseif timestamp < os.time()-3000 and begin==false and restart==true then
  444. ui.updateTextArea(1, "<p align='center'><b><font size='20'>Since everyone had their turn, I'll restart the game...", nil)
  445. end
  446. if begin==true then
  447. if timestamp < os.time()-3000 and start==true then
  448. tfm.exec.movePlayer(questioner,400,320,false,0,0,false)
  449. tfm.exec.movePlayer(answerer,400,320,false,0,0,false)
  450. answerer=""
  451. questioner=""
  452. local j=1
  453. local i=0
  454. while j<=numplayers do
  455. pname=players[j]
  456. if p[pname].questioners==false and tfm.get.room.playerList[pname].isDead==false and p[pname].spectator==false and p[pname].out==false then
  457. i=i+1
  458. end
  459. j=j+1
  460. end
  461. if i>0 then
  462. eventTruthOrDare()
  463. else
  464. local j=1
  465. while j<=numplayers do
  466. local name=players[j]
  467. p[name].questioners=false
  468. j=j+1
  469. end
  470. restart=true
  471. timestamp=os.time()
  472. begin=false
  473. end
  474. end
  475. if choose==true and one==false then
  476. rand=math.random(1,numplayers)
  477. answerer=players[rand]
  478. if questioner==answerer or tfm.get.room.playerList[answerer].isDead or p[answerer].spectator==true or answerer==answererold or p[answerer].out==true then
  479. ui.updateTextArea(1, "<p align='center'><b><font size='30'>Randomizing...</font></b></p>", nil)
  480. tfm.exec.movePlayer(answerer,400,320,false,0,0,false)
  481. answerer=""
  482. else
  483. choose=false
  484. ui.updateTextArea(1, "<b><font size='15'>"..answerer.." is now the answerer! Waiting to pick truth or dare...</font></b>", nil)
  485. ui.addPopup(3,1,"You are the answerer! Do you want Truth? If No, you will choose Dare!",answerer,250,50,300,true)
  486. end
  487. elseif choosey==true and one==false then
  488. rand=math.random(1,numplayers)
  489. questioner=players[rand]
  490. if p[questioner].questioners==false and tfm.get.room.playerList[questioner].isDead==false and p[questioner].spectator==false or p[questioner].out==false then
  491. choosey=false
  492. p[questioner].questioners=true
  493. ui.updateTextArea(1, "<b><font size='15'>"..questioner.." is now the asker! Waiting to pick an answerer...</font></b>", nil)
  494. 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)
  495. else
  496. ui.updateTextArea(1, "<p align='center'><b><font size='30'>Randomizing...</font></b></p>", nil)
  497. tfm.exec.movePlayer(questioner,400,320,false,0,0,false)
  498. questioner=""
  499. end
  500. end
  501. if skip==true then
  502. ui.updateTextArea(1, "<p align='center'><b><font size='30'>Skipping turn...</font></b></p>", nil)
  503. tfm.exec.movePlayer(questioner,400,320,false,0,0,false)
  504. tfm.exec.movePlayer(answerer,400,320,false,0,0,false)
  505. answerer=""
  506. questioner=""
  507. if timestamp < os.time()-3000 then
  508. start=true
  509. skip=false
  510. end
  511. end
  512. tfm.exec.movePlayer(questioner,120,120,false,0,0,false)
  513. tfm.exec.movePlayer(answerer,680,120,false,0,0,false)
  514. end
  515. end
  516.  
  517. function eventTruthOrDare()
  518. start=false
  519. ui.removeTextArea(2)
  520. ui.removeTextArea(3)
  521. choosey=true
  522. end
  523.  
  524. function eventPopupAnswer(id, name, answer)
  525. if id==1 and name==questioner then
  526. if answer=="yes" then
  527. answererold=""
  528. choose=true
  529. elseif answer=="no" then
  530. ui.addPopup(2,2,"Who do you want to be the answerer?",questioner,250,50,300,true)
  531. end
  532. elseif id==2 and name==questioner then
  533. x=1
  534. found=false
  535. answer=string.upper(string.sub(answer,0,1))..string.sub(answer,2)
  536. answer=string.gsub(answer, "<", "&lt;")
  537. answer=string.gsub(answer, "http", "")
  538. answer=string.gsub(answer,"fuck", "****")
  539. answer=string.gsub(answer,"shit", "****")
  540. answer=string.gsub(answer,"ass", "***")
  541. answer=string.gsub(answer,"cunt", "****")
  542. answer=string.gsub(answer,"dick", "****")
  543. while x<=numplayers do
  544. if answer==players[x] then
  545. answerer=answer
  546. if questioner==answerer or tfm.get.room.playerList[answerer].isDead or p[answerer].spectator==true or p[answerer].out==true then
  547. answerer=""
  548. found=false
  549. else
  550. ui.updateTextArea(1, "<b><font size='15'>"..answerer.." is now the answerer! Waiting to pick Truth or Dare...</font></b>", nil)
  551. 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)
  552. found=true
  553. end
  554. end
  555. x=x+1
  556. end
  557. if found==false then
  558. 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)
  559. end
  560. elseif id==3 and name==answerer then
  561. if answer=="yes" then
  562. ui.updateTextArea(1, "<b><font size='15'>"..answerer.." has picked Truth! Waiting for question from "..questioner.."...</font></b>", nil)
  563. 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)
  564. elseif answer=="no" then
  565. ui.updateTextArea(1, "<b><font size='15'>"..answerer.." has picked Dare! Waiting for a dare from "..questioner.."...</font></b>", nil)
  566. 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)
  567.  
  568. end
  569. elseif id==4 and name==questioner then
  570. if answer=="yes" then
  571. question=truth[math.random(1,#truth)]
  572. ui.updateTextArea(1, "<b><font size='15'>"..questioner.." has randomed a Truth question! Waiting for "..answerer.." to respond...</font></b>", nil)
  573. ui.addTextArea(2,"<b><font size='20'>Truth: "..question.."</font></b>",nil,165,20,470,120,0x324650,0x212F36,0.8,true)
  574. ui.addPopup(8,2,"<b>Type your Truth answer below</b>",answerer,250,175,300,true)
  575.  
  576. elseif answer=="no" then
  577. ui.addPopup(6,2,"Type your Truth question below, or type #(number) for the question number from the random list.",questioner,250,50,300,true)
  578. end
  579. elseif id==5 and name==questioner then
  580. if answer=="yes" then
  581. question=dare[math.random(1,#dare)]
  582. ui.updateTextArea(1, "<b><font size='15'>"..questioner.." has randomed a Dare question! Waiting for "..answerer.." to respond...</font></b>", nil)
  583. ui.addTextArea(2,"<b><font size='20'>Dare: "..question.."</font></b>",nil,165,20,470,120,0x324650,0x212F36,0.8,true)
  584. 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)
  585. elseif answer=="no" then
  586. ui.addPopup(7,2,"Type your Dare below, or type #(number) for the dare number from the random list.",questioner,250,50,300,true)
  587. end
  588. elseif id==6 and name==questioner then
  589. answer=string.gsub(answer, "<", "&lt;")
  590. answer=string.gsub(answer, "http", "")
  591. answer=string.gsub(answer,"fuck", "****")
  592. answer=string.gsub(answer,"shit", "****")
  593. answer=string.gsub(answer,"ass", "***")
  594. answer=string.gsub(answer,"cunt", "****")
  595. answer=string.gsub(answer,"dick", "****")
  596. if answer=="" then
  597. ui.addPopup(6,2,"You have to type something as your Truth question.",questioner,250,50,300,true)
  598. elseif string.sub(answer,0,1)=="#" and tonumber(string.sub(answer,2,3))<=#truth then
  599. question=truth[tonumber(string.sub(answer,2,3))]
  600. ui.updateTextArea(1, "<b><font size='15'>"..questioner.." has typed a Truth question! Waiting for "..answerer.." to respond...</font></b>", nil)
  601. ui.addTextArea(2,"<b><font size='20'>Truth: "..question.."</font></b>",nil,165,20,470,120,0x324650,0x212F36,0.8,true)
  602. ui.addPopup(8,2,"Type your Truth answer below",answerer,250,175,300,true)
  603. elseif string.sub(answer,0,1)=="#" and tonumber(string.sub(answer,2,3))>#truth then
  604. ui.addPopup(6,2,"You have to type a Truth question number less than or equal to "..tostring(#truth),questioner,250,50,300,true)
  605. else
  606. question=answer
  607. ui.updateTextArea(1, "<b><font size='15'>"..questioner.." has typed a Truth question! Waiting for "..answerer.." to respond...</font></b>", nil)
  608. ui.addTextArea(2,"<b><font size='20'>Truth: "..question.."</font></b>",nil,165,20,470,120,0x324650,0x212F36,0.8,true)
  609. ui.addPopup(8,2,"Type your Truth answer below",answerer,250,175,300,true)
  610. end
  611. elseif id==7 and name==questioner then
  612. answer=string.gsub(answer, "<", "&lt;")
  613. answer=string.gsub(answer, "http", "")
  614. answer=string.gsub(answer,"fuck", "****")
  615. answer=string.gsub(answer,"shit", "****")
  616. answer=string.gsub(answer,"ass", "***")
  617. answer=string.gsub(answer,"cunt", "****")
  618. answer=string.gsub(answer,"dick", "****")
  619. if answer=="" then
  620. ui.addPopup(7,2,"You have to type something as your Dare.",questioner,250,50,300,true)
  621. elseif string.sub(answer,0,1)=="#" and tonumber(string.sub(answer,2,3))<=#dare then
  622. if tonumber(string.sub(answer,2,3))==14 then
  623. mapcomplete=true
  624. end
  625. question=dare[tonumber(string.sub(answer,2,3))]
  626. ui.updateTextArea(1, "<b><font size='15'>"..questioner.." has typed a Dare question! Waiting for "..answerer.." to respond...</font></b>", nil)
  627. ui.addTextArea(2,"<b><font size='15'>Dare: "..question.."</font></b>",nil,165,20,470,120,0x324650,0x212F36,0.8,true)
  628. 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)
  629. elseif string.sub(answer,0,1)=="#" and tonumber(string.sub(answer,2,3))>#dare then
  630. ui.addPopup(7,2,"You have to type a Dare number less than or equal to "..tostring(#dare),questioner,250,50,300,true)
  631. else
  632. question=answer
  633. ui.updateTextArea(1, "<b><font size='15'>"..questioner.." has typed a Dare question! Waiting for "..answerer.." to respond...</font></b>", nil)
  634. ui.addTextArea(2,"<b><font size='15'>Dare: "..question.."</font></b>",nil,165,20,470,120,0x324650,0x212F36,0.8,true)
  635. 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)
  636. end
  637. elseif id==8 and name==answerer then
  638. answer=string.gsub(answer, "<", "&lt;")
  639. answer=string.gsub(answer, "http", "")
  640. answer=string.gsub(answer,"fuck", "****")
  641. answer=string.gsub(answer,"shit", "****")
  642. answer=string.gsub(answer,"ass", "***")
  643. answer=string.gsub(answer,"cunt", "****")
  644. answer=string.gsub(answer,"dick", "****")
  645. ans = answer
  646. if ans=="" then
  647. ui.addPopup(8,2,"You have to type something as your Truth Answer",answerer,250,175,300,true)
  648. else
  649. ui.addTextArea(3,"<b><font size='20'>Answer: "..ans.."</font></b>",nil,165,140,470,120,0x324650,0x212F36,0.8,true)
  650. ui.updateTextArea(1, "<b><font size='15'>"..answerer.." has answered the question! Waiting for "..questioner.." to rate the answer</font></b>", nil)
  651. ui.addPopup(10,1,"<b><font size='15'>Are you satisfied with the answer?",questioner,250,50,300,true)
  652. end
  653. elseif id==9 and name==answerer then
  654. if answer=="yes" then
  655. 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)
  656. if mapcomplete==true then
  657. ui.updateTextArea(1, "<b><font size='15'>"..answerer.." is a warrior! He/she will have to complete the map before entering the game. Starting new game...</font></b>", nil)
  658. p[answerer].out=true
  659. mapcomplete=false
  660. for i=1,#players do
  661. if players[i]==answerer then
  662. table.remove(players,i)
  663. end
  664. end
  665. else
  666. ui.updateTextArea(1, "<b><font size='15'>"..answerer.." is a warrior! Starting new game...</font></b>", nil)
  667. end
  668. timestamp=os.time()
  669. answerer=""
  670. questioner=""
  671. start=true
  672. for name,player in pairs(tfm.get.room.playerList) do
  673. tfm.exec.movePlayer(name,400,320,false,0,0,false)
  674. p[name].new=false
  675. end
  676. elseif answer=="no" then
  677. mapcomplete=false
  678. ui.updateTextArea(1, "<b><font size='15'>"..answerer.." is a coward! Starting new game...</font></b>", nil)
  679. 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)
  680. timestamp=os.time()
  681. answerer=""
  682. questioner=""
  683. start=true
  684. for name,player in pairs(tfm.get.room.playerList) do
  685. tfm.exec.movePlayer(name,400,320,false,0,0,false)
  686. p[name].new=false
  687. end
  688. end
  689. elseif id==10 and name==questioner then
  690. if answer=="yes" then
  691. ui.updateTextArea(1, "<b><font size='15'>"..questioner.." is a satisfied with the answer! Starting new game...</font></b>", nil)
  692. timestamp=os.time()
  693. answerer=""
  694. questioner=""
  695. start=true
  696. for name,player in pairs(tfm.get.room.playerList) do
  697. tfm.exec.movePlayer(name,400,320,false,0,0,false)
  698. p[name].new=false
  699. end
  700. elseif answer=="no" then
  701. ui.updateTextArea(1, "<b><font size='15'>"..questioner.." is a not satisfied with the answer...:( Starting new game...</font></b>", nil)
  702. timestamp=os.time()
  703. answerer=""
  704. questioner=""
  705. start=true
  706. for name,player in pairs(tfm.get.room.playerList) do
  707. tfm.exec.movePlayer(name,400,320,false,0,0,false)
  708. p[name].new=false
  709. end
  710. end
  711. end
  712. end
  713.  
  714. function eventPlayerLeft(name)
  715. ui.updateTextArea(1, "<p align='center'><b><font size='15'>"..name.." left the room... What a coward!</font></b></p>", nil)
  716. if questioner==name or answerer==name then
  717. timestamp=os.time()
  718. skip=true
  719. end
  720. for i=1,#players do
  721. if players[i]==name then
  722. table.remove(players,i)
  723. end
  724. end
  725. end
  726.  
  727. function eventPlayerDied(name)
  728. if p[name].spectator==false and p[name].ban==false then
  729. tfm.exec.respawnPlayer(name)
  730. end
  731. if p[name].ban==true then
  732. if name==questioner or name==answerer then
  733. timestamp=os.time()
  734. skip=true
  735. end
  736. end
  737. end
  738.  
  739. function eventPlayerWon(playerName,timeElapsed, timeElapsedSinceRespawn)
  740. p[playerName].cheese=false
  741. p[playerName].victor=true
  742. tfm.exec.respawnPlayer(playerName)
  743. if p[playerName].out==true then
  744. p[playerName].out=false
  745. table.insert(players,playerName)
  746. tfm.exec.chatMessage("<font color='#BABD2F'>"..playerName.." completed the map in "..(timeElapsedSinceRespawn/100).." seconds! He/she has joined back the game!</font>", nil)
  747. else
  748. tfm.exec.chatMessage("<font color='#BABD2F'>"..playerName.." completed the map in "..(timeElapsedSinceRespawn/100).." seconds!</font>", nil)
  749. end
  750. end
  751.  
  752. function eventSummoningEnd(playerName, objectType, xPosition, yPosition, angle, xSpeed, ySpeed, other)
  753. timestamplol[other.id]=os.time()
  754. others[other.id]={summonobject=true}
  755. end
Advertisement
Add Comment
Please, Sign In to add comment