Facebook
From burak, 4 Years ago, written in Lua.
Embed
Download Paste or View Raw
Hits: 170
  1. map1='mapcode'
  2. map2='mapcode'
  3. map3='mapcode'
  4. map4='mapcode'
  5. map5='mapcode'
  6. map6='mapcode'
  7.  
  8. players={}
  9. --maps={map1,map2,map3,map4,map5,7704767}
  10. maps={map6} --test edilecek map (başındaki "--" işaretini kaldır)
  11.  
  12. function eventPlayerDied(name)
  13. tfm.exec.respawnPlayer(name)
  14. tfm.exec.movePlayer(name,players[name].x,players[name].y)
  15. end
  16.  
  17. function eventNewPlayer(name)
  18. players[name]={x=x, y=y, win=1}
  19. end
  20.  
  21. for name,player in pairs(tfm.get.room.playerList) do
  22. eventNewPlayer(name)
  23. tfm.exec.bindKeyboard(name, 69, true, true)
  24. end
  25.  
  26.  
  27. function returnMouseCount()
  28.  count=0
  29.  for player in pairs(tfm.get.room.playerList) do
  30.   if(tfm.get.room.playerList[player].isDead==false) then
  31.    count=count+1
  32.   elseif(players[player].id) then
  33.    count=count+1
  34.   end
  35.  end
  36.  return count
  37. end
  38.  
  39. function eventLoop(time,remaining)
  40.  returnMouseCount()
  41.  if(remaining<=0 or count==0) then
  42.     newRound()
  43.   end
  44.     playerList=tfm.get.room.playerList
  45. end
  46.  
  47. function newRound()
  48.    tfm.exec.setGameTime(483)
  49.   tfm.exec.newGame(maps[math.random(#maps)])
  50. end
  51.  
  52. function main()
  53.   tfm.exec.disableAfkDeath(true)
  54.   tfm.exec.disableAutoNewGame(true)
  55.   tfm.exec.disableAutoTimeLeft(true)
  56.   tfm.exec.disableAutoShaman(true)
  57.   tfm.exec.newGame(maps[math.random(#maps)])
  58.   tfm.exec.setGameTime(483)
  59.   for name,player in pairs(tfm.get.room.playerList) do
  60.     eventNewPlayer(name)
  61.   end
  62. end
  63.  
  64. main()
  65.  
  66.  
  67. function eventKeyboard(name, key, down, x, y)
  68. if tfm.get.room.xmlMapInfo.mapCode == 7704767 then
  69. if y>=700  then
  70. if players[name].win==1 then
  71. players[name].x=300 players[name].y=50
  72. end
  73. end
  74. if y>=700 then
  75. if players[name].win==2 then
  76. players[name].x=570 players[name].y=50
  77. end
  78. end
  79. if y>=700 then
  80. if players[name].win==3 then
  81. players[name].x=800 players[name].y=50
  82. end
  83. end
  84. if y>=700 then
  85. if players[name].win==4 then
  86. players[name].x=1140 players[name].y=50
  87. end
  88. end
  89. if y>=700 then
  90. if players[name].win==5 then
  91. players[name].x=1420 players[name].y=50
  92. end
  93. end
  94. if y>=700 then
  95. if players[name].win==6 then
  96. tfm.exec.giveCheese(name)
  97. end
  98. end
  99.  
  100.  
  101. tfm.exec.respawnPlayer(name)
  102. if y>=700 then
  103. players[name].win=players[name].win+1
  104. tfm.exec.movePlayer(name,players[name].x,players[name].y)
  105. end
  106. end
  107.  
  108.  
  109. --ornek kod CP
  110. if tfm.get.room.xmlMapInfo.xml == map5 then
  111. if y>=2750  then
  112. if players[name].win==1 then
  113. players[name].x=300 players[name].y=50
  114. end
  115. end
  116. if y>=2750 then
  117. if players[name].win==2 then
  118. players[name].x=570 players[name].y=50
  119. end
  120. end
  121. if y>=2750 then
  122. if players[name].win==3 then
  123. players[name].x=830 players[name].y=50
  124. end
  125. end
  126. if y>=2750 then
  127. if players[name].win==4 then
  128. players[name].x=1140 players[name].y=50
  129. end
  130. end
  131. if y>=2750 then
  132. if players[name].win==5 then
  133. players[name].x=1420 players[name].y=50
  134. end
  135. end
  136. if y>=2750 then
  137. if players[name].win==6 then
  138. tfm.exec.giveCheese(name)
  139. end
  140. end
  141.  
  142. if y>=2750 then
  143. players[name].win=players[name].win+1
  144. tfm.exec.movePlayer(name,players[name].x,players[name].y)
  145. end
  146. end
  147.  
  148. --uzun map
  149.  
  150. if tfm.get.room.xmlMapInfo.xml == map6 then
  151.  
  152.  
  153. if players[name].win==1 then
  154. if y>=20000  then
  155. players[name].win=players[name].win+1
  156. tfm.exec.movePlayer(name,150,20300)
  157. players[name].x=150 players[name].y=20300
  158. end
  159. end
  160.  
  161.  
  162.  
  163. if players[name].win==2 then
  164. print("hata nerde")
  165. if y>=40000 then
  166. players[name].win=players[name].win+1
  167. tfm.exec.movePlayer(name,150,40300)
  168. players[name].x=150 players[name].y=40300
  169. end
  170. end
  171.  
  172.  
  173. if players[name].win==3 then
  174. print("hata ananın amında")
  175. if y>=60000 then
  176. players[name].win=players[name].win+1
  177. tfm.exec.movePlayer(name,150,60300)
  178. players[name].x=150 players[name].y=60300
  179. end
  180. end
  181.  
  182. if players[name].win==4 then
  183. if y>=80000 then
  184. players[name].win=players[name].win+1
  185. tfm.exec.movePlayer(name,150,80300)
  186. players[name].x=150 players[name].y=80300
  187. end
  188. end
  189.  
  190. if players[name].win==5 then
  191. if y>=100000 then
  192. players[name].win=players[name].win+1
  193. tfm.exec.movePlayer(name,150,100300)
  194. players[name].x=150 players[name].y=100300
  195. end
  196. end
  197.  
  198. if players[name].win==6 then
  199. if y>=120000 then
  200. players[name].win=players[name].win+1
  201. tfm.exec.movePlayer(name,150,120300)
  202. players[name].x=150 players[name].y=120300
  203. end
  204. end
  205.  
  206. if players[name].win==7 then
  207. if y>=140000 then
  208. players[name].win=players[name].win+1
  209. tfm.exec.movePlayer(name,150,140300)
  210. players[name].x=150 players[name].y=140300
  211. end
  212. end
  213.  
  214. if players[name].win==8 then
  215. if y>=160000 then
  216. players[name].win=players[name].win+1
  217. tfm.exec.movePlayer(name,150,160300)
  218. players[name].x=150 players[name].y=160300
  219. end
  220. end
  221.  
  222. if players[name].win==9 then
  223. if y>=180000 then
  224. players[name].win=players[name].win+1
  225. tfm.exec.movePlayer(name,150,180300)
  226. players[name].x=150 players[name].y=180300
  227. end
  228. end
  229.  
  230. if players[name].win==10 then
  231. if y>=200000 then
  232. players[name].win=players[name].win+1
  233. tfm.exec.movePlayer(name,150,200300)
  234. players[name].x=150 players[name].y=200300
  235. end
  236. end
  237.  
  238. if players[name].win==11 then
  239. if y>=220000 then
  240. players[name].win=players[name].win+1
  241. tfm.exec.movePlayer(name,150,220300)
  242. players[name].x=150 players[name].y=220300
  243. end
  244. end
  245.  
  246. if players[name].win==12 then
  247. if y>=22120 then
  248. players[name].win=players[name].win+1
  249. tfm.exec.giveCheese(name)
  250. end
  251. end
  252. end
  253. end
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261. function eventPlayerGetCheese(name)
  262. tfm.exec.playerVictory(name)
  263. end
  264.        
  265.  
  266. function eventPlayerWon(name)
  267.  players[name].x=nil
  268.  players[name].y=nil
  269.  players[name].id=nil
  270.  players[name].win=1
  271. end
  272.