Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- admin={"Bushmeister"}
- maps={"@5017995","@5017996","@5017997","@5017998","@5017999"}
- isRandom=false
- isShaman=true
- mNumber=1
- mapss=table.maxn(maps)
- tfm.exec.disableAutoNewGame (true)
- function eventChatCommand(playerName, message)
- local args={}
- for _,recv in pairs (admin) do
- if (recv == playerName) then
- for argument in message:gmatch("[^%s]+") do
- table.insert(args,argument)
- end
- if args[1]=="insert" and args[2]~=nil then
- table.insert(maps,args[2])
- mapss=table.maxn(maps)
- print("<J>Текущий список карт:<VI>"..table.concat(maps,","))
- print("<J>Всего карт:<R>"..mapss)
- end
- if args[1]=="delete" and args[2]:sub(0,1)=="@" then
- table.rem(maps,args[2])
- print("<J>Текущий список карт:<VI>"..table.concat(maps,","))
- print("<J>Всего карт:<R>"..mapss)
- end
- if message=="start" then
- newGame()
- end
- if args[1]=="random" then
- isRandom=true
- print("<J>Тип воспроизведения карт: <R>Random")
- elseif args[1]=="normal" then
- isRandom=false
- print("<J>Тип воспроизведения карт: <R>Normal")
- --print(mNumber)
- tfm.exec.newGame(maps[mNumber])
- end
- if message=="noshaman" then
- tfm.exec.disableAutoShaman(true)
- elseif message=="shaman" then
- tfm.exec.disableAutoShaman(false)
- end
- if args[1]:sub(0,1)=="@" then
- tfm.exec.setUIMapName(args[1])
- end
- if args[1]:sub(0,4)=="time" and args[2]~=nil then
- tfm.exec.setGameTime(args[2])
- end
- end
- end
- end
- function newGame()
- if isRandom==true then
- tfm.exec.newGame(maps[math.random(#maps)])
- else
- --[[print("isRandom==false")
- print("Next map is:"..maps[mNumber])]]
- tfm.exec.newGame(maps[mNumber])
- end
- end
- function eventLoop(a,timeLeft)
- if timeLeft<=2 then
- newGame()
- end
- end
- function eventNewGame()
- --[[print("mNumber="..mNumber)
- print("mapss="..mapss)]]
- if isRandom==false then
- if mNumber~=mapss+1 then
- mNumber=mNumber+1
- end
- if mNumber==mapss+1 then
- mNumber=1
- end
- end
- end
- function eventPlayerWon(playerName)
- local playersAlive = 0;
- local winner;
- for player in pairs(tfm.get.room.playerList) do
- if not tfm.get.room.playerList[player].isDead then
- playersAlive = playersAlive + 1;
- winner = player;
- end
- end
- if (playersAlive == 1) then
- tfm.exec.setGameTime (10);
- elseif (playersAlive ==0) then
- newGame()
- end
- end
- function eventPlayerDied (playerName)
- local playersAlive = 0;
- local winner;
- for player in pairs(tfm.get.room.playerList) do
- if not tfm.get.room.playerList[player].isDead then
- playersAlive = playersAlive + 1;
- winner = player;
- end
- end
- if (playersAlive == 1) then
- tfm.exec.setGameTime (10);
- elseif (playersAlive ==0) then
- newGame()
- end
- end
- function table.rem(tab,value)
- function table.indexof(t,val)
- for k,v in ipairs(t) do
- if v == val then return k end
- end
- end
- table.remove(tab,table.indexof(tab,value))
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement