GogoTfm

runnn dadadadada

Mar 6th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.13 KB | None | 0 0
  1. mapList = {"@7577773,@0" }
  2.  
  3.  
  4.  
  5. round = 0;
  6. alive = 0;
  7. rank = 1;
  8.  
  9. function main()
  10. tfm.exec.disableAllShamanSkills (true)
  11.  
  12. tfm.exec.disableAutoNewGame(true)
  13. tfm.exec.disableAutoScore(true)
  14. for name in pairs(tfm.get.room.playerList) do
  15. tfm.exec.setPlayerScore(name, 0)
  16. end
  17. launchGame()
  18. end
  19.  
  20.  
  21. function launchGame()
  22. tfm.exec.setGameTime(1)
  23. tfm.exec.newGame(mapList[math.random(#mapList)])
  24. end
  25.  
  26. function eventChatCommand(name, command)
  27. if command=='mort' then tfm.exec.killPlayer(name) end
  28. end
  29.  
  30.  
  31. function eventNewGame()
  32. tfm.exec.setGameTime(120)
  33.  
  34. rank = 1;
  35. alive = 0;
  36. for name in pairs(tfm.get.room.playerList) do alive = alive+1 end
  37.  
  38.  
  39. round=round+1
  40. if round > 10 then
  41. for name in pairs(tfm.get.room.playerList) do
  42. tfm.exec.setPlayerScore(name, 0)
  43. end
  44. round = 1
  45. end
  46.  
  47. tfm.exec.setUIShamanName("<N><font color='#00C8E2'>Round number : <CH>"..round.."/10")
  48. end
  49.  
  50.  
  51. function eventLoop(past, left)
  52. if left<0 then tfm.exec.newGame(mapList[math.random(#mapList)]) end
  53. end
  54.  
  55.  
  56.  
  57. function eventPlayerLeft(name)
  58. alive = alive-1
  59. if alive == 0 then tfm.exec.setGameTime(0) end
  60. end
  61.  
  62.  
  63. function eventPlayerWon(name)
  64. tfm.exec.setPlayerScore(name, rank==1 and 4 or rank==2 and 3 or rank==3 and 2 or 1, true)
  65. rank = rank+1
  66. alive = alive-1
  67. if alive == 0 then tfm.exec.setGameTime(0) end 
  68. end
  69.  
  70.  
  71. main()
  72. function eventNewGame()
  73. shaman=nil
  74. for name,player in pairs(tfm.get.room.playerList) do
  75. if(tfm.get.room.playerList[name].isShaman) then
  76. shaman=name
  77. print(shaman.." just stole the cheese! CATCH HER!")
  78. tfm.exec.giveCheese(shaman)
  79. end
  80. end
  81. if(shaman==nil) then
  82. print('No shaman found!')
  83. end
  84. end
  85.  
  86. function eventLoop(ct,cr)
  87. if(shaman~=nil) and not tfm.get.room.playerList[shaman].isDead then
  88. local shamanx=tfm.get.room.playerList[shaman].x
  89. local shamany=tfm.get.room.playerList[shaman].y
  90. for name,player in pairs(tfm.get.room.playerList) do
  91. if not tfm.get.room.playerList[name].isShaman then
  92. x=tfm.get.room.playerList[name].x
  93. y=tfm.get.room.playerList[name].y
  94. if x>shamanx-30 and x<shamanx+30 and y>shamany-30 and y<shamany+30 then
  95. tfm.exec.giveCheese(name)
  96. end
  97. end
  98. end
  99. end
  100. end
  101. local data = {}
  102.  
  103. function eventNewPlayer(name)
  104. if not data[name] then
  105. data[name]={}
  106. data[name].points = 0
  107. data[name].morts = 0
  108. end
  109. end
  110.  
  111. for i, command in ipairs ({"ملف","p","stats","profile"}) do
  112. system.disableChatCommandDisplay(command,true)
  113. end
  114.  
  115. for name, player in pairs(tfm.get.room.playerList) do
  116. eventNewPlayer(name)
  117. end
  118.  
  119. function eventPlayerDied(name)
  120.     alive = alive-1
  121.     if alive == 0 then tfm.exec.setGameTime(0) end    
  122.     data[name].morts = data[name].morts+1
  123.     print(name.." لقد مات اللاعب "..data[name].morts.." موت")
  124. end
  125.  
  126. function eventPlayerWon(name)
  127. data[name].points = data[name].points+1
  128. print(name.." لقد فاز اللاعب "..data[name].points.." نقاط")
  129. end
  130.  
  131. function eventTextAreaCallback(id,name,cb)
  132. if cb=='cperfil' then
  133. removePerfil(name)
  134. end
  135. end
  136.  
  137. function eventChatCommand(name,command)
  138. local args={}
  139. for word in command:gmatch("[^%s]+") do
  140. table.insert(args, word)
  141. end
  142. if args[1] == "" or args[1] == "" or args[1] == "p" or args[1]=="profile" and data[capitalize(args[2])] then
  143. getPerfil(name, name)
  144. end
  145. end
  146.  
  147. function getPerfil(n,to)
  148. ui.addTextArea(2,"<br><bl><font size='13' color='#00F5F5'>عدد مرات الفوز: <g>"..data[n].points.."<br><bl><font color='#00F5F5'>عدد مرات الموت: <g>"..data[n].morts.."",to,300,190,260,nil,0x302d2d,0xff0000,nil,true)
  149. ui.addTextArea(3,"<p align='center'><font size='17'><v>profile: <n>"..n.."",to,300,170,260,nil,0x302d2d,0xbd0000,nil,true)
  150. ui.addTextArea(4,"",to,543,170,13,13,0xeb0000,0x00c9b5,nil,true)
  151. ui.addTextArea(5,"<font size='15' color='#1C3C41'><b><a href='event:cperfil'><font color='#00F5F5'>C",to,542,166,nil,nil,"0","0",nil,true)
  152. end
  153.  
  154. function removePerfil(name)
  155. ui.removeTextArea(2,name)
  156. ui.removeTextArea(3,name)
  157. ui.removeTextArea(4,name)
  158. ui.removeTextArea(5,name)
  159.  
  160. end
  161.  
  162. function capitalize(word)
  163. if word then
  164. if word:find("+") then
  165. return string.upper(word:sub(1,2)) .. string.lower (word:sub(3));
  166. else
  167. return string.upper(word:sub(1,1)) .. string.lower (word:sub(2));  
  168. end
  169. end
  170. end
Advertisement
Add Comment
Please, Sign In to add comment