Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- map={}
- queue={}
- skip={}
- roomods={
- "Fxie",
- "Begentle",
- "Lemodile"
- }
- blacklist={
- "Chrisamgad",
- "Flyingpizza",
- "Steelyknife",
- "Porker",
- "Juliomense"
- }
- bannedmaps={
- "@1700617",
- "@4203135"
- }
- tfm.exec.disableAutoNewGame(true)
- function eventLoop(time,remaining)
- if time>15000 and map.vampire then
- map.vampire=nil
- local top,target=0
- for name,player in pairs(tfm.get.room.playerList) do
- if player.score>=top then
- top=player.score
- target=name
- end
- end
- tfm.exec.setVampirePlayer(target)
- elseif remaining<=500 then
- map=queue[1]
- tfm.exec.setGameTime(5)
- if map and not blacklist[map.by] and not bannedmaps[map.code] then
- tfm.exec.disableAutoShaman(map.type=="racing" or map.type=="bootcamp" or map.type=="vampire")
- tfm.exec.disableAutoTimeLeft(map.type=="bootcamp")
- tfm.exec.newGame(map.code)
- if map.retry then
- map.retry=nil
- table.remove(queue,1)
- else
- map.retry=true
- end
- else
- map={}
- tfm.exec.disableAutoShaman(false)
- tfm.exec.disableAutoTimeLeft(false)
- tfm.exec.newGame("#1")
- end
- end
- end
- function eventNewGame()
- skip={}
- if map.retry then
- table.remove(queue,1)
- end
- if map.type=="bootcamp" then
- tfm.exec.setGameTime(3*60)
- elseif map.type=="vampire" then
- map.vampire=true
- end
- if map.code then
- tfm.exec.chatMessage("<N>Playing <VP>"..map.code.."<N> by <VP>"..map.by)
- end
- end
- function eventNewPlayer(name)
- tfm.exec.chatMessage("<VP>Welcome to <N>"..tfm.get.room.name.."\n<T>You can test your map by typing <N>!test @code",name)
- end
- function eventPlayerDied(name)
- if map.type=="bootcamp" then
- tfm.exec.respawnPlayer(name)
- else
- for name,player in pairs(tfm.get.room.playerList) do
- if not player.isDead then
- return
- end
- end
- eventLoop(0,0)
- end
- end
- function eventPlayerWon(name)
- eventPlayerDied(name)
- end
- function eventPlayerVampire(name)
- for name,player in pairs(tfm.get.room.playerList) do
- if not player.isVampire then
- return
- end
- end
- eventLoop(0,0)
- end
- function eventChatCommand(name,message)
- if blacklist[name] then
- tfm.exec.chatMessage("You've been blacklisted.",name)
- return
- end
- local args={}
- for arg in message:gmatch("[^%s]+") do
- table.insert(args,arg:lower())
- end
- local mod=roomods[name]
- if args[1]=="i" then
- message=message:match("%s(.*)") or ""
- eventChatCommand(name,message~="" and message or "help")
- elseif args[1]=="help" then
- eventNewPlayer(name)
- elseif args[1]=="maps" then
- if #queue~=0 then
- local maplist={}
- for i,map in ipairs(queue) do
- local item=i..". "..map.code.." by "..map.by
- if map.type then
- item=item.." ("..map.type..")"
- end
- table.insert(maplist,item)
- end
- tfm.exec.chatMessage(table.concat(maplist,"\n"),name)
- else
- tfm.exec.chatMessage("No maps in queue!",name)
- end
- elseif args[1]=="die" or args[1]=="mort" then
- tfm.exec.killPlayer(name)
- elseif args[1]=="test" and args[2] then
- args[2]=tonumber(args[2]:match("%d+"))
- if not args[2] then
- tfm.exec.chatMessage("That isn't a map!",name)
- return
- end
- args[2]="@"..args[2]
- if bannedmaps[args[2]] then
- blacklist[name]=true
- tfm.exec.chatMessage("You have been banned.",name)
- return
- end
- for i,map in ipairs(queue) do
- if map.by==name then
- tfm.exec.chatMessage("You already have a map in queue!",name)
- return
- elseif map.code==args[2] then
- tfm.exec.chatMessage("That map is already queued!",name)
- return
- end
- end
- table.insert(queue,{
- by=name,
- code=args[2],
- type=args[3]
- })
- tfm.exec.chatMessage(args[2].." added to queue! It will play in "..#queue.." rounds.",name)
- elseif args[1]=="skip" then
- local players=0
- if not (mod and args[2]=="now") then
- for i,who in ipairs(skip) do
- if who==name then
- tfm.exec.chatMessage("You already voted to skip this map!",name)
- return
- end
- end
- table.insert(skip,name)
- tfm.exec.chatMessage("Your vote has been added.",name)
- players=0
- for name,player in pairs(tfm.get.room.playerList) do
- players=players+1
- end
- end
- if #skip>=math.floor(players/2) then
- tfm.exec.chatMessage("<N>Skipping map...")
- eventLoop(0,0)
- end
- elseif mod and args[1]=="mod" then
- message=message:match("%s(.*)") or ""
- tfm.exec.chatMessage("<ROSE>["..tfm.get.room.name.."] "..message,name)
- elseif mod and args[1]=="ban" then
- if args[2]:match("%d+") then
- args[2]="@"..args[2]:match("%d+")
- bannedmaps[args[2]]=true
- tfm.exec.chatMessage(args[2].." added to banned map list.",name)
- else
- args[2]=args[2]:gsub("^%l",string.upper)
- blacklist[args[2]]=true
- tfm.exec.chatMessage(args[2].." has been blacklisted.",name)
- end
- elseif mod and args[1]=="blacklist" then
- local listmaps,listmice={}
- for map,yes in pairs(bannedmaps) do
- table.insert(listmaps,map)
- end
- for mouse,yes in pairs(blacklist) do
- table.insert(listmice,mouse)
- end
- tfm.exec.chatMessage("Banned maps: "..table.concat(listmaps,", "),name)
- tfm.exec.chatMessage("Banned mice: "..table.concat(listmice,", "),name)
- elseif tonumber(args[1]:match("%d+")) then
- eventChatCommand(name,"test "..message)
- end
- end
- for i,command in ipairs({"i","mod","ban","blacklist"}) do
- system.disableChatCommandDisplay(command)
- end
- for i,table in ipairs({roomods,blacklist,bannedmaps}) do
- for i,item in ipairs(table) do
- table[i]=nil
- table[item]=true
- end
- end
- for name,player in pairs(tfm.get.room.playerList) do
- eventNewPlayer(name)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement