Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tfm.exec.disableAutoShaman()
- tfm.exec.disableAutoNewGame()
- tfm.exec.disableAutoTimeLeft()
- tfm.exec.newGame("@7727559")
- tfm.exec.setUIMapName("<n>Creado por</n> <j>+Lknx#0000</j>")
- local ADMINISTRADOR = "+Lknx#0000" --
- local WINS = 15 --
- system.disableChatCommandDisplay("np", true)
- system.disableChatCommandDisplay("ani", true)
- system.disableChatCommandDisplay("equipo1", true)
- system.disableChatCommandDisplay("equipo2", true)
- system.disableChatCommandDisplay("puntaje", true)
- system.disableChatCommandDisplay("resultado", true)
- system.disableChatCommandDisplay("saltar", true)
- system.disableChatCommandDisplay("pausa", true)
- tfm.exec.disablePhysicalConsumables()
- tfm.exec.disableAutoShaman()
- tfm.exec.disableAutoNewGame()
- tfm.exec.disableAutoTimeLeft()
- --[[
- ]]
- local teams = {
- [1] = {},
- [2] = {},
- }
- local points = {
- [1] = 0,
- [2] = 0,
- }
- local admin_buttons = {
- ['Saltar'] = function(admin)
- eventChatCommand(admin, 'np')
- end,
- ['Mapa (Leve)'] = function(admin)
- eventChatCommand(admin, 'npp ant')
- end,
- ['Mapa (Pulo)'] = function(admin)
- eventChatCommand(admin, 'npp ant pulo'"ff6347",
- [2] = "19b5fe"
- }
- local queue = {}
- function newMap()
- local mapcode = maps[math.random(#maps)]
- if #queue > 0 then
- mapcode = queue[1]
- table.remove(queue, 1)
- end
- if not PAUSED == true then
- tfm.exec.newGame(mapcode)
- end
- tfm.exec.setUIMapName("<n>Creado por</n> <j>+Lknx#0000</j>")
- tfm.exec.newGame(mapcode)
- for player, data in pairs(tfm.get.room.playerList) do
- if not playersInGame[player] then
- tfm.exec.killPlayer(player)
- end
- end
- tfm.exec.setGameTime(120)
- end
- function eventPlayerWon(player)
- if not isfirst then
- isfirst = true
- tfm.exec.setGameTime(1)
- if table.contains(teams[1], player) then
- tfm.exec.setGameTime(1)
- for i = 0, 3 do
- defaultEffect(9, {13}, math.random(800), math.random(400), 20)
- end
- points[1] = points[1]+1
- elseif table.contains(teams[2], player) then
- tfm.exec.setGameTime(1)
- for i = 0, 3 do
- defaultEffect(9, {9}, math.random(800), math.random(400), 20)
- end
- points[2] = points[2]+1
- else
- isfirst = false
- end
- winner = false
- if points[1] >= WINS then
- winner = 1
- elseif points[2] >= WINS then
- winner = 2
- end
- if winner then
- gameRunning = false
- winTime = os.time()
- ui.addTextArea(22, string.format("<p align='center'><font size='37' color='#%s'><font face='Century Gothic'>¡EL EQUIPO %s ES EL GANADOR!", colors[winner], winner), nil, 1, 170, 800, 500, 0, 0, 0, true)
- end
- displayScore()
- end
- end
- function eventLoop(elapsed, remain)
- if gameRunning then
- remain = remain/1000
- if remain < 0 then
- remain = 100
- newMap()
- end
- else
- if winTime then
- if winTime > os.time()-30000 then
- for i = 0, 2 do
- defaultEffect(9, {11, 9, 0, 13}, math.random(800), math.random(400), 80)
- end
- else
- winTime = false
- ui.removeTextArea(20)
- ui.removeTextArea(21)
- ui.removeTextArea(22)
- displayTeams()
- teams = {
- [1] = {},
- [2] = {},
- }
- points = {
- [1] = 0,
- [2] = 0,
- }
- playersInGame = {}
- end
- end
- end
- end
- function eventChatCommand(player, command)
- if player:lower() == ADMINISTRADOR:lower() then
- args = string.split(command, " ")
- if args[1] == "equipo1" then
- table.remove(args, 1)
- teams[1] = {}
- points[1] = 0
- for index, player in pairs(args) do
- table.insert(teams[1], player)
- playersInGame[player] = true
- end
- displayTeams()
- elseif args[1] == "equipo2" then
- table.remove(args, 1)
- teams[2] = {}
- points[2] = 0
- for index, player in pairs(args) do
- table.insert(teams[2], player)
- playersInGame[player] = true
- end
- displayTeams()
- elseif args[1] == "puntaje" then
- if args[2] and args[3] then
- local team = tonumber(args[2]:match("team(%d+)") or 0)
- if team > 0 and team < 3 then
- local newScore = tonumber(args[3]) or points[team]
- points[team] = newScore
- displayScore()
- end
- end
- elseif args[1] == "ani" then
- if args[2] == "si" then
- PAUSED = true
- print("a")
- ui.addTextArea(128, "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<p align='center'><font size='20'>Ani la más <font color='#F5FA51'>linda</font>", nil, -492, -186, 1783, 943, 0x1b1c1c, 0x000000, 1, true)
- end
- if args[2] == "no" then
- PAUSED = false
- print("b")
- ui.removeTextArea(128,nil)
- end
- elseif args[1] == "pausa" then
- if args[2] == "activar" then
- PAUSED = true
- print("a")
- ui.addTextArea(127, "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<p align='center'><font size='20'><font color='#F5FA51'>[ES]</font> El juego ha sido pausado</font>\n\n<p align='center'><font size='20'><font color='#F5FA51'>[EN]</font> The game has been paused</font>\n\n<p align='center'><font size='20'><font color='#F5FA51'>[BR]</font> O jogo foi pausado</font>\n\n<p align='center'><font size='20'><font color='#F5FA51'>[TR]</font> Oyun duraklatıldı</font>\n\n<p align='center'><font size='20'><font color='#F5FA51'>[FR]</font> Le jeu a été interrompu</font>\n\n<p align='center'><font size='20'><font color='#F5FA51'>[PL]</font> Gra została wstrzymana</font>", nil, -489, -167, 1782, 942, 0x1b1c1c, 0x000000, 1, true)
- end
- if args[2] == "desactivar" then
- PAUSED = false
- print("b")
- ui.removeTextArea(127,nil)
- end
- elseif args[1] == "saltar" then
- newMap()
- elseif args[1] == "np" then
- if args[2] then
- table.insert(queue, args[2])
- end
- elseif args[1] == "resultado" then
- if args[2] then
- WINS = tonumber(args[2])
- displayScore()
- end
- elseif args[1] == "np" then
- if args[2] then
- table.insert(queue, args[2])
- end
- end
- end
- end
- function eventNewGame()
- if gameRunning then
- isfirst = false
- for i, p in pairs(teams[1]) do
- tfm.exec.setNameColor(p, "0x"..colors[1])
- end
- for i, p in pairs(teams[2]) do
- tfm.exec.setNameColor(p, "0x"..colors[2])
- end
- displayScore()
- end
- end
- function displayScore()
- ui.addTextArea(190, "", nil, 345, -30, 121, 30, 0x1b1c1c, 0xffffff, 1, true)
- ui.addTextArea(19, string.format("<p align='center'><font size='23'><font color='#%s'>%s<N> - <font color='#%s'>%s", colors[1], points[1], colors[2], points[2]), nil, 345, -30, 121, 30, 0, 0, 0, true)
- end
- function displayTeams()
- ui.addTextArea(300, "", nil, -492, -186, 1783, 943, 0x0a0a0a, 0x000000, 1, true)
- ui.addTextArea(1, "", nil, 199, 69, 400, 260, 0x5A7A8B, 0x5A7A8B, 1, true)
- ui.addTextArea(2, "", nil, 201, 71, 400, 260, 0x0E1417, 0x0E1417, 1, true)
- ui.addTextArea(4, "", nil, 209, 79, 142, 22, 0x324650, 0x5A7A8B, 1, true)
- ui.addTextArea(5, "<p align='center'><font color='#ffffff'>Equipo 1", nil, 210, 80, 140, 20, 0x202324, 0x000000, 1, true)
- ui.addTextArea(6, "", nil, 449, 79, 142, 22, 0x324650, 0x5A7A8B, 1, true)
- ui.addTextArea(7, "<p align='center'><font color='#ffffff'>Equipo 2", nil, 450, 80, 140, 20, 0x202324, 0x000000, 1, true)
- ui.addTextArea(10, "", nil, 209, 120, 140, 200, 0x5A7A8B, 0x5A7A8B, 1, true)
- ui.addTextArea(11, "<p align='center'><font color='#"..colors[1].."'>"..table.concat(teams[1], "\n"), nil, 210, 121, 138, 198, 0x202324, 0x000000, 1, true)
- ui.addTextArea(12, "", nil, 451, 120, 140, 200, 0x5A7A8B, 0x5A7A8B, 1, true)
- ui.addTextArea(13, "<p align='center'><font color='#"..colors[2].."'>"..table.concat(teams[2], "\n"), nil, 452, 121, 138, 198, 0x202324, 0x000000, 1, true)
- ui.addTextArea(15, "", nil, 380, 202, 40, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
- ui.addTextArea(16, "<p align='center'><font color='#ffffff'>VS", nil, 381, 203, 38, 18, 0x202324, 0x000000, 1, true)
- ui.addTextArea(16, "<p align='center'><font color='#ffffff'><a href='event:iniciarJogo'>GO", ADMINISTRADOR, 381, 203, 38, 18, 0x202324, 0x202324, 1, true)
- ui.addTextArea(19, "<p align='center'><b>LUA VERSUS RACING</b>", nil, 322, 32, 162, 19, 0x202324, 0x000000, 1, true)
- ui.addTextArea(20, "<p align='center'><b>Modalidad:</b> Racing", nil, 670, 28, 126, 19, 0x202324, 0x000000, 1, true)
- end
- function eventTextAreaCallback(id, player, callback)
- if callback == 'iniciarJogo' then
- if #teams[2] > 0 and #teams[1] > 0 then
- gameRunning = true
- for i = 1, 16 do
- ui.removeTextArea(i)
- end
- defaultEffect(9, {9}, 400, 212, 80)
- newMap()
- ui.removeTextArea(20)
- ui.removeTextArea(300)
- end
- end
- end
- function string.split(s, pattern, n)
- local st = {}
- for sb in string.gmatch(s, "[^"..pattern.."]+") do
- if not n or n > -1 then
- table.insert(st,sb)
- else
- st[#st] = st[#st]..pattern..sb
- end
- n = n and n-1 or false
- end
- return st
- end
- function table.contains(tableT, element)
- for _, value in pairs(tableT) do
- if value == element then
- return true
- end
- end
- return false
- end
- defaultEffect=function(id,p,x,y,rand) -- thanks for the function santah
- local minDist = 1
- local outerBorder = 20
- local maxDist = 30
- local totalParticles = rand and 40 or (id == -1 and 35 or 75)
- for i = 1, totalParticles do
- if rand then
- id = p[math.random(#p)]
- end
- local dist = math.min(math.random(minDist, maxDist), outerBorder)
- local angle = math.random(0, 360)
- local r = math.rad(angle)
- local dx = math.cos(r)
- local dy = math.sin(r)
- local vx = dist * dx / 10
- local vy = dist * dy / 10
- local ax = -vx / dist / 15
- local ay = (-vy / dist / 15) + 0.05
- if id == -1 then
- tfm.exec.displayParticle(9, x + dx, y + dy, vx, vy, ax, ay, nil)
- tfm.exec.displayParticle(1, x + dx, y + dy, vx, vy, ax, ay, nil)
- else
- tfm.exec.displayParticle(id, x + dx, y + dy, vx, vy, ax, ay, nil)
- end
- end
- end
- displayTeams()
- function eventPlayerDied()
- local alive = 0
- for k,v in pairs(tfm.get.room.playerList) do
- if not v.isDead then
- alive = alive+1
- end
- end
- if alive < 1 then
- tfm.exec.setGameTime(1)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement