Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tfm.exec.disableAutoTimeLeft (true)
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAutoShaman(true)
- admins = {"Warfenixkill", "Ultraspeedy", "Ratacp", "Sucarin", "Belkano", "Yunowears", "Bogkitty", "Kissyta", "Toritomm", "Ssergi", "Crashark", "Enjoyandplay", "Jontreras","Tenfeenti", "Mousetat", "Xsilverraven"}
- menuAdmin = {false,false}
- gameOn = false
- adminOn = false
- gameEnds = false
- player = {}
- keys = {66,71,74,76}
- roundsCounter=1
- maxRound=20
- numberWinners=5
- despawnObject = {}
- timeLastShoot = {0,0,false}
- timeLastMultipleShoot = {0,0,false}
- cannonPosition = {x={},y={},a={}}
- mapas = {"391664","866256","393406","292672","793117","392616","311496","6622204","3102891","479091 ","397066","802975","289932 ","489470 ","6631961","6592438","6549805","6515473","6456320","6284023","6240668","6125512","5973058","5964714","5498543","5239078","5196131","5175883","4842994","4705798","4679748","4329532","3699989","3686073","3587860","3579303","3550350","3540608","3480467","3473722","3419948","3400319","3322939","3220945","3175437","3146721","3107377","3067251","2964900","2939549","2842113","2732060","2526952","2408376","2284187","1812056","1794907","1794873","1661909","1659906","1545834","153914","1535492","1533374","1533333","1528388","1525486","1519483","1515058","1514928","1492805","1463332","1388662","1277941","1026249","953515","908739","837797","290546"}
- textES = {"You sure you want to start the game?",
- "Nice Job! You obtained <font color='#AAFF68'><b>3</b> points</font>!",
- "Good Job! You got <font color='#AAFF68'><b>1</b> point</font>!",
- "<p align='center'><font size='15'><font color='#C5CAFF'><b>List of players - ratings</b></font></font></p>",
- "The tournament is now in <font color='#AAFF68'><b>Practice Mode</b></font>!",
- "<p align='center'><font size='15'><font color='#C5CAFF'><b>Players classified to semifinals!</b></font></font></p>"}
- numberPlayers = {0,0}
- function main()
- --ui.addTextArea(0, "<p align='center'><font size='26'><font color='#90C6FF'><b>Survivor</b></font></font><br><font size='14'><font color='#FFBB90'><b>Edition <font color='#DCFF90'>Special</font></b></font></font><br>------------------------------<br><font size='11'><b>OFFICIAL TOURNAMENT <font color='#FF9090'>E</font><font color='#FFF990'>S</font></b></p>", nil, 630, 30, 160, 115, 0x324650, 0x0, 0)
- --tfm.exec.newGame("@6653312")
- for playerName in pairs(tfm.get.room.playerList) do
- tfm.exec.setPlayerScore(playerName,0)
- eventNewPlayer(playerName)
- end
- game()
- end
- function eventNewPlayer(playerName)
- player[playerName] = {points=0, msjOn={false,false}}
- for _,k in pairs(keys) do
- system.bindKeyboard(playerName, k, true)
- end
- end
- function eventKeyboard(playerName, key, down, px, py)
- if key==71 then
- for _,adminName in pairs(admins) do
- if playerName==adminName then
- startGame(playerName)
- end
- end
- elseif key==74 then
- for _,adminName in pairs(admins) do
- if playerName==adminName then
- if menuAdmin[1]==false then
- adminModeControl(playerName,1)
- else
- adminModeControl(playerName,0)
- end
- end
- end
- elseif key==76 then
- if player[playerName]~=nil then
- if player[playerName].msjOn[1]==false then
- scoreList(playerName,1)
- else
- scoreList(playerName,0)
- end
- end
- elseif key==66 then
- for _,adminName in pairs(admins) do
- if playerName==adminName then
- restartMode()
- end
- end
- end
- end
- function restartMode()
- for i = 1,3000,1 do
- ui.removeTextArea (i,nil)
- end
- roundsCounter=1
- menuAdmin = {false,false}
- gameOn = false
- adminOn = false
- gameEnds = false
- despawnObject = {}
- timeLastShoot = {0,0,false}
- timeLastMultipleShoot = {0,0,false}
- cannonPosition = {x={},y={},a={}}
- player = {}
- main()
- end
- function startGame(playerName)
- ui.addPopup(1, 2, " Place <font color='#FFDE6E'><b>password</b></font> to start the tournament:", playerName, 20, 40, 280, true)
- end
- function eventTextAreaCallback(id, playerName, answer)
- if id>=200 and id<=300 then
- modControlV(answer)
- end
- if id>=44 and id<=45 then
- if answer=='Cancelar' then
- modControlV1()
- else
- tfm.exec.killPlayer(answer)
- modControlV1()
- end
- end
- end
- function eventPopupAnswer(id, playerName, answer)
- if id==1 and answer=="@GBCSSSSTWBBRUY" then
- ui.removeTextArea (0,nil)
- roundsCounter=1
- gameEnds = false
- for playerName in pairs(player) do
- player[playerName].points = 0
- end
- adminOn=true
- game()
- end
- end
- function game()
- numberPlayers = {0,0}
- ui.removeTextArea (0,nil)
- for i = 1,5,1 do
- ui.removeTextArea (i+10,nil)
- ui.removeTextArea (i+20,nil)
- end
- if adminOn==true then
- if roundsCounter>=maxRound then
- gameOn=false
- gameEnds=true
- for playerName in pairs(player) do
- finalScoreList(playerName)
- end
- end
- end
- tfm.exec.newGame("@"..mapas[math.random(#mapas)])
- tfm.exec.setUIMapName("[Tournament] Survivor (Special Edition)")
- for playerName in pairs(player) do
- tfm.exec.giveMeep(playerName)
- numberPlayers[1] = numberPlayers[1]+1
- end
- numberPlayers[2] = numberPlayers[1]
- gameOn = true
- end
- function eventLoop(t, tr)
- ui.removeTextArea (2,nil)
- ui.removeTextArea (6000,nil)
- for i,object in ipairs(despawnObject) do
- if os.time()+10 > object[2]+1000 then
- tfm.exec.removeObject (object[1])
- table.remove (despawnObject, i)
- end
- end
- if tr <= 117000 and tr >= 116000 and gameOn==true and gameEnds==false then
- ui.addTextArea(2, "<p align='center'><font color='#FFFFFF'><font size='30'><b>3</b></font></font></p>", nil, 350, 350, 100, 50, 0x20202, 0x0, 0.8)
- if adminOn==true then
- ui.addTextArea(6000, "<p align='center'><font color='#FFFFFF'><font size='30'><b>Round "..roundsCounter.."/"..maxRound.."</b></font></font></p>", nil, 273, 177.5, 254, 45, 0x2e2e2e)
- end
- elseif tr <= 116000 and tr >= 115000 and gameOn==true and gameEnds==false then
- ui.addTextArea(2, "<p align='center'><font color='#FFFFFF'><font size='30'><b>2</b></font></font></p>", nil, 350, 350, 100, 50, 0x20202, 0x0, 0.8)
- if adminOn==true then
- ui.addTextArea(6000, "<p align='center'><font color='#FFFFFF'><font size='30'><b>Round "..roundsCounter.."/"..maxRound.."</b></font></font></p>", nil, 273, 177.5, 254, 45, 0x2e2e2e)
- end
- elseif tr <= 115000 and tr >= 114000 and gameOn==true and gameEnds==false then
- ui.addTextArea(2, "<p align='center'><font color='#FFFFFF'><font size='30'><b>1</b></font></font></p>", nil, 350, 350, 100, 50, 0x20202, 0x0, 0.8)
- if adminOn==true then
- ui.addTextArea(6000, "<p align='center'><font color='#FFFFFF'><font size='30'><b>Round "..roundsCounter.."/"..maxRound.."</b></font></font></p>", nil, 273, 177.5, 254, 45, 0x2e2e2e)
- end
- elseif tr <= 114000 and tr >= 113000 and gameOn==true and gameEnds==false then
- ui.addTextArea(2, "<p align='center'><font color='#FFFFFF'><font size='30'><b>GO</b></font></font></p>", nil, 350, 350, 100, 50, 0x20202, 0x0, 0.8)
- if adminOn==true then
- ui.addTextArea(6000, "<p align='center'><font color='#FFFFFF'><font size='30'><b>Round "..roundsCounter.."/"..maxRound.."</b></font></font></p>", nil, 273, 177.5, 254, 45, 0x2e2e2e)
- end
- elseif tr <= 113000 and tr >= 0 and gameOn==true and os.time()>(timeLastShoot[1]+500) then
- if gameEnds == false then
- regularShoot()
- end
- elseif tr < 0 and tr >=- 3000 then
- if gameOn == true then
- updateScore()
- end
- gameOn = false
- elseif tr <- 3000 then
- game()
- if adminOn==true then
- roundsCounter=roundsCounter+1
- end
- end
- if tr<=90000 and tr>=0 and gameOn==true and os.time()>(timeLastMultipleShoot[1]+30000) then
- if gameEnds == false then
- multipleShoot()
- updateNumberPlayers()
- end
- end
- end
- function eventPlayerLeft(playerName)
- player[playerName]=nil
- end
- function eventPlayerDied (playerName)
- if player[playerName] ~= nil then
- tfm.exec.setPlayerScore(playerName,player[playerName].points)
- end
- numberPlayers[2]=numberPlayers[2]-1
- if numberPlayers[2] == 1 then
- gameOn = false
- for playerName,playerNameAlive in pairs(tfm.get.room.playerList) do
- if playerNameAlive.isDead == false then
- if adminOn==true and gameEnds==false then
- player[playerName].points = player[playerName].points+3
- tfm.exec.setPlayerScore(playerName,player[playerName].points)
- ui.addTextArea(0, "<p align='center'><font color='#FFFFFF'><font size='15'>"..textES[2].."</font></p>", playerName, 200, 350, 400, 30, 0xd1b40, 0x0, 0.6)
- else
- player[playerName].points = 0
- tfm.exec.setPlayerScore(playerName,0)
- ui.addTextArea(0, "<p align='center'><font color='#FFFFFF'><font size='15'>"..textES[5].."</font></p>", nil, 0, 350, 800, 50, 0xd1b40, 0x0, 0.6)
- end
- tfm.exec.setGameTime(0,false)
- end
- end
- end
- end
- function regularShoot()
- local angle = {45,90,-90,-45}
- if timeLastShoot[3] == false then
- cannonPosition.a[1] = angle[math.random(#angle)]
- cannonPosition.y[1] = math.random(0,400)
- if cannonPosition.a[1] > 0 then
- cannonPosition.x[1] = math.random(0,400)
- ui.addTextArea(2, "<p align='center'><font size='40'><font color='#FFB15D'><b>•</b></font></font></p>", nil, cannonPosition.x[1], cannonPosition.y[1]-6, 50, 50, 0x324650, 0x0, 0)
- ui.addTextArea(3, "<p align='center'><font size='30'><font color='#FF4F33'><b>•</b></font></font></p>", nil, cannonPosition.x[1], cannonPosition.y[1], 50, 50, 0x324650, 0x0, 0)
- elseif cannonPosition.a[1] < 0 then
- cannonPosition.x[1]=math.random(400,800)
- ui.addTextArea(2, "<p align='center'><font size='40'><font color='#FFB15D'><b>•</b></font></font></p>", nil, cannonPosition.x[1], cannonPosition.y[1]-6, 50, 50, 0x324650, 0x0, 0)
- ui.addTextArea(3, "<p align='center'><font size='30'><font color='#FF4F33'><b>•</b></font></font></p>", nil, cannonPosition.x[1], cannonPosition.y[1], 50, 50, 0x324650, 0x0, 0)
- end
- timeLastShoot[3] = true
- else
- if os.time()>(timeLastShoot[1]+1000) then
- ui.removeTextArea (2,nil)
- ui.removeTextArea (3,nil)
- timeLastShoot[1] = os.time()
- table.insert(despawnObject, {tfm.exec.addShamanObject(17,cannonPosition.x[1],cannonPosition.y[1],cannonPosition.a[1]), os.time()})
- table.insert(despawnObject, {tfm.exec.addShamanObject(17,cannonPosition.x[1],cannonPosition.y[1],cannonPosition.a[1]*-1), os.time()})
- end
- timeLastShoot[3]=false
- end
- end
- function multipleShoot()
- local angle = {90,-90}
- if timeLastMultipleShoot[3] == false then
- for i = 1,5,1 do
- cannonPosition.a[i] = angle[math.random(#angle)]
- cannonPosition.y[i] = math.random(0,400)
- if cannonPosition.a[i] == 90 then
- ui.addTextArea(i+10, "<p align='center'><font size='33'><font color='#F5D889'><b>•</b></font></font></p>", nil, 400, cannonPosition.y[i]-4, 50, 50, 0x324650, 0x0, 0)
- ui.addTextArea(i+20, "<p align='center'><font size='25'><font color='#FF3923'><b>»</b></font></font></p>", nil, 400, cannonPosition.y[i], 50, 50, 0x324650, 0x0, 0)
- else
- ui.addTextArea(i+10, "<p align='center'><font size='33'><font color='#F5D889'><b>•</b></font></font></p>", nil, 400, cannonPosition.y[i]-4, 50, 50, 0x324650, 0x0, 0)
- ui.addTextArea(i+20, "<p align='center'><font size='25'><font color='#FF3923'><b>«</b></font></font></p>", nil, 400, cannonPosition.y[i], 50, 50, 0x324650, 0x0, 0)
- end
- timeLastMultipleShoot[3] = true
- end
- timeLastMultipleShoot[2] = os.time()
- else
- if os.time()>(timeLastMultipleShoot[1]+3000) and os.time() > timeLastMultipleShoot[2]+1500 then
- for i = 1,5,1 do
- ui.removeTextArea (i+10,nil)
- ui.removeTextArea (i+20,nil)
- timeLastMultipleShoot[1] = os.time()
- table.insert(despawnObject, {tfm.exec.addShamanObject(17,400,cannonPosition.y[i],cannonPosition.a[i]), os.time()})
- end
- timeLastMultipleShoot[3] = false
- end
- end
- end
- function updateScore()
- for playerName,playerNameAlive in pairs(tfm.get.room.playerList) do
- if playerNameAlive.isDead == false then
- if adminOn==true and gameEnds==false then
- player[playerName].points = player[playerName].points+1
- tfm.exec.setPlayerScore(playerName,player[playerName].points)
- ui.addTextArea(0, "<p align='center'><font color='#FFFFFF'><font size='15'>"..textES[3].."</font></p>", playerName, 200, 350, 400, 50, 0xd1b40, 0x0, 0.6)
- else
- player[playerName].points = 0
- tfm.exec.setPlayerScore(playerName,0)
- ui.addTextArea(0, "<p align='center'><font color='#FFFFFF'><font size='15'>"..textES[5].."</font></p>", nil, 0, 350, 800, 50, 0xd1b40, 0x0, 0.6)
- end
- end
- end
- end
- function updateNumberPlayers()
- local aux=0
- for _,playerName in pairs(tfm.get.room.playerList) do
- if playerName.isDead==false then
- aux=aux+1
- end
- end
- numberPlayers[2]=aux
- end
- function scoreList(playerName,action)
- if action==1 then
- local backupList,aux,cont,xList,yList={},{},0,125,135
- player[playerName].msjOn[1]=true
- ui.addTextArea(80, "", playerName, 100, 60, 600, 300, 0x25234b, 0x0, 0.6)
- ui.addTextArea(81, textES[4], playerName, 125, 80, 550, 25, 0x5060c, 0x0, 0.7)
- for name in pairs(player) do
- cont=cont+1
- table.insert(backupList,{playerName=name,points=player[name].points})
- end
- for i=1,cont,1 do
- for j=1,cont,1 do
- if backupList[j+1]~=nil then
- if (backupList[j].points < backupList[j+1].points) then
- aux=backupList[j]
- backupList[j]=backupList[j+1]
- backupList[j+1]=aux
- end
- end
- end
- end
- for i=1,cont,1 do
- if i%4~=0 then
- if yList~=345 then
- ui.addTextArea(i+100, "<p align='center'><font color='#C5CAFF'><font size='11'><b><font color='#ADF27C'>"..i..".</font> "..backupList[i].playerName..": <font color='#5BC8E6'>"..backupList[i].points.."</font></b></font></font></p>", playerName, xList, yList, 135, 18, 0x324650, 0x0, 0)
- xList=xList+140
- end
- else
- if yList~=345 then
- ui.addTextArea(i+100, "<p align='center'><font color='#C5CAFF'><font size='11'><b><font color='#ADF27C'>"..i..".</font> "..backupList[i].playerName..": <font color='#5BC8E6'>"..backupList[i].points.."</font></b></font></font></p>", playerName, xList, yList, 135, 18, 0x324650, 0x0, 0)
- yList=yList+30
- xList=125
- end
- end
- end
- elseif action==0 then
- player[playerName].msjOn[1]=false
- ui.removeTextArea (80,playerName)
- ui.removeTextArea (81,playerName)
- for i=101,150,1 do
- ui.removeTextArea (i,playerName)
- end
- end
- end
- function finalScoreList(playerName)
- local backupList,aux,cont,xList,yList={},{},0,125,135
- player[playerName].msjOn[1]=true
- ui.addTextArea(80, "", playerName, 100, 60, 600, 300, 0x25234b, 0x0, 0.6)
- ui.addTextArea(81, textES[6], playerName, 125, 80, 550, 25, 0x5060c, 0x0, 0.7)
- for name in pairs(player) do
- cont=cont+1
- table.insert(backupList,{playerName=name,points=player[name].points})
- end
- for i=1,cont,1 do
- for j=1,cont,1 do
- if backupList[j+1]~=nil then
- if (backupList[j].points < backupList[j+1].points) then
- aux=backupList[j]
- backupList[j]=backupList[j+1]
- backupList[j+1]=aux
- end
- end
- end
- end
- for i=1,cont,1 do
- if i%4~=0 then
- if yList~=345 then
- if i>=1 and i<=numberWinners then
- ui.addTextArea(i+100, "<p align='center'><font color='#C5CAFF'><font size='11'><b><font color='#ADF27C'>"..i..".</font> "..backupList[i].playerName..": <font color='#5BC8E6'>"..backupList[i].points.."</font></b></font></font></p>", playerName, xList, yList, 135, 18, 0x324650, 0x0, 0)
- end
- xList=xList+140
- end
- else
- if yList~=345 then
- if i>=1 and i<=numberWinners then
- ui.addTextArea(i+100, "<p align='center'><font color='#C5CAFF'><font size='11'><b><font color='#ADF27C'>"..i..".</font> "..backupList[i].playerName..": <font color='#5BC8E6'>"..backupList[i].points.."</font></b></font></font></p>", playerName, xList, yList, 135, 18, 0x324650, 0x0, 0)
- end
- yList=yList+30
- xList=125
- end
- end
- end
- end
- function adminModeControl(adminName,action)
- if action==1 then
- local playerList,cont,xList,yList={},0,55,95
- for playerName,playerNameAlive in pairs(tfm.get.room.playerList) do
- if playerNameAlive.isDead==false then
- table.insert(playerList,{playerNameList=playerName})
- cont=cont+1
- end
- end
- ui.addTextArea(30, "", adminName, 25, 35, 750, 150, 0x12274a, 0x12274a)
- ui.addTextArea(31, "", adminName, 40, 35, 720, 150, 0x30f14, 0x2233)
- ui.addTextArea(32, "<p align='center'><b>Click on the player you want to delete</b></p>", adminName, 15, 50, 300, 22, 0x1b3745, 0x324650)
- for i=1,cont,1 do
- if i%5~=0 then
- if yList~=155 then
- ui.addTextArea(i+200, "<p align='center'><font color='#FFFFFF'><font size='11'><b><a href='event:"..playerList[i].playerNameList.."'>"..playerList[i].playerNameList.."</a></b></font></font></p>", adminName, xList, yList, 135, 18, 0x324650, 0x0, 0)
- xList=xList+144
- end
- else
- if yList~=155 then
- ui.addTextArea(i+200, "<p align='center'><font color='#FFFFFF'><font size='11'><b><a href='event:"..playerList[i].playerNameList.."'>"..playerList[i].playerNameList.."</a></b></font></font></p>", adminName, xList, yList, 135, 18, 0x324650, 0x0, 0)
- yList=yList+30
- xList=55
- end
- end
- end
- menuAdmin[1]=true
- elseif action==0 then
- for i=200,250,1 do
- ui.removeTextArea (i,nil)
- modControlV1()
- end
- ui.removeTextArea (30,nil)
- ui.removeTextArea (31,nil)
- ui.removeTextArea (32,nil)
- ui.removeTextArea (33,nil)
- menuAdmin[1]=false
- end
- end
- function modControlV(respuesta)
- ui.addTextArea(40, "", administrador, 620, 330, 160, 50, 0x12274a, 0x12274a)
- ui.addTextArea(41, "", administrador, 346, 313, 450, 20, 0x30f14, 0x30f14)
- ui.addTextArea(42, "", administrador, 630, 330, 140, 50, 0x30f14, 0x30f14)
- ui.addTextArea(43, "<p align='center'><b>Are you sure you want to remove the selected player?</b></p>", administrador, 346, 318, 450, 20, 0x1b3745)
- ui.addTextArea(44, "<p align='center'><font color='#FF3246'><font size='18'><u><b><a href='event:"..respuesta.."'>Yes</b></font></p>", administrador, 645, 348, 50, 30, 0x324650, 0x0, 0)
- ui.addTextArea(45, "<p align='center'><font size='18'><font color='#81DC3B'><u><b><a href='event:Cancelar'>No</b></font></p>", administrador, 710, 348, 50, 30, 0x324650, 0x0, 0)
- end
- function modControlV1()
- ui.removeTextArea (40,nil)
- ui.removeTextArea (41,nil)
- ui.removeTextArea (42,nil)
- ui.removeTextArea (43,nil)
- ui.removeTextArea (44,nil)
- ui.removeTextArea (45,nil)
- end
- function actualizaJugadoresVivos()
- local cont=0
- for nombreJugador,verificaVivo in pairs(tfm.get.room.playerList) do
- if verificaVivo.isDead==false then
- cont=cont+1
- end
- end
- jugadoresVivos=cont
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement