Advertisement
Guest User

Bushmeister's

a guest
Dec 15th, 2014
417
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.27 KB | None | 0 0
  1. admin={"Bushmeister"}
  2. maps={"@5017995","@5017996","@5017997","@5017998","@5017999"}
  3. isRandom=false
  4. isShaman=true
  5. mNumber=1
  6. mapss=table.maxn(maps)
  7. tfm.exec.disableAutoNewGame (true)
  8. function eventChatCommand(playerName, message)
  9. local args={}
  10.     for _,recv in pairs (admin) do
  11.         if (recv == playerName) then
  12.             for argument in message:gmatch("[^%s]+") do
  13.                 table.insert(args,argument)
  14.             end
  15.             if args[1]=="insert" and args[2]~=nil then
  16.                 table.insert(maps,args[2])
  17.                 mapss=table.maxn(maps)
  18.                 print("<J>Текущий список карт:<VI>"..table.concat(maps,","))
  19.                 print("<J>Всего карт:<R>"..mapss)
  20.             end
  21.             if args[1]=="delete" and args[2]:sub(0,1)=="@" then
  22.                 table.rem(maps,args[2])
  23.                 print("<J>Текущий список карт:<VI>"..table.concat(maps,","))
  24.                 print("<J>Всего карт:<R>"..mapss)
  25.             end
  26.             if message=="start" then
  27.                 newGame()
  28.             end
  29.             if args[1]=="random" then
  30.                 isRandom=true
  31.                 print("<J>Тип воспроизведения карт: <R>Random")
  32.             elseif args[1]=="normal" then
  33.                 isRandom=false
  34.                 print("<J>Тип воспроизведения карт: <R>Normal")
  35.                 --print(mNumber)
  36.                 tfm.exec.newGame(maps[mNumber])
  37.             end
  38.             if message=="noshaman" then
  39.                 tfm.exec.disableAutoShaman(true)
  40.             elseif message=="shaman" then
  41.                 tfm.exec.disableAutoShaman(false)
  42.             end
  43.             if args[1]:sub(0,1)=="@" then
  44.                 tfm.exec.setUIMapName(args[1])
  45.             end
  46.             if args[1]:sub(0,4)=="time" and args[2]~=nil then
  47.                 tfm.exec.setGameTime(args[2])
  48.             end
  49.         end
  50.     end
  51. end
  52. function newGame()
  53.     if isRandom==true then
  54.         tfm.exec.newGame(maps[math.random(#maps)])
  55.     else
  56.     --[[print("isRandom==false")
  57.     print("Next map is:"..maps[mNumber])]]
  58.     tfm.exec.newGame(maps[mNumber])
  59.     end
  60. end
  61. function eventLoop(a,timeLeft)
  62. if timeLeft<=2 then
  63. newGame()
  64. end
  65. end
  66.  
  67. function eventNewGame()
  68. --[[print("mNumber="..mNumber)
  69. print("mapss="..mapss)]]
  70.     if isRandom==false then
  71.         if mNumber~=mapss+1 then
  72.             mNumber=mNumber+1
  73.         end
  74.         if mNumber==mapss+1 then
  75.             mNumber=1
  76.         end
  77.     end
  78. end
  79.  
  80. function eventPlayerWon(playerName)
  81.                 local playersAlive = 0;
  82.         local winner;
  83.         for player in pairs(tfm.get.room.playerList) do
  84.                 if not tfm.get.room.playerList[player].isDead then
  85.                         playersAlive = playersAlive + 1;
  86.                         winner = player;
  87.                 end
  88.         end
  89.         if (playersAlive == 1) then
  90.                 tfm.exec.setGameTime (10);
  91.         elseif (playersAlive ==0) then
  92.                 newGame()
  93.         end
  94. end
  95. function eventPlayerDied (playerName)
  96. local playersAlive = 0;
  97.         local winner;
  98.         for player in pairs(tfm.get.room.playerList) do
  99.                 if not tfm.get.room.playerList[player].isDead then
  100.                         playersAlive = playersAlive + 1;
  101.                         winner = player;
  102.                 end
  103.         end
  104.         if (playersAlive == 1) then
  105.                 tfm.exec.setGameTime (10);
  106.         elseif (playersAlive ==0) then
  107.                 newGame()
  108.         end
  109. end
  110.  
  111. function table.rem(tab,value)
  112. function table.indexof(t,val)
  113. for k,v in ipairs(t) do
  114. if v == val then return k end
  115. end
  116. end
  117. table.remove(tab,table.indexof(tab,value))
  118. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement