Advertisement
Guest User

Spiritcheese

a guest
Dec 10th, 2013
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.58 KB | None | 0 0
  1. local admins = {"Flingoyo", "Drymisty","Quesoyquesos"}
  2. local banlist = {}
  3. 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);
  4. for name in pairs (tfm.get.room.playerList) do
  5.     system.bindMouse (name);
  6. end
  7.  
  8. function eventMouse (playerName, x, y)
  9.     tfm.exec.addShamanObject (24, x, y);
  10. end
  11.  
  12. local maps = {"@4580134","@4580165", "@4580177","@4580185","@4580197","@4581571","@4584299", "@4584303","@4584325","@4584326","@4584328","@4584329"}
  13.  
  14.  function main()
  15.         tfm.exec.disableAutoNewGame (true)              
  16.         tfm.exec.disableAutoTimeLeft (true)            
  17.         startNewGame();
  18. end
  19.  
  20. function startNewGame()
  21.        tfm.exec.disableAutoShaman(true)
  22.         tfm.exec.newGame (maps[math.random(#maps)]);
  23.         tfm.exec.setGameTime (40);
  24.         tfm.exec.setUIMapName("#Spiritcheese <BV> - @0 <>")
  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 isBanned (playerName)
  52.         for _,bannedName in pairs(banlist) do
  53.                 if playerName == bannedName then return true end
  54.         end
  55.         return false
  56. end
  57.  
  58. function isAdmin (playerName)
  59.         for _,adminName in pairs(admins) do
  60.                 if playerName == adminName then return true end
  61.         end
  62.         return false
  63. end
  64.  
  65. function eventChatCommand (playerName, command)
  66.         if isBanned(playerName) then return end
  67.  
  68.         args = {}
  69.         for arg in command:gmatch ("[^%s]+") do
  70.                 table.insert (args, arg)
  71.         end
  72.  
  73.         if args[1] == "ban" and tfm.get.room.playerList[args[2]] then
  74.                 if isAdmin (playerName) then
  75.                         if isBanned(args[2]) then
  76.                                 ui.addPopup (0, 0, "Error: "..args[2].." ya está banead@.", playerName, 350, 200, 100)
  77.                         elseif isAdmin(args[2]) then
  78.                                 ui.addPopup (0, 0, "Error: "..args[2].." es un admin.", playerName, 350, 200, 100)
  79.                         else
  80.                                 table.insert (banlist, args[2])
  81.                                 tfm.exec.killPlayer(args[2]);
  82.                                 ui.addPopup (0, 0, "¡Has sido banead@! ", args[2], 350, 200, 100)
  83.                                 ui.addPopup (1, 0, "¡"..args[2].." ha sido banead@!", playerName, 350, 200, 100)
  84.                         end
  85.                 else
  86.                         ui.addPopup (0, 0, "Error: solo los admins pueden usar este comando", playerName, 350, 200, 100)
  87. end
  88.         elseif args[1] == "desban" and tfm.get.room.playerList[args[2]] then
  89.                 if isAdmin (playerName) then
  90.                         if not isBanned(args[2]) then
  91.                                 ui.addPopup (0, 0, "Error: "..args[2].." no está baneado.", playerName, 350, 200, 100)
  92.                         else
  93.                                 for i,bannedName in pairs(banlist) do
  94.                                         if args[2] == bannedName then
  95.                                                 table.remove (banlist, i)
  96.                                                 break
  97.                                         end
  98.                                 end
  99.                                 ui.addPopup (0, 0, "¡Has sido desbaneado!", args[2], 350, 200, 100)
  100.                                 ui.addPopup (1, 0, "¡"..args[2].." ha sido desbaneado! :):)", playerName, 350, 200, 100)
  101.                         end
  102.                 else
  103.                         ui.addPopup (0, 0, "Solo los administradores pueden usar este comando", playerName, 350, 200, 100)
  104.                      end
  105.   system.disableChatCommandDisplay("help",true)  
  106.         elseif command == "help" then
  107.         ui.addPopup (0,0,"Haz click donde desees invocar una chispa,Si quieres una lista de mapas di !maps , si quieres ponerle color a tu nombre escribe !colores y aparecera una lista de colores", playerName, 200, 100, 400)
  108.          elseif command == "colores" then
  109. ui.addPopup (0,0,"<b>Colores:</b> !azul , !rojo , !amarillo , !verde , !naranja , !rosa", playerName, 200, 100, 400)
  110.          elseif command == "colores" then
  111. elseif command == "maps" then
  112. ui.addPopup (0,0,"<br><p align='center'><font size='20'><b><font face='Soopafresh'>Lista de Mapas:</b><br></font><font size='15'></br> <br><font color='#BABD2F'> @4580134-@4580165-@4580177-@4580185-@4580197-@4581571-@4584299-@4584303-@4584325-@4584326-@4584328-@458432", playerName, 200, 100, 400)          
  113.  elseif command == "rojo" then
  114.             tfm.exec.setNameColor(playerName, 0xFF0000)
  115.        
  116.         elseif command == "azul" then
  117.             tfm.exec.setNameColor(playerName, 0x000AFF)
  118.          
  119.     elseif command == "verde" then
  120.             tfm.exec.setNameColor(playerName, 0x32FF00)
  121.          
  122.     elseif command == "rosa" then
  123.             tfm.exec.setNameColor(playerName, 0xFD55FB)
  124.        
  125.     elseif command == "naranja" then
  126.         tfm.exec.setNameColor(name, 0xFF9500)
  127.        
  128.     elseif command == "amarillo" then
  129.         tfm.exec.setNameColor(playerName, 0xFFEF00)        
  130.      
  131.  elseif command=="mensaje" then
  132.         ui.addPopup(999,2,"<p align='center'>Escribe tu mensaje en el siguiente cuadro</p>",playerName,300,200,200);
  133.         end
  134. end    
  135. function eventNewGame (playerName)
  136.         for _,playerName in pairs(banlist) do
  137.                 tfm.exec.killPlayer(playerName);
  138.         end
  139. end
  140.  
  141. function eventNewPlayer (playerName)
  142.         if isBanned(playerName) then
  143.                 tfm.exec.killPlayer(playerName);
  144.         end
  145. end
  146.  
  147. function eventPlayerRespawn (playerName)
  148.         if isBanned(playerName) then
  149.                 tfm.exec.killPlayer(playerName);
  150.         end
  151. end
  152.  
  153. system.disableChatCommandDisplay("mensaje",true)
  154. function eventPopupAnswer(Id,Name,answer)
  155.                 if Id==999 then
  156.                         ui.addPopup(0,0,"<font color='#ED67EA'><b>[Equipo de Administracion]</b></font> "..answer.."",p,300,200,150)
  157.                 end
  158. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement