Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- admin="Mousetat" --put your own username
- blueready=false
- redready=false
- redteamname="Red Team"
- blueteamname="Blue Team"
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAutoShaman(true)
- tfm.exec.disableAfkDeath(true)
- tfm.exec.disableAutoTimeLeft(true)
- colors = { 0xff0000, 0x0000ff }
- players={}
- toDespawn={}
- maps={521833,401421,541917,541928,541936,541943,527935,559634,559644,888052,878047,885641,770600,770656,772172,891472,589736,589800,589708,900012,901062,754380,901337,901411,907870,910078,1190467,1252043,1124380,1016258,1252299,1255902,1256808,986790,1285380,1271249,1255944,1255983,1085344,1273114,1276664,1279258,1286824,1280135,1280342,1284861,1287556,1057753,1196679,1288489,1292983,1298164,1298521,1293189,1296949,1308378,1311136,1314419,1314982,1318248,1312411,1312589,1312845,1312933,1313969,1338762,1339474,1349878,1297154,644588,1351237,1354040,1354375,1362386,1283234,1370578,1306592,1360889,1362753,1408124,1407949,1407849,1343986,1408028,1441370,1443416,1389255,1427349,1450527,1424739,869836,1459902,1392993,1426457,1542824,1533474,1561467,1563534,1566991,1587241,1416119,1596270,1601580,1525751,1582146,1558167,1420943,1466487,1642575,1648013,1646094,1393097,1643446,1545219,1583484,1613092,1627981,1633374,1633277,1633251,1585138,1624034,1616785,1625916,1667582,1666996,1675013,1675316,1531316,1665413,1681719,1699880,1688696,623770,1727243,1531329,1683915,1689533,1738601,3756146,912118,3326933,3722005,3566478,1456622,1357994,1985670,1884075,1708065,1700322,2124484,3699046,4057963,4019126,3335202,2050466}
- disco={1612690,3920302,3333999,3926952,3334000,2121577}
- selection=true
- ffa=false
- tfm.exec.newGame("@6396471")
- cheese="nothing"
- redpoints=0
- bluepoints=0
- long="nothing"
- win=false
- discobool=false
- ui.addPopup(0, 0, "<p align = 'center'><b><font size='30' face='arial' color='#FFFFFF'>Welcome to Tribe War: Deathmatch!</font></b></p>Created by Mousetat, credits to Gekkeiju<p align = 'left'><font size='15' face='arial' color='#FFFF00'>\nRules:\nThe Captains of both teams choose when their team is ready. He/she can click on 'Blue Team' if he/she is blue team captain, or 'Red Team' if he/she is red team captain, to change the Team Name. The *Captain* will have '*' on both sides of their name. When both captains are ready, the game will begin. Spectators will die every round and are unable to participate. Each time a team wins i.e.survive the round, they will win 1 point. The first team to score 10 points wins the game!</font></p>\n<p align='center'><b><i><font size='30' face='arial' color='#FF0000'>Commands(admin only)</p></b></i></font>!skip - skips a map to start a new map.\n!start - start/restart FFA with 0 points for both teams.\n!new - goes back to selection menu to reselect teams.\nCurrent Admin is <font size='25' color='#0000FF'>"..admin.."</font>.\n<p align='left'><b><i><font size='20'>Type !help to see this popup again.</p></b><i></font>", nil, 100, 30, 600, true)
- function eventNewPlayer(name)
- for i,key in ipairs({32,40,83,37,39,65,68}) do
- tfm.exec.bindKeyboard(name,key,true,true)
- end
- players[name]={
- timestamp=os.time(),
- offsets={x=2, y=10},
- team="white",
- idplayer=0
- }
- end
- function eventKeyboard(name,key,down,x,y)
- local id=0
- if (key==32 or key==40 or key==83) and not tfm.get.room.playerList[name].isDead and started and ffa==true and win==false then
- if players[name].timestamp < os.time()-1000 then
- if players[name].isFacingRight then
- id=tfm.exec.addShamanObject(17, x+2 , y+10, 90 )
- else
- id=tfm.exec.addShamanObject(17, x-2 , y+10, 270)
- end
- players[name].timestamp=os.time()
- table.insert(toDespawn,{os.time(),id})
- end
- end
- if key==37 or key==65 then
- players[name].isFacingRight = false
- elseif key==39 or key==68 then
- players[name].isFacingRight=true
- end
- end
- function eventChatCommand(name,command)
- if name==admin and command=="new" then
- selection=true
- ffa=false
- discobool=false
- starterino=false
- tfm.exec.newGame("@6396471")
- redpoints=0
- bluepoints=0
- blueready=false
- redready=false
- redteamname="Red Team"
- blueteamname="Blue Team"
- local i=1
- while i<10 do
- ui.removeTextArea(i,nil)
- i=i+1
- end
- win=false
- for name,player in pairs(tfm.get.room.playerList) do
- eventNewPlayer(name)
- end
- end
- if name==admin and command=="start" then
- ffa=true
- selection=false
- redpoints=0
- bluepoints=0
- tfm.exec.newGame(maps[math.random(#maps)])
- end
- if name==admin and command=="skip" then
- tfm.exec.newGame(maps[math.random(#maps)])
- end
- if command=="help" then
- ui.addPopup(0, 0, "<p align = 'center'><b><font size='30' face='arial' color='#FFFFFF'>Welcome to Tribe War: Deathmatch!</font></b></p><p align = 'left'><font size='15' face='arial' color='#FFFF00'>Rules:\nThe Captains of both teams choose when their team is ready. The Captain will have '*' on both sides of their name. When both captains are ready, the game will begin. Each time a team wins i.e.survive the round, they will win 1 point. The first team to score 10 points wins the game!</font></p>\n\n<p align='center'><b><i><font size='30' face='arial' color='#FF0000'>Commands(admin only)</p></b></i></font>!skip - skips a map to start a new map.\n!start - start/restart FFA with 0 points for both teams.\n!new - goes back to selection menu to reselect teams.\nCurrent Admin is <font size='25' color='#0000FF'>"..admin.."</font>.\n<p align='left'><b><i><font size='20'>Type !help to see this popup again.</p></b><i></font>", name, 100, 50, 600, true)
- end
- end
- function eventNewGame()
- if selection==true then
- tfm.exec.setGameTime(30, false)
- local i=10
- local y=30
- while i<19 do
- ui.addTextArea(i,"<a href='event:join'><b><p align='center'><font face='arial' size='20' color='#0000FF'>Join</font></p></b></a>" ,nil,5,y,200,30,0x0000ff,0x212F36,0.2,false)
- i=i+1
- y=y+40
- end
- ui.addTextArea(19,"<a href='event:captain'><b><p align='center'><font face='arial' size='20' color='#0000FF'>Become Captain</font></p></b></a>" ,nil,5,y,200,30,0x0000ff,0x212F36,0.2,false)
- y=30
- i=20
- while i<29 do
- ui.addTextArea(i,"<a href='event:join'><b><p align='center'><font face='arial' size='20' color='#FF0000'>Join</font></p></b></a>" ,nil,605,y,200,30,0xff0000,0x212F36,0.2,false)
- i=i+1
- y=y+40
- end
- ui.addTextArea(29,"<a href='event:captain'><b><p align='center'><font face='arial' size='20' color='#FF0000'>Become Captain</font></p></b></a>" ,nil,605,y,200,30,0xff0000,0x212F36,0.2,false)
- ui.addTextArea(0,"<a href='event:spectate'><b><p align='center'><font face='arial' size='20' color='#FFFFFF'>Spectate</font></p></b></a>" ,nil,300,205,200,30,0xffffff,0x212F36,0.2,false)
- ui.addTextArea(50,"<a href='event:blueready'><b><p align='center'><font face='arial' size='20' color='#0000FF'>Not Ready</font></p></b></a>" ,nil,260,385,120,30,0x0000ff,0x212F36,0.2,false)
- ui.addTextArea(51,"<a href='event:redready'><b><p align='center'><font face='arial' size='20' color='#FF0000'>Not Ready</font></p></b></a>" ,nil,420,385,120,30,0xff0000,0x212F36,0.2,false)
- ui.addTextArea(53,"<a href='event:bluename'><b><p align='center'><font face='arial' size='20' color='#0000FF'>Blue Team</font></p></b></a>" ,nil,260,65,280,30,0x0000ff,0x212F36,0.2,false)
- ui.addTextArea(55,"<b><p align='center'><font face='arial' size='20' color='#000000'>VS</font></p></b>" ,nil,375,105,50,30,0xffffff,0x212F36,0.2,false)
- ui.addTextArea(54,"<a href='event:redname'><b><p align='center'><font face='arial' size='20' color='#FF0000'>Red Team</font></p></b></a>" ,nil,260,145,280,30,0xff0000,0x212F36,0.2,false)
- end
- if ffa==true then
- if bluepoints==10 then
- tfm.exec.setGameTime(30)
- win=true
- ui.addTextArea(8,"<p align='center'><b><font face='arial' size='40' color='#0000FF'>"..blueteamname.." WON!!</font></b></p>" ,nil,0,120,800,60,0x0000ff,0x212F36,0.2,true)
- cheese="blue"
- elseif redpoints==10 then
- tfm.exec.setGameTime(30)
- win=true
- ui.addTextArea(8,"<p align='center'><b><font face='arial' size='40' color='#FF0000'>"..redteamname.." WON!!</font></b></p>" ,nil,0,120,800,60,0xff0000,0x212F36,0.2,true)
- cheese="red"
- end
- local i=10
- while i<60 do
- ui.removeTextArea(i,nil)
- i=i+1
- end
- ui.removeTextArea(0,nil)
- for name, player in pairs(tfm.get.room.playerList) do
- if players[name].team=="blue" or players[name].team=="bluecaptain" then
- tfm.exec.setNameColor(name, 0x0000ff)
- elseif players[name].team=="red" or players[name].team=="redcaptain" then
- tfm.exec.setNameColor(name, 0xff0000)
- elseif players[name].team=="white" then
- tfm.exec.killPlayer(name)
- end
- end
- bluestring="<p align='center'><b><font face='arial' size='20' color='#0000FF'>"..blueteamname.."</font></b></p>".."<p align='center'><b><font face='arial' size='30' color='#0000FF'>"..tostring(bluepoints).."</font></b></p>"
- redstring="<p align='center'><b><font face='arial' size='20' color='#FF0000'>"..redteamname.."</font></b></p>".."<p align='center'><b><font face='arial' size='30' color='#FF0000'>"..tostring(redpoints).."</font></b></p>"
- ui.addTextArea(7,bluestring,nil,95,25,300,70,0x0000ff,0x0000ff,0.2,true)
- ui.addTextArea(9,redstring,nil,405,25,300,70,0xff0000,0xff0000,0.2,true)
- started=false
- end
- end
- function eventTextAreaCallback(i, name, callback)
- if callback=="join" or callback=="captain" then
- if players[name].idplayer>0 then
- if players[name].idplayer<19 then
- ui.updateTextArea(players[name].idplayer,"<a href='event:join'><b><p align='center'><font face='arial' size='20' color='#0000FF'>Join</font></p></b></a>",nil)
- elseif players[name].idplayer==19 then
- ui.updateTextArea(players[name].idplayer,"<a href='event:captain'><b><p align='center'><font face='arial' size='20' color='#0000FF'>Become Captain</font></p></b></a>",nil)
- elseif players[name].idplayer<29 then
- ui.updateTextArea(players[name].idplayer,"<a href='event:join'><b><p align='center'><font face='arial' size='20' color='#FF0000'>Join</font></p></b></a>",nil)
- elseif players[name].idplayer==29 then
- ui.updateTextArea(players[name].idplayer,"<a href='event:captain'><b><p align='center'><font face='arial' size='20' color='#FF0000'>Become Captain</font></p></b></a>",nil)
- end
- end
- if i<20 then
- tfm.exec.movePlayer(name,100,45+(i-10)*40,false,0,0,false)
- tfm.exec.setNameColor(name, 0x0000ff)
- ui.updateTextArea(i,"<b><p align='center'><font face='arial' size='20' color='#0000FF'>"..name.."</font></p></b>",nil)
- players[name].team="blue"
- players[name].idplayer=i
- if callback=="captain" then
- ui.updateTextArea(i,"<b><p align='center'><font face='arial' size='20' color='#0000FF'>*"..name.."*</font></p></b>",nil)
- players[name].team="bluecaptain"
- end
- elseif i<30 and i>=20 then
- tfm.exec.movePlayer(name,700,45+(i-20)*40,false,0,0,false)
- tfm.exec.setNameColor(name, 0xff0000)
- ui.updateTextArea(i,"<b><p align='center'><font face='arial' size='20' color='#FF0000'>"..name.."</font></p></b>",nil)
- players[name].team="red"
- players[name].idplayer=i
- if callback=="captain" then
- ui.updateTextArea(i,"<b><p align='center'><font face='arial' size='20' color='#FF0000'>*"..name.."*</font></p></b>",nil)
- players[name].team="redcaptain"
- end
- end
- elseif callback=="spectate"then
- if players[name].idplayer>0 then
- if players[name].idplayer<19 then
- ui.updateTextArea(players[name].idplayer,"<a href='event:join'><b><p align='center'><font face='arial' size='20' color='#0000FF'>Join</font></p></b></a>",nil)
- elseif players[name].idplayer==19 then
- ui.updateTextArea(players[name].idplayer,"<a href='event:captain'><b><p align='center'><font face='arial' size='20' color='#0000FF'>Become Captain</font></p></b></a>",nil)
- elseif players[name].idplayer<29 then
- ui.updateTextArea(players[name].idplayer,"<a href='event:join'><b><p align='center'><font face='arial' size='20' color='#FF0000'>Join</font></p></b></a>",nil)
- elseif players[name].idplayer==29 then
- ui.updateTextArea(players[name].idplayer,"<a href='event:captain'><b><p align='center'><font face='arial' size='20' color='#FF0000'>Become Captain</font></p></b></a>",nil)
- end
- end
- players[name].team="white"
- players[name].idplayer=0
- tfm.exec.movePlayer(name,400,405,false,0,0,false)
- tfm.exec.setNameColor(name, 0)
- elseif callback=="blueready" and players[name].team=="bluecaptain" then
- ui.updateTextArea(50,"<a href='event:bluenotready'><b><p align='center'><font face='arial' size='20' color='#0000FF'>Ready</font></p></b></a>" ,nil)
- blueready=true
- elseif callback=="redready" and players[name].team=="redcaptain" then
- ui.updateTextArea(51,"<a href='event:rednotready'><b><p align='center'><font face='arial' size='20' color='#FF0000'>Ready</font></p></b></a>" ,nil)
- redready=true
- elseif callback=="bluenotready" and players[name].team=="bluecaptain" then
- ui.updateTextArea(50,"<a href='event:blueready'><b><p align='center'><font face='arial' size='20' color='#0000FF'>Not Ready</font></p></b></a>" ,nil)
- blueready=false
- elseif callback=="rednotready" and players[name].team=="redcaptain" then
- ui.updateTextArea(51,"<a href='event:redready'><b><p align='center'><font face='arial' size='20' color='#FF0000'>Not Ready</font></p></b></a>" ,nil)
- redready=false
- elseif callback=="bluename" and players[name].team=="bluecaptain" then
- ui.addPopup(1, 2,"What do you want your team name to be?", name, 200, 100, 400, true)
- elseif callback=="redname" and players[name].team=="redcaptain" then
- ui.addPopup(2, 2,"What do you want your team name to be?", name, 200, 100, 400, true)
- end
- end
- starterino=false
- function eventPopupAnswer(id, name, answer)
- if id==1 then
- blueteamname=string.sub(answer, 1, 25)
- ui.updateTextArea(53,"<a href='event:bluename'><b><p align='center'><font face='arial' size='20' color='#0000FF'>"..blueteamname.."</font></p></b></a>",nil)
- elseif id==2 then
- redteamname=string.sub(answer, 1, 25)
- ui.updateTextArea(54,"<a href='event:redname'><b><p align='center'><font face='arial' size='20' color='#FF0000'>"..redteamname.."</font></p></b></a>",nil)
- end
- end
- function eventLoop(time,remaining)
- if selection==true then
- if blueready==true and redready==true and starterino==false then
- starterino=true
- tfm.exec.setGameTime(3)
- elseif blueready==false or redready==false then
- ui.removeTextArea(52)
- starterino=false
- end
- if remaining>=3000 and blueready==true and redready==true and starterino==true then
- ui.addTextArea(52,"<b><p align='center'><font face='arial' size='20' color='#FFFFFF'>Starting Game in 3</font></p></b>" ,nil,300,300,200,30,0xffffff,0x212F36,0.2,false)
- elseif remaining>=2000 and blueready==true and redready==true and starterino==true then
- ui.updateTextArea(52,"<b><p align='center'><font face='arial' size='20' color='#FFFFFF'>Starting Game in 2</font></p></b>" ,nil)
- elseif remaining>=1000 and blueready==true and redready==true and starterino==true then
- ui.updateTextArea(52,"<b><p align='center'><font face='arial' size='20' color='#FFFFFF'>Starting Game in 1</font></p></b>" ,nil)
- elseif remaining<=0 and blueready==true and redready==true and starterino==true then
- ffa=true
- selection=false
- tfm.exec.newGame(maps[math.random(#maps)])
- end
- end
- if ffa==true and win==false then
- if time>=8000 then
- ui.removeTextArea(4)
- elseif time >=7000 then
- ui.removeTextArea(2)
- ui.addTextArea(4,"<b><font face='arial' size='50' color='#00FF00'>GO</font></b>" ,nil,355,330,100,60,0x324650,0x212F36,0,true)
- if not started then
- started=true
- end
- elseif time>=6000 then
- ui.removeTextArea(3)
- ui.addTextArea(2,"<b><font face='arial' size='50' color='#FF0000'>1</font></b>" ,nil,385,330,35,60,0x324650,0x212F36,0,true)
- elseif time>=5000 then
- ui.removeTextArea(1)
- ui.addTextArea(3,"<b><font face='arial' size='50' color='#FF0000'>2</font></b>" ,nil,385,330,35,60,0x324650,0x212F36,0,true)
- elseif time>=4000 then
- ui.removeTextArea(9999)
- ui.addTextArea(1,"<b><font face='arial' size='50' color='#FF0000'>3</font></b>" ,nil,385,330,35,60,0x324650,0x212F36,0,true)
- elseif time>=0 then
- ui.addTextArea(9999,"<b><font face='Impact' size='50' color='#FFFF00'>Get Ready</font></b>" ,nil,295,330,350,60,0x324650,0x212F36,0,true)
- end
- if remaining<=0 then
- if bluepoints==10 or redpoints==10 then
- tfm.exec.newGame(disco[math.random(#disco)])
- else
- tfm.exec.newGame(maps[math.random(#maps)])
- end
- end
- for i,cannon in ipairs(toDespawn) do
- if cannon[1] <= os.time()-3000 then
- tfm.exec.removeObject(cannon[2])
- table.remove(toDespawn,i)
- end
- end
- end
- if win==true then
- if time>=3000 then
- if cheese=="red" then
- for name,player in pairs(tfm.get.room.playerList) do
- if players[name].team=="red" or players[name].team=="redcaptain" then
- tfm.exec.playEmote(name, 0)
- else
- tfm.exec.playEmote(name, 2)
- end
- end
- elseif cheese=="blue" then
- for name,player in pairs(tfm.get.room.playerList) do
- if players[name].team=="blue" or players[name].team=="bluecaptain"then
- tfm.exec.playEmote(name, 0)
- else
- tfm.exec.playEmote(name, 2)
- end
- end
- end
- end
- if remaining<=0 then
- selection=true
- ffa=false
- discobool=false
- starterino=false
- tfm.exec.newGame("@6396471")
- tfm.exec.newGame("@6396471")
- redpoints=0
- bluepoints=0
- blueready=false
- redready=false
- redteamname="Red Team"
- blueteamname="Blue Team"
- local i=1
- while i<10 do
- ui.removeTextArea(i,nil)
- i=i+1
- end
- win=false
- end
- end
- end
- function eventPlayerDied(name)
- if ffa==true and win==false then
- local i=0
- local n
- for pname,player in pairs(tfm.get.room.playerList) do
- if not player.isDead then
- i=i+1
- n=pname
- end
- end
- if i==0 and win==false then
- tfm.exec.newGame(maps[math.random(#maps)])
- end
- local redalive=0
- local bluealive=0
- for name, player in pairs(tfm.get.room.playerList) do
- if players[name].team=="red" or players[name].team=="redcaptain" then
- if not player.isDead then
- redalive=redalive+1
- end
- elseif players[name].team=="blue" or players[name].team=="bluecaptain" then
- if not player.isDead then
- bluealive=bluealive+1
- end
- end
- end
- if redalive==0 then
- bluepoints=bluepoints+1
- for name, player in pairs(tfm.get.room.playerList) do
- if players[name].team=="blue" or players[name].team=="bluecaptain" then
- if not player.isDead then
- tfm.exec.giveCheese(name)
- tfm.exec.playerVictory(name)
- end
- end
- end
- tfm.exec.setGameTime(5)
- elseif bluealive==0 then
- redpoints=redpoints+1
- for name, player in pairs(tfm.get.room.playerList) do
- if players[name].team=="red" or players[name].team=="redcaptain" then
- if not player.isDead then
- tfm.exec.giveCheese(name)
- tfm.exec.playerVictory(name)
- end
- end
- end
- tfm.exec.setGameTime(5)
- end
- 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