Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local admins = {"Thetroz"}
- local banlist = {}
- ui.addPopup (1,0,"Bienvenido a Spiritcheese, minijuego creado por Flingoyo, Drymisty y Quesoyquesos, créditos a Thetroz por su valiosa ayuda. escribe !help para ver una lista de comandos y una pequeña ayuda.", nil, 250, 100, 300);
- for name in pairs (tfm.get.room.playerList) do
- system.bindMouse (name);
- end
- function eventMouse (playerName, x, y)
- tfm.exec.addShamanObject (24, x, y);
- end
- local maps = {"@4580112", "@4580134", "@4580171", "@4580165", "@4580177", "@4580185","@4580197", "@4580640", "@4580645", "@4581538", "@4581571"}
- function main()
- tfm.exec.disableAutoNewGame (true)
- tfm.exec.disableAutoTimeLeft (true)
- startNewGame();
- end
- function startNewGame()
- tfm.exec.disableAutoShaman(true)
- tfm.exec.newGame (maps[math.random(#maps)]);
- tfm.exec.setGameTime (43);
- end
- function eventLoop (a, timeLeft)
- if timeLeft <= 0 then
- startNewGame();
- end
- end
- function eventPlayerDied (playerName)
- local playersAlive = 0;
- local winner;
- for player in pairs(tfm.get.room.playerList) do
- if not tfm.get.room.playerList[player].isDead then
- playersAlive = playersAlive + 1;
- winner = player;
- end
- end
- if (playersAlive ==0) then
- startNewGame();
- end
- end
- main();
- function eventChatCommand(name,command)
- if command == "help" then
- ui.addPopup (0,0,"Haz click donde desees invocar una chispa, si quieres ponerle color a tu nombre escribe, !rojo o !azul, !amarillo, !naranja, !rosa, !verde.", name, 200, 100, 400)
- elseif command == "rojo" then
- tfm.exec.setNameColor(name, 0xFF0000)
- elseif command == "azul" then
- tfm.exec.setNameColor(name, 0x000AFF)
- elseif command == "verde" then
- tfm.exec.setNameColor(name, 0x32FF00)
- elseif command == "rosa" then
- tfm.exec.setNameColor(name, 0xFD55FB)
- elseif command == "naranja" then
- tfm.exec.setNameColor(name, 0xFF9500)
- elseif command == "amarillo" then
- tfm.exec.setNameColor(name, 0xFFEF00)
- end
- end
- function isBanned (playerName)
- for _,bannedName in pairs(banlist) do
- if playerName == bannedName then return true end
- end
- return false
- end
- function isAdmin (playerName)
- for _,adminName in pairs(admins) do
- if playerName == adminName then return true end
- end
- return false
- end
- function eventChatCommand (playerName, command)
- if isBanned(playerName) then return end
- args = {}
- for arg in command:gmatch ("[^%s]+") do
- table.insert (args, arg)
- end
- if args[1] == "ban" and tfm.get.room.playerList[args[2]] then
- if isAdmin (playerName) then
- if isBanned(args[2]) then
- ui.addPopup (0, 0, "Error: "..args[2].." ya está banead@.", playerName, 350, 200, 100)
- elseif isAdmin(args[2]) then
- ui.addPopup (0, 0, "Error: "..args[2].." es un admin.", playerName, 350, 200, 100)
- else
- table.insert (banlist, args[2])
- tfm.exec.killPlayer(args[2]);
- ui.addPopup (0, 0, "¡Has sido banead@! ", args[2], 350, 200, 100)
- ui.addPopup (1, 0, "¡"..args[2].." ha sido banead@!", playerName, 350, 200, 100)
- end
- else
- ui.addPopup (0, 0, "Error: solo los admins pueden usar este comando", playerName, 350, 200, 100)
- end
- elseif args[1] == "desban" and tfm.get.room.playerList[args[2]] then
- if isAdmin (playerName) then
- if not isBanned(args[2]) then
- ui.addPopup (0, 0, "Error: "..args[2].." no está baneado.", playerName, 350, 200, 100)
- else
- for i,bannedName in pairs(banlist) do
- if args[2] == bannedName then
- table.remove (banlist, i)
- break
- end
- end
- ui.addPopup (0, 0, "¡Has sido desbaneado!", args[2], 350, 200, 100)
- ui.addPopup (1, 0, "¡"..args[2].." ha sido desbaneado! :):)", playerName, 350, 200, 100)
- end
- else
- ui.addPopup (0, 0, "Error: solo los admins pueden usar este comando", playerName, 350, 200, 100)
- end
- end
- end
- function eventNewGame (playerName)
- for _,playerName in pairs(banlist) do
- tfm.exec.killPlayer(playerName);
- end
- end
- function eventNewPlayer (playerName)
- if isBanned(playerName) then
- tfm.exec.killPlayer(playerName);
- end
- end
- function eventPlayerRespawn (playerName)
- if isBanned(playerName) then
- tfm.exec.killPlayer(playerName);
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement