Advertisement
Fooksie

*#test

Aug 16th, 2013
887
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.51 KB | None | 0 0
  1. map={}
  2. queue={}
  3. skip={}
  4. roomods={
  5.     "Fxie",
  6.     "Begentle",
  7.     "Lemodile"
  8.     }
  9. blacklist={
  10.     "Chrisamgad",
  11.     "Flyingpizza",
  12.     "Steelyknife",
  13.     "Porker",
  14.     "Juliomense"
  15.     }
  16. bannedmaps={
  17.     "@1700617",
  18.     "@4203135"
  19.     }
  20. tfm.exec.disableAutoNewGame(true)
  21. function eventLoop(time,remaining)
  22.     if time>15000 and map.vampire then
  23.         map.vampire=nil
  24.         local top,target=0
  25.         for name,player in pairs(tfm.get.room.playerList) do
  26.             if player.score>=top then
  27.                 top=player.score
  28.                 target=name
  29.                 end
  30.             end
  31.         tfm.exec.setVampirePlayer(target)
  32.     elseif remaining<=500 then
  33.         map=queue[1]
  34.         tfm.exec.setGameTime(5)
  35.         if map and not blacklist[map.by] and not bannedmaps[map.code] then
  36.             tfm.exec.disableAutoShaman(map.type=="racing" or map.type=="bootcamp" or map.type=="vampire")
  37.             tfm.exec.disableAutoTimeLeft(map.type=="bootcamp")
  38.             tfm.exec.newGame(map.code)
  39.             if map.retry then
  40.                 map.retry=nil
  41.                 table.remove(queue,1)
  42.             else
  43.                 map.retry=true
  44.                 end
  45.         else
  46.             map={}
  47.             tfm.exec.disableAutoShaman(false)
  48.             tfm.exec.disableAutoTimeLeft(false)
  49.             tfm.exec.newGame("#1")
  50.             end
  51.         end
  52.     end
  53. function eventNewGame()
  54.     skip={}
  55.     if map.retry then
  56.         table.remove(queue,1)
  57.         end
  58.     if map.type=="bootcamp" then
  59.         tfm.exec.setGameTime(3*60)
  60.     elseif map.type=="vampire" then
  61.         map.vampire=true
  62.         end
  63.     if map.code then
  64.         tfm.exec.chatMessage("<N>Playing <VP>"..map.code.."<N> by <VP>"..map.by)
  65.         end
  66.     end
  67. function eventNewPlayer(name)
  68.     tfm.exec.chatMessage("<VP>Welcome to <N>"..tfm.get.room.name.."\n<T>You can test your map by typing <N>!test @code",name)
  69.     end
  70. function eventPlayerDied(name)
  71.     if map.type=="bootcamp" then
  72.         tfm.exec.respawnPlayer(name)
  73.     else
  74.         for name,player in pairs(tfm.get.room.playerList) do
  75.             if not player.isDead then
  76.                 return
  77.                 end
  78.             end
  79.         eventLoop(0,0)
  80.         end
  81.     end
  82. function eventPlayerWon(name)
  83.     eventPlayerDied(name)
  84.     end
  85. function eventPlayerVampire(name)
  86.     for name,player in pairs(tfm.get.room.playerList) do
  87.         if not player.isVampire then
  88.             return
  89.             end
  90.         end
  91.     eventLoop(0,0)
  92.     end
  93. function eventChatCommand(name,message)
  94.     if blacklist[name] then
  95.         tfm.exec.chatMessage("You've been blacklisted.",name)
  96.         return
  97.         end
  98.     local args={}
  99.     for arg in message:gmatch("[^%s]+") do
  100.         table.insert(args,arg:lower())
  101.         end
  102.     local mod=roomods[name]
  103.     if args[1]=="i" then
  104.         message=message:match("%s(.*)") or ""
  105.         eventChatCommand(name,message~="" and message or "help")
  106.     elseif args[1]=="help" then
  107.         eventNewPlayer(name)
  108.     elseif args[1]=="maps" then
  109.         if #queue~=0 then
  110.             local maplist={}
  111.             for i,map in ipairs(queue) do
  112.                 local item=i..". "..map.code.." by "..map.by
  113.                 if map.type then
  114.                     item=item.." ("..map.type..")"
  115.                     end
  116.                 table.insert(maplist,item)
  117.                 end
  118.             tfm.exec.chatMessage(table.concat(maplist,"\n"),name)
  119.         else
  120.             tfm.exec.chatMessage("No maps in queue!",name)
  121.             end
  122.     elseif args[1]=="die" or args[1]=="mort" then
  123.         tfm.exec.killPlayer(name)
  124.     elseif args[1]=="test" and args[2] then
  125.         args[2]=tonumber(args[2]:match("%d+"))
  126.         if not args[2] then
  127.             tfm.exec.chatMessage("That isn't a map!",name)
  128.             return
  129.             end
  130.         args[2]="@"..args[2]
  131.         if bannedmaps[args[2]] then
  132.             blacklist[name]=true
  133.             tfm.exec.chatMessage("You have been banned.",name)
  134.             return
  135.             end
  136.         for i,map in ipairs(queue) do
  137.             if map.by==name then
  138.                 tfm.exec.chatMessage("You already have a map in queue!",name)
  139.                 return
  140.             elseif map.code==args[2] then
  141.                 tfm.exec.chatMessage("That map is already queued!",name)
  142.                 return
  143.                 end
  144.             end
  145.         table.insert(queue,{
  146.             by=name,
  147.             code=args[2],
  148.             type=args[3]
  149.             })
  150.         tfm.exec.chatMessage(args[2].." added to queue! It will play in "..#queue.." rounds.",name)
  151.     elseif args[1]=="skip" then
  152.         local players=0
  153.         if not (mod and args[2]=="now") then
  154.             for i,who in ipairs(skip) do
  155.                 if who==name then
  156.                     tfm.exec.chatMessage("You already voted to skip this map!",name)
  157.                     return
  158.                     end
  159.                 end
  160.             table.insert(skip,name)
  161.             tfm.exec.chatMessage("Your vote has been added.",name)
  162.             players=0
  163.             for name,player in pairs(tfm.get.room.playerList) do
  164.                 players=players+1
  165.                 end
  166.             end
  167.         if #skip>=math.floor(players/2) then
  168.             tfm.exec.chatMessage("<N>Skipping map...")
  169.             eventLoop(0,0)
  170.             end
  171.     elseif mod and args[1]=="mod" then
  172.         message=message:match("%s(.*)") or ""
  173.         tfm.exec.chatMessage("<ROSE>["..tfm.get.room.name.."] "..message,name)
  174.     elseif mod and args[1]=="ban" then
  175.         if args[2]:match("%d+") then
  176.             args[2]="@"..args[2]:match("%d+")
  177.             bannedmaps[args[2]]=true
  178.             tfm.exec.chatMessage(args[2].." added to banned map list.",name)
  179.         else
  180.             args[2]=args[2]:gsub("^%l",string.upper)
  181.             blacklist[args[2]]=true
  182.             tfm.exec.chatMessage(args[2].." has been blacklisted.",name)
  183.             end
  184.     elseif mod and args[1]=="blacklist" then
  185.         local listmaps,listmice={}
  186.         for map,yes in pairs(bannedmaps) do
  187.             table.insert(listmaps,map)
  188.             end
  189.         for mouse,yes in pairs(blacklist) do
  190.             table.insert(listmice,mouse)
  191.             end
  192.         tfm.exec.chatMessage("Banned maps: "..table.concat(listmaps,", "),name)
  193.         tfm.exec.chatMessage("Banned mice: "..table.concat(listmice,", "),name)
  194.     elseif tonumber(args[1]:match("%d+")) then
  195.         eventChatCommand(name,"test "..message)
  196.         end
  197.     end
  198. for i,command in ipairs({"i","mod","ban","blacklist"}) do
  199.     system.disableChatCommandDisplay(command)
  200.     end
  201. for i,table in ipairs({roomods,blacklist,bannedmaps}) do
  202.     for i,item in ipairs(table) do
  203.         table[i]=nil
  204.         table[item]=true
  205.         end
  206.     end
  207. for name,player in pairs(tfm.get.room.playerList) do
  208.     eventNewPlayer(name)
  209.     end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement