Advertisement
NoorTFM

The Movements

Feb 18th, 2017
436
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.92 KB | None | 0 0
  1. tfm.exec.disableAfkDeath(true)
  2. tfm.exec.disableAutoNewGame(true)
  3. tfm.exec.disableAutoShaman(true)
  4. data={}
  5. maps={7027059,7031461,7031006,7031631,7031601,7057033}
  6. admins={Noooooooorr#0000=true}
  7. won={}
  8. movement2=""
  9. speed=18
  10. leftMovement=""
  11. showScore=false
  12. movement={[0]="ارقص",[1]="اضحك",[2]="ابكي",[3]="قبل",[4]="اغضب",[5]="سفق",[6]="نام",[7]="اغمض عينك",[8]="اجلس",[9]="ورق"}
  13. t=0
  14. tt=0
  15. players={}
  16. mice=0
  17. playGame=true
  18.  
  19.  
  20.  
  21.  
  22. function MenuWelcome(name)
  23. ui.addTextArea(200,"<font size='30'><j><p align='center'><b>The Movement <br><n><font size='15'>The Movement مرحبا بك في <br><font size='10'> يجب عليك فعل الحركات التي تكون في المسطيل الذي يكون في الاعلى   <br>  <br> اذا جاوبت اجابة صحيحة تاخد 1 نقطة واحدة  <br> <br>اذا جاوبت اجابة  غير صحيحة فسوف ينقص 2 نقطة <br> <br>ملاحظة:الوقت يسرع في كل أمر", name, 100, 100, 600, 250, 0x05101B, nil, 1,true)
  24. ui.addTextArea(207,"<p align='center'><font size='17'><a href='event:close_menu_welcome'>× ", name, 100, 100, 20, 20, 0xD60000, nil, 0.9,true)
  25. if admins[name] then
  26. ui.addTextArea(201,"<font size='9'><a href='event:map_1'>الكرسمس", name, 550, 260, 50, 20, 0xC3C3C3, admin, 0.8,true)
  27. ui.addTextArea(202,"<font size='9'><a href='event:map_2'>الرعب", name, 480, 260, 50, 20, 0x010101, admin, 0.8,true)
  28. ui.addTextArea(203,"<font size='9'><a href='event:map_3'>الحب", name, 410, 260, 50, 20, 0xBF0000, admin, 0.8,true)
  29. ui.addTextArea(204,"<font size='9'><a href='event:map_4'>قوس قزح", name,340, 260, 50, 20, 0xD04400, admin, 0.8,true)
  30. ui.addTextArea(205,"<font size='9'><a href='event:map_5'>الشاطئ", name,270, 260, 50, 20, 0xFFB900, admin, 0.8,true)
  31. ui.addTextArea(206,"<font size='9'><a href='event:map_6'> الجحيم", name,200, 260, 50, 20, 0xFFE300, admin, 0.8,true)
  32. end
  33. end
  34.  
  35.  
  36. function addData(n)
  37. data[n]={score=0,canPlay=false}
  38. end
  39.  
  40. function eventNewPlayer(n)
  41. addData(n)
  42. MenuWelcome(n)
  43. mice=mice+1
  44. end
  45.  
  46. for n,player in pairs(tfm.get.room.playerList) do
  47. addData(n)
  48. MenuWelcome(n)
  49. mice=mice+1
  50. end
  51.  
  52. for n,player in pairs(players) do
  53. addData(player)
  54. end
  55.  
  56. function Won(n)
  57. for i,won in ipairs(won) do
  58.  if n==won then return true end end return false
  59. end
  60. function Player(n)
  61. for i,players in ipairs(players) do
  62.  if n==players then return true end end return false
  63. end
  64.  
  65.  
  66.  
  67. function eventChatCommand(name,command)
  68.     local args={}
  69.     for s in command:gmatch("%S+") do
  70.         table.insert(args, s)
  71.     end
  72.     args[1]=args[1]:lower()
  73.     if args[1] == "help" then
  74.         ui.addTextArea(200,"<p align='center'><font size='22'><font color='#E50000'>The Movement <br><font color='#FFFFFF'><font size='10'> و تعني الحركات  <br><font size='7'> يجب عليك فقط فعل الحركات التي في اعلى الخريطة ", name, 170, 180, 200, 80, 0x00042A, nil, 0.9,true)
  75.         ui.addTextArea(201,"<p align='center'><font size='17'><a href='event:close_help'>× ", name, 170, 180, 20, 20, 0xD60000, nil, 0.9,true)
  76.     elseif args[1] == "menu" then
  77.         MenuWelcome(n)
  78.     end
  79.     if command:sub(0,2) == "ms" and admins[name] then
  80.         tfm.exec.chatMessage("<rose>"..command:sub(4).." :["..name.."]")
  81.     end
  82. end
  83.  
  84.  
  85. function RandomPlayers()
  86. k={}
  87. mm=0
  88. mn=0
  89. for j,p in pairs(tfm.get.room.playerList) do
  90. if (not Player(j)) then
  91. table.insert(k, j);
  92. mn=mn+1
  93. end end
  94. mm=math.random(1,mn)
  95. return table.concat(k,"",mm,mm)
  96. end
  97.  
  98. if mice <= 4 then
  99. playGame=false
  100. end
  101.  
  102.  
  103.  
  104. function PlayerMaxScore(ttype)
  105. if ttype=="NamePlayerMaxScore" or "ScorePlayerMaxScore" then
  106. maxScore=0
  107. score={}
  108. name=""
  109. local x=0
  110. for n,p in pairs(tfm.get.room.playerList) do table.insert(score,data[n].score); end
  111. for n,p in pairs(score) do x=x+1
  112. if score[x] >= maxScore then maxScore = score[x] end
  113. end
  114. for n,p in pairs(tfm.get.room.playerList) do if data[n].score == maxScore then name = n
  115. end
  116. end
  117. if ttype=="NamePlayerMaxScore" then
  118. return name
  119. elseif ttype=="ScorePlayerMaxScore" then
  120. return maxScore
  121. end -- end ttype
  122. end -- end ttype
  123. end -- end function
  124.  
  125.  
  126. function ColorScore(n)
  127. if data[n].score == PlayerMaxScore("ScorePlayerMaxScore") then
  128. return "<j>"
  129. else
  130. return "<v>"
  131. end
  132. end
  133.  
  134.  
  135. function eventLoop(timePassed,timeLeft)
  136. if playGame then
  137. t=t+1
  138. tt=tt+1
  139. if t==5 then
  140. ui.addTextArea(1,"<font size='90'>3", nil, 400, 10, 900, 900, 0x0, nil, 1)
  141. elseif t==8 then
  142. ui.addTextArea(1,"<font size='90'>2", nil, 400, 10, 900, 900, 0x0, nil, 1)
  143. elseif t==11 then
  144. ui.addTextArea(1,"<font size='90'>1", nil, 400, 10, 900, 900, 0x0, nil, 1)
  145. elseif t==14 then
  146. k=math.random(0,#movement)
  147. if leftMovement == movement[k] then
  148. if k == 0 then
  149. movement2=movement[k+1]
  150. elseif k == 9 then
  151. movement2=movement[k-1]
  152. else
  153. movement2=movement[k+1]
  154. end
  155. else
  156. movement2=movement[k]
  157. end
  158. leftMovement=movement2
  159. showScore=true
  160. for n in pairs (tfm.get.room.playerList) do
  161. data[n].canPlay=true
  162. end
  163. ui.addTextArea(1,"<font size='50'><p align='center'>الامر:"..movement2.." ", nil, 0, 20, 800, 800, 0x0, nil, 1)
  164. elseif t==speed then
  165. for n in pairs (tfm.get.room.playerList) do
  166. data[n].canPlay=false
  167. if not Won(n) and Player(n) then
  168. if data[n].score > 0 then
  169. if data[n].score == 1 then
  170. data[n].score=data[n].score-1
  171. else
  172. data[n].score=data[n].score-2
  173. end
  174. end
  175. end
  176. end
  177. won={}
  178. movement2=""
  179. t=13
  180. if speed >= 18 then
  181. speed=speed-1
  182. else
  183. speed=18
  184. end
  185. end
  186. if showScore then
  187. ui.addTextArea(500,"<p align='center'><font size='38'>"..ColorScore(players[1])..data[players[1]].score,nil, 508, 120, 130, 50, 0x000001, nil, 0,true)
  188. ui.addTextArea(501,"<p align='center'><font size='38'>"..ColorScore(players[4])..data[players[4]].score,nil, 655, 120, 130, 50, 0x000001, nil, 0,true)
  189. ui.addTextArea(502,"<p align='center'><font size='38'>"..ColorScore(players[3])..data[players[3]].score,nil, 655, 260, 130, 50, 0x000001, nil, 0,true)
  190. ui.addTextArea(503,"<p align='center'><font size='38'>"..ColorScore(players[2])..data[players[2]].score,nil, 508, 260, 130, 50, 0x000001, nil, 0,true)
  191. end
  192. if alive == 0 or timeLeft < 1000 then
  193. nextRound();
  194. end
  195. else
  196. if mice>= 4 then
  197. tfm.exec.newGame(maps[math.random(#maps)]);
  198. end
  199. end
  200. end
  201.  
  202.  
  203. function eventNewGame()
  204. if playGame and PlayerMaxScore("ScorePlayerMaxScore") > 0 then
  205. tfm.exec.chatMessage("بالجولة<ch> "..PlayerMaxScore("NamePlayerMaxScore").." <j>فاز")
  206. end
  207. if mice>= 4 then
  208. players={}
  209. player1=RandomPlayers()
  210. table.insert(players, player1);
  211. player2=RandomPlayers()
  212. table.insert(players, player2);
  213. player3=RandomPlayers()
  214. table.insert(players, player3);
  215. player4=RandomPlayers()
  216. table.insert(players, player4);
  217. playGame=true
  218. tfm.exec.movePlayer(players[1],570,200)
  219. tfm.exec.movePlayer(players[2],570,350)
  220. tfm.exec.movePlayer(players[3],700,350)
  221. tfm.exec.movePlayer(players[4],700,200)
  222. won={}
  223. movement2=""
  224. leftMovement=""
  225. t=0
  226. tt=0
  227. ui.setMapName ("The Movements")
  228. speed=18
  229. showScore=false
  230. alive=0
  231. for id, k in pairs({500,501,502,503}) do
  232. ui.removeTextArea(k,nil)
  233. end
  234. for n in pairs (tfm.get.room.playerList) do
  235. data[n].canPlay=false
  236. data[n].score=0
  237. end
  238. for name,player in pairs(tfm.get.room.playerList) do
  239.     alive=alive+1
  240. end
  241. else
  242. playGame=false
  243. ui.addTextArea(1,"<font size='50'><p align='center'>يجب ان يتوفر 4 لاعبين على الاقل", nil, 10, 40, 800, 800, 0x0, nil, 1)
  244. end
  245. end
  246.  
  247. function removeMenu(name)
  248. for id, k in pairs({200,201,202,203,204,205,206,207}) do
  249. ui.removeTextArea(k, name)
  250. end
  251. end
  252.  
  253. function eventTextAreaCallback(id,name,callback)
  254. if callback=="close_help" then
  255. ui.removeTextArea(200, name)
  256. ui.removeTextArea(201, name)
  257. elseif callback=="map_2" then
  258. tfm.exec.newGame(maps[1])
  259. removeMenu(name)
  260. elseif callback=="map_3" then
  261. tfm.exec.newGame(maps[2])
  262. removeMenu(name)
  263. elseif callback=="map_4" then
  264. tfm.exec.newGame(maps[3])
  265. removeMenu(name)
  266. elseif callback=="map_5" then
  267. tfm.exec.newGame(maps[4])
  268. removeMenu(name)
  269. elseif callback=="map_6" then
  270. tfm.exec.newGame(maps[5])
  271. removeMenu(name)
  272. elseif callback=="close_menu_welcome" then
  273. removeMenu(name)
  274. end
  275. end
  276.  
  277. function nextRound()
  278.     tfm.exec.newGame(maps[math.random(#maps)]);
  279. end
  280.  
  281. function eventEmotePlayed(name,id)
  282. if id >= 0 and id <= 9 and data[name].canPlay then
  283. if movement2~=movement[id] then
  284. if data[name].score > 0 then
  285. if data[name].score == 1 then
  286. data[name].score=data[name].score-1
  287. else
  288. data[name].score=data[name].score-2
  289. end
  290. end
  291. data[name].canPlay=false
  292. else
  293. table.insert(won,name);
  294. data[name].canPlay=false
  295. data[name].score=data[name].score+1
  296. end
  297. end
  298. if data[name].score >= 30 then
  299. tfm.exec.giveCheese(name)
  300. tfm.exec.playerVictory(name)
  301. tfm.exec.setGameTime (5)
  302. end
  303. end
  304.  
  305. function eventNewPlayer(n)
  306. tfm.exec.respawnPlayer(n)
  307. end
  308.  
  309. function eventPlayerDied(n)
  310. if (not Player(n)) then
  311. tfm.exec.respawnPlayer(n)
  312. end
  313. end
  314.  
  315. function eventPlayerLeft(name)
  316. mice=mice-1
  317. end
  318.  
  319.  
  320.  
  321.  
  322. tfm.exec.newGame(maps[math.random(#maps)]);
  323.  
  324. -----Turkitutu Noooooooorr صنعت من قبل
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement