Mousetat

#Taptap afk

Jan 7th, 2017
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.20 KB | None | 0 0
  1. admin="Tat#0020"
  2.  
  3. tfm.exec.disableAutoShaman(true)
  4. tfm.exec.disableAutoNewGame(true)
  5. tfm.exec.disableAfkDeath(true)
  6. p={}
  7. sobj={33,39,40,63,65,80,85,89,95,601,603,604}
  8. keys={0,1,2,3,32,74,75,76,69,72,17}
  9. keynames={"LEFT","UP","RIGHT","DOWN","SPACE","J","K","L","E","H","CTRL"}
  10. winners={}
  11. t={}
  12. events={"clickin", "clickout", "onekey"}--, "twokey", "wj", "leftright", ""}
  13. images={"red button", "Palkia", "Dialgia", "Pikachu", "Charizard", "Arceus"}
  14. imagepng={{img="156eece9479.png",x=-45,y=-45}, {img="1507bd184d2.png",x=-45,y=-43}, {img="1507bd14e17.png",x=-43,y=-45}, {img="156ef032d70.png",x=-38,y=-38}, {img="153dba45227.jpg",x=-33,y=-35}, {img="1507bd3749f.png",x=-43,y=-50}}
  15. players={}
  16. banned={""}
  17. start,event=false,false
  18. ends,eventon=false,false
  19. rounds,randomtime=999,0
  20. randomevent=0
  21. imgids={}
  22. keyids={}
  23. initialrounds=0
  24.  
  25. tfm.exec.newGame('@6845392')
  26.  
  27. function eventNewPlayer(name)
  28. p[name]={id=0, shamanobj=false, score=0, x=0, y=0, lastscore=0}
  29. system.bindMouse(name,true)
  30. for i=1,#keys do
  31. system.bindKeyboard(name,keys[i],true,true)
  32. end
  33. tfm.exec.respawnPlayer(name)
  34. table.insert(players,name)
  35. tfm.exec.movePlayer(name,t[#players].x,t[#players].y,false,0,0,false)
  36. ui.addTextArea(1,"",name,0,30,800,50,0x324650,0x212F36,0.8,true)
  37. end
  38.  
  39. for name,player in pairs(tfm.get.room.playerList) do
  40. p[name]={id=0, shamanobj=false, score=0, x=0, y=0, lastscore=0}
  41. system.bindMouse(name,true)
  42. for i=1,#keys do
  43. system.bindKeyboard(name,keys[i],true,true)
  44. end
  45. end
  46.  
  47. function eventNewGame()
  48. for i=1,10 do
  49. for j=1,3 do
  50. table.insert(t,{x=(i-1)*80+40, y=(j-1)*60+245})
  51. end
  52. end
  53. for i=1,#t do
  54. local change=math.random(i,#t)
  55. t[i],t[change]=t[change],t[i]
  56. end
  57. for name,player in pairs(tfm.get.room.playerList) do
  58. tfm.exec.setPlayerScore(name,0,false)
  59. local ban=false
  60. for i=1,#banned do
  61. if banned[i]==name then
  62. ban=true
  63. end
  64. end
  65. if ban==false then
  66. table.insert(players,name)
  67. end
  68. end
  69. for n=1,#players do
  70. p[players[n]]={id=0, shamanobj=false, score=0, x=0, y=0, lastscore=0}
  71. p[players[n]].x, p[players[n]].y=t[n].x,t[n].y
  72. tfm.exec.movePlayer(players[n],p[players[n]].x,p[players[n]].y,false,0,0,false)
  73. end
  74. ui.addTextArea(1,"Taptap: Hi, my name is Taptap and I will be your gamemaster for this minigame. You have to have fast hands and do what I say to get points!\nWaiting for <b>"..admin.."</b> to choose the number of rounds...",nil,0,30,800,50,0x324650,0x212F36,0.8,true)
  75. ui.addPopup(1,2,"Your are the admin. Type the number of rounds for this game:",admin,300,200,200,true)
  76. end
  77.  
  78. function eventPopupAnswer(id,name,answer)
  79. if tonumber(answer)%1==0 and name==admin and id==1 then
  80. rounds=tonumber(answer)
  81. initialrounds=rounds
  82. start=true
  83. ui.updateTextArea(1,"Taptap: "..admin.." has chosen "..tostring(rounds).." rounds! Starting new game...",nil)
  84. timestamp=os.time()
  85. end
  86. end
  87.  
  88.  
  89. function eventsPlay()
  90. randomevent=math.random(1,#events)
  91. if events[randomevent]=="clickin" then
  92. shamorparticle()
  93. local random=math.random(1,#images)
  94. imgids[1]=tfm.exec.addImage(imagepng[random].img,"?1",imagepng[random].x+400,imagepng[random].y+150,nil)
  95. ui.updateTextArea(1,"<font size='20'>Taptap: Click on the "..images[random].." as many times as possible!</font>",nil)
  96. elseif events[randomevent]=="clickout" then
  97. shamorparticle()
  98. local random=math.random(1,#images)
  99. imgids[1]=tfm.exec.addImage(imagepng[random].img,"?1",imagepng[random].x+400,imagepng[random].y+150,nil)
  100. ui.updateTextArea(1,"<font size='20'>Taptap: Click anywhere other than the "..images[random].." as many times as possible!</font>",nil)
  101. elseif events[randomevent]=="onekey" then
  102. shamorparticle()
  103. local random=math.random(1,#keynames)
  104. keyids[1]=keys[random]
  105. ui.updateTextArea(1,"<font size='20'>Taptap: Press the "..keynames[random].." key as many times as possible!</font>",nil)
  106. end
  107. end
  108.  
  109. function shamorparticle()
  110. for name,player in pairs(tfm.get.room.playerList) do
  111. local shamorparticles=math.random(0,2)
  112. if shamorparticle==1 then
  113. p[name].shamanobj=true
  114. p[name].id=sobj[math.random(1,#sobj)]
  115. else
  116. p[name].shamanobj=false
  117. p[name].id=math.random(0,42)
  118. end
  119. end
  120. end
  121.  
  122. function eventLoop(time,remaining)
  123. if start==true and timestamp<=os.time()-3000 and rounds>0 then
  124. for i=1,#imgids do
  125. tfm.exec.removeImage(imgids[i])
  126. end
  127. ui.updateTextArea(1,"Taptap says...",nil)
  128. timestamp=os.time()
  129. randomtime=math.random(1000,10000)
  130. start,event=false,true
  131. elseif event==true and timestamp<=os.time()-randomtime then
  132. for name,player in pairs(tfm.get.room.playerList) do
  133. p[name].lastscore=player.score
  134. end
  135. eventsPlay()
  136. eventon=true
  137. timestamp=os.time()
  138. event,ends=false,true
  139. elseif ends==true and timestamp<=os.time()-10000 then
  140. ui.updateTextArea(1,"Time's up! Starting new game...",nil)
  141. ends,eventon=false,false
  142. rounds=rounds-1
  143. timestamp=os.time()
  144. start=true
  145. randomevent=0
  146. elseif rounds<=0 then
  147. ui.updateTextArea(1,"The rounds are over!",nil)
  148. for i=1,#imgids do
  149. tfm.exec.removeImage(imgids[i])
  150. end
  151. end
  152. end
  153.  
  154. function eventMouse(name,x,y)
  155. if randomevent==1 then
  156. if eventon==true and math.sqrt((x-400)^2+(y-150)^2)<=50 then
  157. p[name].score=p[name].score+1
  158. tfm.exec.setPlayerScore(name,1,true)
  159. if p[name].shamanobj==false then
  160. tfm.exec.displayParticle (p[name].id,x,y,math.random(-5,5),math.random(-5,5),0,0,nil)
  161. else
  162. tfm.exec.addShamanObject(p[name].id,x,y,math.random(0,360), math.random(-5,5), math.random(-5,5), false)
  163. end
  164. elseif eventon==true and math.sqrt((x-400)^2+(y-150)^2)>50 then
  165. tfm.exec.chatMessage("You are not clicking on the image!",name)
  166. end
  167. elseif randomevent==2 then
  168. if eventon==true and math.sqrt((x-400)^2+(y-150)^2)<=50 then
  169. tfm.exec.chatMessage("You are clicking on the image! Read my instructions!",name)
  170. elseif eventon==true and math.sqrt((x-400)^2+(y-150)^2)>50 then
  171. p[name].score=p[name].score+1
  172. tfm.exec.setPlayerScore(name,1,true)
  173. if p[name].shamanobj==false then
  174. tfm.exec.displayParticle (p[name].id,x,y,math.random(-5,5),math.random(-5,5),0,0,nil)
  175. else
  176. tfm.exec.addShamanObject(p[name].id,x,y,math.random(0,360), math.random(-5,5), math.random(-5,5), false)
  177. end
  178. end
  179. end
  180. end
  181.  
  182. function eventKeyboard(name,key,down,x,y)
  183. if randomevent==3 then
  184. if key==keyids[1] then
  185. p[name].score=p[name].score+1
  186. tfm.exec.setPlayerScore(name,1,true)
  187. if p[name].shamanobj==false then
  188. tfm.exec.displayParticle (p[name].id,x,y,math.random(-5,5),math.random(-5,5),0,0,nil)
  189. else
  190. tfm.exec.addShamanObject(p[name].id,x,y,math.random(0,360), math.random(-5,5), math.random(-5,5), false)
  191. end
  192. else
  193. tfm.exec.chatMessage("That's not the correct key! Try again!",name)
  194. end
  195. end
  196. end
  197. function eventChatCommand(name,message)
  198. if message=="speed" then
  199. local score=0
  200. for k,v in pairs(tfm.get.room.playerList) do
  201. if k==name then
  202. score=v.score
  203. end
  204. end
  205. tfm.exec.chatMessage(name.."-Average speed: "..tostring(p[name].score/((initialrounds-rounds)*10)).." taps per second, Speed last round: "..tostring((score-p[name].lastscore)/10).." taps per second.")
  206. end
  207. end
  208. function eventPlayerLeft(name)
  209. for i=1,#players do
  210. if name==players[i] then
  211. table.remove(players,i)
  212. end
  213. end
  214. end
Advertisement
Add Comment
Please, Sign In to add comment