Guest User

V 1.0 -Agregado Admin

a guest
Dec 11th, 2013
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. print '<r>JuEgO_aCtIvAdO'
  2. system.disableChatCommandDisplay ("colores", true)
  3. system.disableChatCommandDisplay ("comandos", true)
  4. system.disableChatCommandDisplay ("ban", true)
  5. system.disableChatCommandDisplay ("desban", true)
  6. system.disableChatCommandDisplay ("mapas", true)
  7. system.disableChatCommandDisplay ("azul", true)
  8. system.disableChatCommandDisplay ("rojo", true)
  9. system.disableChatCommandDisplay ("amarillo", true)
  10. system.disableChatCommandDisplay ("verde", true)
  11. system.disableChatCommandDisplay ("rosa", true)
  12. local admins = {"Quesoyquesos","Flingoyo","Drymisty"}
  13. local banlist = {}
  14. ui.addPopup (1,0,"Bienvenido a Spiritcheese, minijuego creado por Flingoyo, Drymisty y Quesoyquesos, créditos a Thetroz por su valiosa ayuda.Escribe <b>!comandos</b> para ver una lista de <b>comandos</b> disponibles.", nil, 250, 100, 300);
  15. for name in pairs (tfm.get.room.playerList) do
  16.     system.bindMouse (name);
  17. end
  18.  
  19. function eventMouse (playerName, x, y)
  20.     tfm.exec.addShamanObject (24, x, y);
  21. end
  22.  
  23. local maps = {"@4580134","@4580165", "@4580177","@4580185","@4580197","@4581571","@4584299", "@4584303","@4584325","@4584326","@4584328","@4584329"}
  24.  
  25.  function main()
  26.         tfm.exec.disableAutoNewGame (true)              
  27.         tfm.exec.disableAutoTimeLeft (true)            
  28.         startNewGame();
  29. end
  30.  
  31. function startNewGame()
  32.        tfm.exec.disableAutoShaman(true)
  33.         tfm.exec.newGame (maps[math.random(#maps)]);
  34.         tfm.exec.setGameTime (45);
  35.         tfm.exec.setUIMapName("#Spiritcheese <BV> - @0 <>")
  36. end
  37.  
  38. function eventLoop (a, timeLeft)
  39.         if timeLeft <= 0 then
  40.                 startNewGame();
  41.         end
  42. end
  43.  
  44. function eventPlayerDied (playerName)
  45.         local playersAlive = 0;
  46.         local winner;
  47.        
  48.         for player in pairs(tfm.get.room.playerList) do
  49.                 if not tfm.get.room.playerList[player].isDead then
  50.                         playersAlive = playersAlive + 1;
  51.                         winner = player;
  52.                 end
  53.         end
  54.                    
  55.         if (playersAlive ==0) then
  56.                 startNewGame();
  57.         end
  58. end
  59.  
  60. main();
  61.  
  62. function isBanned (playerName)
  63.         for _,bannedName in pairs(banlist) do
  64.                 if playerName == bannedName then return true end
  65.         end
  66.         return false
  67. end
  68.  
  69. function isAdmin (playerName)
  70.         for _,adminName in pairs(admins) do
  71.                 if playerName == adminName then return true end
  72.         end
  73.         return false
  74. end
  75.  
  76. function eventChatCommand (playerName, command)
  77.         if isBanned(playerName) then return end
  78.  
  79.         args = {}
  80.         for arg in command:gmatch ("[^%s]+") do
  81.                 table.insert (args, arg)
  82.         end
  83.  
  84.         if args[1] == "ban" and tfm.get.room.playerList[args[2]] then
  85.                 if isAdmin (playerName) then
  86.                         if isBanned(args[2]) then
  87.                                 ui.addPopup (0, 0, "Error: "..args[2].." ya está banead@.", playerName, 350, 200, 100)
  88.                         elseif isAdmin(args[2]) then
  89.                                 ui.addPopup (0, 0, "Error: "..args[2].." es un admin.", playerName, 350, 200, 100)
  90.                         else
  91.                                 table.insert (banlist, args[2])
  92.                                 tfm.exec.killPlayer(args[2]);
  93.                                 ui.addPopup (0, 0, "¡Has sido banead@! ", args[2], 350, 200, 100)
  94.                                 ui.addPopup (1, 0, "¡"..args[2].." ha sido banead@!", playerName, 350, 200, 100)
  95.                         end
  96.                 else
  97.                         ui.addPopup (0, 0, "Error: solo los admins pueden usar este comando", playerName, 350, 200, 100)
  98. end
  99.         elseif args[1] == "desban" and tfm.get.room.playerList[args[2]] then
  100.                 if isAdmin (playerName) then
  101.                         if not isBanned(args[2]) then
  102.                                 ui.addPopup (0, 0, "Error: "..args[2].." no está baneado.", playerName, 350, 200, 100)
  103.                         else
  104.                                 for i,bannedName in pairs(banlist) do
  105.                                         if args[2] == bannedName then
  106.                                                 table.remove (banlist, i)
  107.                                                 break
  108.                                         end
  109.                                 end
  110.                                 ui.addPopup (0, 0, "¡Has sido desbaneado!", args[2], 350, 200, 100)
  111.                                 ui.addPopup (1, 0, "¡"..args[2].." ha sido desbaneado! :):)", playerName, 350, 200, 100)
  112.                         end
  113.                 else
  114.                         ui.addPopup (0, 0, "Solo los administradores pueden usar este comando", playerName, 350, 200, 100)
  115.                      end
  116.   system.disableChatCommandDisplay("help",true)  
  117.         elseif command == "help" then
  118.         ui.addPopup (0,0,"<b>Haz click donde desees invocar una chispa</b>.", playerName, 200, 100, 400)
  119.          elseif command == "colores" then
  120. ui.addPopup (0,0,"<b>Colores:</b> !azul , !rojo , !amarillo , !verde , !naranja , !rosa", playerName, 200, 100, 400)
  121.          elseif command == "colores" then
  122. elseif command == "mapas" then
  123. 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)          
  124.  elseif command == "rojo" then
  125.             tfm.exec.setNameColor(playerName, 0xFF0000)
  126.        
  127.         elseif command == "azul" then
  128.             tfm.exec.setNameColor(playerName, 0x000AFF)
  129.          
  130.     elseif command == "verde" then
  131.             tfm.exec.setNameColor(playerName, 0x32FF00)
  132.          
  133.     elseif command == "rosa" then
  134.             tfm.exec.setNameColor(playerName, 0xFD55FB)
  135.        
  136.     elseif command == "naranja" then
  137.         tfm.exec.setNameColor(name, 0xFF9500)
  138.        
  139.     elseif command == "amarillo" then
  140.         tfm.exec.setNameColor(playerName, 0xFFEF00)        
  141. elseif command == "comandos" then
  142.         ui.addPopup (0,0,"<br><p align='center'><font size='20'><b><font face='Soopafresh'>Comandos Disponibles</b><br></font><font size='15'></br> <br><font color='#FD55FB'> !help = Te muestra ayuda sobre este Script</b><br></font><font size='15'></br> <br><font color='#FD55FB'>!mapas = Te muestra los mapas del Script</b><br></font><font size='15'></br> <br><font color='#FD55FB'> !colores = Te muestra los colores que te puedes poner para tu nombre :O", playerName, 200, 100, 400)    
  143.  elseif command=="mensaje" then
  144.         ui.addPopup(999,2,"<p align='center'>Escribe tu mensaje en el siguiente cuadro</p>",playerName,300,200,200);
  145.         end
  146. end    
  147. function eventNewGame (playerName)
  148.         for _,playerName in pairs(banlist) do
  149.                 tfm.exec.killPlayer(playerName);
  150.         end
  151. end
  152.  
  153. function eventNewPlayer (playerName)
  154.         if isBanned(playerName) then
  155.                 tfm.exec.killPlayer(playerName);
  156.         end
  157. end
  158.  
  159. function eventPlayerRespawn (playerName)
  160.         if isBanned(playerName) then
  161.                 tfm.exec.killPlayer(playerName);
  162.         end
  163. end
  164.  
  165. system.disableChatCommandDisplay("mensaje",true)
  166. function eventPopupAnswer(Id,Name,answer)
  167.                 if Id==999 then
  168.                         ui.addPopup(0,0,"<font color='#ED67EA'><b>[Equipo de Administracion]</b></font> "..answer.."",p,300,200,150)
  169.                 end
  170. end
Advertisement
Add Comment
Please, Sign In to add comment