Guest User

Spiritcheese

a guest
Dec 9th, 2013
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local admins = {"Thetroz"}
  2. local banlist = {}
  3.  
  4. 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);
  5. for name in pairs (tfm.get.room.playerList) do
  6.     system.bindMouse (name);
  7. end
  8.  
  9. function eventMouse (playerName, x, y)
  10.     tfm.exec.addShamanObject (24, x, y);
  11. end
  12.  
  13. local maps = {"@4580112", "@4580134", "@4580171", "@4580165", "@4580177", "@4580185","@4580197", "@4580640", "@4580645", "@4581538", "@4581571"}
  14.  
  15.  function main()
  16.         tfm.exec.disableAutoNewGame (true)              
  17.         tfm.exec.disableAutoTimeLeft (true)            
  18.         startNewGame();
  19. end
  20.  
  21. function startNewGame()
  22.        tfm.exec.disableAutoShaman(true)
  23.         tfm.exec.newGame (maps[math.random(#maps)]);
  24.     tfm.exec.setGameTime (43);
  25. end
  26.  
  27. function eventLoop (a, timeLeft)
  28.         if timeLeft <= 0 then
  29.                 startNewGame();
  30.         end
  31. end
  32.  
  33. function eventPlayerDied (playerName)
  34.         local playersAlive = 0;
  35.         local winner;
  36.        
  37.         for player in pairs(tfm.get.room.playerList) do
  38.                 if not tfm.get.room.playerList[player].isDead then
  39.                         playersAlive = playersAlive + 1;
  40.                         winner = player;
  41.                 end
  42.         end
  43.                    
  44.         if (playersAlive ==0) then
  45.                 startNewGame();
  46.         end
  47. end
  48.  
  49. main();
  50.  
  51. function eventChatCommand(name,command)
  52.     if command == "help" then
  53.         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)
  54.         elseif command == "rojo" then
  55.             tfm.exec.setNameColor(name, 0xFF0000)        
  56.         elseif command == "azul" then
  57.             tfm.exec.setNameColor(name, 0x000AFF)        
  58.     elseif command == "verde" then
  59.             tfm.exec.setNameColor(name, 0x32FF00)        
  60.     elseif command == "rosa" then
  61.             tfm.exec.setNameColor(name, 0xFD55FB)        
  62.     elseif command == "naranja" then
  63.         tfm.exec.setNameColor(name, 0xFF9500)        
  64.     elseif command == "amarillo" then
  65.         tfm.exec.setNameColor(name, 0xFFEF00)        
  66.         end
  67. end
  68.  
  69. function eventPlayerDied (name)
  70.     tfm.exec.respawnPlayer(name)
  71. end
  72.  
  73. function isBanned (playerName)
  74.         for _,bannedName in pairs(banlist) do
  75.                 if playerName == bannedName then return true end
  76.         end
  77.         return false
  78. end
  79.  
  80. function isAdmin (playerName)
  81.         for _,adminName in pairs(admins) do
  82.                 if playerName == adminName then return true end
  83.         end
  84.         return false
  85. end
  86.  
  87. function eventChatCommand (playerName, command)
  88.         if isBanned(playerName) then return end
  89.  
  90.         args = {}
  91.         for arg in command:gmatch ("[^%s]+") do
  92.                 table.insert (args, arg)
  93.         end
  94.  
  95.         if args[1] == "ban" and tfm.get.room.playerList[args[2]] then
  96.                 if isAdmin (playerName) then
  97.                         if isBanned(args[2]) then
  98.                                 ui.addPopup (0, 0, "Error: "..args[2].." ya está banead@.", playerName, 350, 200, 100)
  99.                         elseif isAdmin(args[2]) then
  100.                                 ui.addPopup (0, 0, "Error: "..args[2].." es un admin.", playerName, 350, 200, 100)
  101.                         else
  102.                                 table.insert (banlist, args[2])
  103.                                 tfm.exec.killPlayer(args[2]);
  104.                                 ui.addPopup (0, 0, "¡Has sido banead@! ", args[2], 350, 200, 100)
  105.                                 ui.addPopup (1, 0, "¡"..args[2].." ha sido banead@!", playerName, 350, 200, 100)
  106.                         end
  107.                 else
  108.                         ui.addPopup (0, 0, "Error: solo los admins pueden usar este comando", playerName, 350, 200, 100)
  109.                 end
  110.                 end
  111. end
Advertisement
Add Comment
Please, Sign In to add comment