Advertisement
podoko_Lua

PlayMap [v0.5]

Jan 14th, 2014
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.03 KB | None | 0 0
  1. liste = {}
  2.  
  3. liste["P1"] =   {"125204","149514"      }
  4. liste["P3"] =   {"113156","124000"      }
  5. liste["P4"] =   {"120806","126092"      }
  6. liste["P5"] =   {"129420" , "154859"    }
  7. liste["P6"] =   {"49101" , "60303"      }
  8. liste["P7"] =   {"129835" , "142101"    }
  9. liste["P8"] =   {"125204" , "149514"    }
  10. liste["P9"] =   {"121024" , "134300"    }
  11. liste["P10"] =  {"276534" , "279689"    }
  12. liste["P11"] =  {   "258972" , "334445" }
  13. liste["P13"] =  {   "155517" , "156510" }
  14. liste["P17"] =  {   "112790" , "114122" }
  15. liste["P18"] =  {   "767142" , "1299415"}
  16.  
  17.  
  18.  
  19.  
  20. P =     { "P1","P3","P4","P5","P6","P7","P8","P9","P10","P11","P13","P17","P18" }
  21.  
  22. currentP = "P1"
  23.  
  24.  
  25. time =      {   P1 = 120, P3 = 360, P4 = 120, P5 = 120, P6 = 120, P7 = 63, P8 = 120, P9 = 120, P10 = 120, P11 = 120,P13 = 360, P17 = 63, P18 = 120, P32 = 120}
  26. timeLeft =  {   P1 = false, P3 = true, P4 = false, P5 = false, P6 = false, P7 = false, P8 = false, P9 = false, P10 = false, P11 = true, P13 = true, P17 = false, P18 = true, P32 = false}
  27. shaman =    {   P1 = false, P3 = true, P4 = false, P5 = false, P6 = false, P7 = true, P8 = false, P9 = false, P10 = false, P11 = true, P13 = true, P17 = true, P18 = true, P32 = false}
  28.  
  29.  
  30.  
  31. playerList = {}
  32. alive = 0
  33.  
  34. tfm.exec.disableAutoNewGame ( true )
  35.  
  36. print(time[currentP])
  37.  
  38.  
  39. for name, v in pairs ( tfm.get.room.playerList ) do
  40.        
  41.         table.insert ( playerList, name )
  42.  
  43. end
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50. function launchGame ( )
  51.        
  52.             currentP = P [math.random ( #P )]
  53.             nextMap = "@".. liste [currentP] [math.random ( #liste[currentP] )]
  54.  
  55.  
  56.             tfm.exec.disableAutoShaman ( shaman [currentP] )
  57.            
  58.  
  59. print(nextMap)
  60.  
  61.  
  62.  
  63.             tfm.exec.newGame ( nextMap )
  64.  
  65. end
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94. function eventLoop (past, remaining)
  95.  
  96.         if remaining < 500 or alive == 0 then
  97.             launchGame ( )
  98.         end
  99.  
  100. end
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107. function eventNewGame ( )
  108.        
  109.  
  110.         alive = #playerList
  111.  
  112.         tfm.exec.setGameTime( time[currentP] )
  113.         tfm.exec.disableAutoTimeLeft ( timeLeft[currentP] )
  114.  
  115. end
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122. function eventPlayerDied ( name )
  123.  
  124.         if currentP == "P3" or currentP == "P13" then
  125.             tfm.exec.respawnPlayer ( name )
  126.  
  127.         else
  128.             alive = alive - 1
  129.  
  130.         end
  131.  
  132. end
  133.  
  134.  
  135. function eventPlayerRespawn ( name )
  136.        
  137.         alive = alive + 1
  138.         print (alive)
  139.  
  140. end
  141.  
  142.  
  143.  
  144.  
  145. function eventPlayerWon ( name )
  146.  
  147.         if currentP == "P18" then
  148.             tfm.exec.setGameTime ( 20 )
  149.            
  150.         elseif currentP == "P13" or currentP == "P3" then
  151.             tfm.exec.respawnPlayer ( name )
  152.            
  153.         end
  154.  
  155.         alive = alive - 1
  156.  
  157.     print(alive)
  158. end
  159.  
  160.  
  161. function eventPlayerVampire ( name )
  162.  
  163.         alive = alive - 1
  164.  
  165. end
  166.  
  167.  
  168.  
  169.  
  170. function eventNewPlayer ( name )
  171.        
  172.         table.insert ( playerList, name )
  173.         print ( name.. " vient d'entrer dans le salon." )
  174.  
  175.         if currentP == "P3" or currentP == "P13" then
  176.             tfm.exec.respawnPlayer ( name )
  177.         end
  178.        
  179. end
  180.  
  181.  
  182.  
  183. function eventPlayerLeft ( name )
  184.  
  185.         for k, v in ipairs ( playerList ) do
  186.  
  187.             if playerList[k] == name then
  188.                 print(playerList[k])
  189.                 table.remove ( playerList, k )
  190.                
  191.                 print ( name.. " vient de quitter le salon." )
  192.                 break
  193.                
  194.             end
  195.         end
  196.  
  197.     end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement