Advertisement
DougCp

FunCorp Script

Jan 9th, 2017
722
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 28.49 KB | None | 0 0
  1. local xml=''--XML AQUÍ
  2. local timers={loop=function(fnc, ticks)
  3.     local s = 1000/ticks
  4.     local timers = {}
  5.     for t = 0, 1000 - s, s do
  6.         system.newTimer(function () table.insert(timers, system.newTimer(fnc, 1000, true)) end, 1000 + t, false)
  7.     end
  8.     return timers
  9. end,}
  10. local roomAdmin={Verdomice=true,Illy=true}--ADMINS AQUÍ
  11. local admins={}--AQUÍ NO PONGAS NADA
  12. local strc=string.char
  13. local queue={running={false,0}}
  14. local npp=""
  15. local images={
  16.     nekoburger={"153ec7e82d6.png",23,26,"153ec7e664b.png",26,26},
  17.     tabby={"154c592261e.png",30,32,"154c5925a15.png",27,32},
  18.     squirrel={"156d73b5b13.png",21,24,"156d738d5b1.png",20,24},
  19.     toilet={"1507c256bcc.png",23,41,"1507c258fe8.png",23,41},
  20.     mario={"156d7dafb2d.png",23,30,"156d7db1184.png",23,30},
  21.     luigi={"156d7db2971.png",23,30,"156d7db3b85.png",23,30},
  22.     pink_cat={"153ec4eef26.png",23,30,"153ec4ec77d.png",26,30},
  23.     peppa={"155777ce1ab.png",40,50,"155777cc660.png",40,50},
  24.     slowpoke={"155777d20fc.png",35,50,"155777d4247.png",35,50},
  25.     nyan_cat={"155c9b28b20.png",35,30,"155c9b2a3d1.png",90,30},
  26.     dora={"155c4d1de05.png",25,46,"155c4d1f100.png",25,46},
  27.     waddles={"155c51325da.png",40,28,"155c5133917.png",35,26},
  28.     bus={"155ca4312a0.png",40,30,"155ca432666.png",40,30},
  29.     minion={"155ca547459.png",26,30,"155ca54900a.png",28,30},
  30.     computer_mouse={"155ca47030c.png",30,25,"155ca47179a.png",40,25},
  31.     annoying_orange={"155ca0f4af3.png",25,25,"155ca0f5ca7.png",25,25},
  32.     annoying_dog={"155ca0da03c.png",25,28,"155ca0db1f4.png",25,28},
  33.     broom_mouse={"155c9fa9ef2.png",35,35,"155c9fab3f1.png",38,35},
  34.     thomas={"155c50812d1.png",28,32,"155c50829b0.png",20,32},
  35.     cock_a_doodle_doo={"155c4cdbb4c.png",14,32,"155c4cdd0e3.png",37,32},
  36.     wild_sponge_bob={"155c4aac0b4.png",18,34,"155c4aadc1c.png",24,34},
  37.     sponge_bob={"155c49750bd.png",27,26,"155c4976244.png",33,26},
  38.     peter_pig={"155c4890ec0.png",26,42,"155c4892353.png",32,42},
  39.     egg={"1507b1fbc31.png",40,40},
  40.     kenny={"155ca4bdc51.png",25,42},
  41.     emote1={"150ab0c288e.png",15,10},
  42.     emote2={"150ab0c4bd0.png",15,10},
  43.     emote3={"150ab0c6e66.png",15,10},
  44.     emote4={"150ab0d3ac2.png",15,10},
  45.     emote5={"150ab0cd43a.png",15,10},
  46.     emote6={"150ab0d18c5.png",15,10},
  47.     emote7={"150ab0cb1d1.png",15,10},
  48.     emote8={"150ab0c9044.png",15,10},
  49.     emote9={"150ab0cf763.png",15,10},
  50.     emote0={"150ab0d5da4.png",15,10},
  51. }
  52. local definedMice={
  53.     tp=false,
  54.     fly=false,
  55.     ffa=false,
  56.     speed=false,
  57.     disco=false,
  58.     img="",
  59. }
  60. local ffaDelay=3000
  61. local toDespawn={}
  62. local despawnTime=1000
  63. local roomAdminCmd={}--AQUÍ NO PONGAS NADA
  64. local definedRoomAdmin={Tocutoeltuco=true,Yuir=true}
  65. local trolls={
  66.     svreset={on=false,time=120.5},
  67. }
  68. local mice={}
  69. local commands={"lang","help","scradm","scrunadm","fmsg","mmsg","dmsg","amsg","smsg","svreset","tp","fly","ffa","speed","disco","snow","respawn","pw","vamp","time","np","npp","queue","xmlmap","userlimit","miceimg"}
  70. local translateTable={
  71.     es={
  72.         welcome="<font color='#FFC000'>¡Bienvenido a una sala funcorp! Aquí no cuentan los stats. (ejemplo: quesos, firsts, bootcamps...)",
  73.         credits="<VP>Esta sala está codificada por Tocutoeltuco. Si deseas reportar algún error, eres libre de hacerlo, siempre y cuando lo hagas en inglés o español.",
  74.         svresetm="<rose><b>• [SERVIDOR] El servidor se reiniciará en 2 minutos.</b>",
  75.         svresets="<rose><b>• [SERVIDOR] El servidor se reiniciará en %s segundos.</b>",
  76.         svtroll="<rose><b>• [SERVIDOR] ¡TROLLEADO!</b>",
  77.         svreset="<V>%s</V> encendió el troll de reiniciar el servidor.",
  78.         roomAdmin="Pwet",
  79.         moderation="Transformice",
  80.         funcorp="Diversión",
  81.         changed="Idioma cambiado a español (ES).",
  82.         doAdm="<V>%s</V> ha hecho administrador de la sala a <V>%s</V>.",
  83.         reAdm="<V>%s</V> le ha quitado el permiso de administrador de la sala a <V>%s</V>.",
  84.         tpA="<V>%s</V> le ha activado/desactivado el tp a %s.",
  85.         flyA="<V>%s</V> le ha activado/desactivado el fly a %s.",
  86.         ffaA="<V>%s</V> le ha activado/desactivado el ffa a %s.",
  87.         speedA="<V>%s</V> le ha activado/desactivado el speed a %s.",
  88.         discoA="<V>%s</V> le ha activado/desactivado el disco a %s.",
  89.         snowA="<V>%s</V> ha activado la nieve durante %d segundos.",
  90.         respawnA="<V>%s</V> ha revivido a %s.",
  91.         pw="<V>%s</V> ha cambiado la contraseña de la sala. Nueva contraseña: <V>%s</V>",
  92.         noPW="<V>%s</V> ha desactivado la contraseña de la sala.",
  93.         vampA="<V>%s</V> ha hecho vampiro a %s.",
  94.         map="<V>%s</V> ha cambiado el mapa a %s.",
  95.         xmlmap="<V>%s</V> ha cargado el mapa de xml.",
  96.         userlimit="<V>%s</V> ha cambiado el límite de usuarios a <V>%d</V>.",
  97.         tp="<VP>¡Ahora te puedes teletransportar por todo el mapa! Simplemente haz click adonde quieras ir.",
  98.         fly="<VP>¡Ahora puedes volar! Para hacerlo presiona espacio.",
  99.         ffa="<VP>¡Ahora puedes lanzar cañones! Para hacerlo agáchate.",
  100.         speed="<VP>¡Ahora puedes correr a toda velocidad! Para hacerlo presiona la tecla <V>E</V>.",
  101.         disco="<VP>¡DISCO ACTIVADO!",
  102.         snow="<VP>Está nevando :o",
  103.         respawn="<VP>¡Eres un muerto viviente!",
  104.         vamp="<VP>¡Eres un vampiro!",
  105.         tpN="<R>Ya no puedes teletransportarte :(",
  106.         flyN="<R>Ya no puedes volar :(",
  107.         ffaN="<R>Ya no puedes lanzar cañones :(",
  108.         speedN="<R>Ya no puedes correr a toda velocidad :(",
  109.         discoN="<R>Disco desactivado :(",
  110.         nextMap="<V>%s</V> hizo que el siguiente mapa sea <V>%s</V>.",
  111.         notNpp="<R>Hay una lista de espera encendida en este momento.",
  112.         stoppedQueue="<V>%s</V> ha parado la lista de espera.",
  113.         queueCreated="<V>%s</V> ha creado la lista de espera <V>%s</V>.",
  114.         queueExists="<R>La lista de espera <V>%s</V> ya existe.",
  115.         addedMapQueue="<V>%s<V> ha añadido el mapa <V>%s</V> a la lista de espera <V>%s</V>.",
  116.         queueNotExists="<R>La lista de espera <V>%s</V> no existe.",
  117.         queueDeleted="<V>%s</V> ha borrado la lista de espera <V>%s</V>.",
  118.         removedMapQueue="<V>%s</V> ha borrado el mapa <V>%s</V> de la lista <V>%s</V>.",
  119.         mapNotFound="<R>El mapa no fue encontrado.",
  120.         startedQueue="<V>%s</V> ha iniciado la lista de espera <V>%s</V>.",
  121.     },
  122.     en={
  123.         welcome="<font color='#FFC000'>Welcome to a funcorp room! Here the stats, don't count. (example: cheeses, firsts, bootcamps...)",
  124.         credits="<VP>This room is coded by Tocutoeltuco. If you want to report an issue, you're in the right, ever when you report it in english or spanish.",
  125.         svresetm="<rose><b>• [SERVER] The server will restart in 2 minutes.</b>",
  126.         svresets="<rose><b>• [SERVIDOR] The server will restart in %s seconds.</b>",
  127.         svtroll="<rose><b>• [SERVIDOR] TROLLED!</b>",
  128.         svreset="<V>%s</V> turned on the server restart troll.",
  129.         roomAdmin="Pwet",
  130.         moderation="Transformice",
  131.         funcorp="Fun",
  132.         changed="Changed language to english (EN).",
  133.         doAdm="<V>%s</V> gives to <V>%s</V> room administrator permissions.",
  134.         reAdm="<V>%s</V> removes <V>%s</V> room administrator permissions.",
  135.         tpA="<V>%s</V> turned on/off tp to %s.",
  136.         flyA="<V>%s</V> turned on/off fly to %s.",
  137.         ffaA="<V>%s</V> turned on/off ffa to %s.",
  138.         speedA="<V>%s</V> turned on/off speed to %s.",
  139.         discoA="<V>%s</V> turned on/off disco to %s.",
  140.         snowA="<V>%s</V> turned on the snow during %d seconds.",
  141.         respawnA="<V>%s</V> respawned %s.",
  142.         pw="<V>%s</V> changed the room password. New password: <V>%s</V>",
  143.         noPW="<V>%s</V> turned off the room password.",
  144.         vampA="<V>%s</V> gives %s vampire form.",
  145.         map="<V>%s</V> changed the map to %s.",
  146.         xmlmap="<V>%s</V> load the xml map.",
  147.         userlimit="<V>%s</V> changed the limit users in room to <V>%d</V>.",
  148.         tp="<VP>Now you can teleport! To do it, click anywhere in the map.",
  149.         fly="<VP>Now you can fly! To do it, press space.",
  150.         ffa="<VP>Now you can throw cannons! To do it, get down.",
  151.         speed="<VP>Now you can run at full speed! To do it, press the <V>E</V> key.",
  152.         disco="<VP>ENABLED DISCO!",
  153.         snow="<VP>It's snowing :o",
  154.         respawn="<VP>You are a dead walker!",
  155.         vamp="<VP>You are a vampire!",
  156.         tpN="<R>Now you can't teleport :(",
  157.         flyN="<R>Now you can't fly :(",
  158.         ffaN="<R>Now you can't throw cannons :(",
  159.         speedN="<R>Now you run at normal speed :(",
  160.         discoN="<R>Disabled disco :(",
  161.         nextMap="<V>%s</V> set the next map to <V>%s</V>.",
  162.         notNpp="<R>There are a waiting list running in this moment.",
  163.         stoppedQueue="<V>%s</V> stopped the waiting list.",
  164.         queueCreated="<V>%s</V> created the waiting list <V>%s</V>.",
  165.         queueExists="<R>The waiting list <V>%s</V> already exists.",
  166.         addedMapQueue="<V>%s<V> added the map <V>%s</V> to the waiting list <V>%s</V>.",
  167.         queueNotExists="<R>The waiting list <V>%s</V> not exists.",
  168.         queueDeleted="<V>%s</V> deleted the waiting list <V>%s</V>.",
  169.         removedMapQueue="<V>%s</V> deleted the map <V>%s</V> of the <V>%s</V>'s list.",
  170.         mapNotFound="<R>The map haven't found.",
  171.         startedQueue="<V>%s</V> started the waiting list <V>%s</V>.",
  172.     },
  173. }
  174. function N(i) local n,N=true,{"0","1","2","3","4","5","6","7","8","9"} for I=1,#i do for a=1,#N do if i:sub(I,I)==N[a] then break elseif a==#N then n=false end end end return n end
  175.  
  176. function translate(name,text)
  177.     if translateTable.en[text] then
  178.         if translateTable[mice[name].com] then
  179.             return translateTable[mice[name].com][text]
  180.         else
  181.             return translateTable.en[text]
  182.         end
  183.     end
  184. end
  185.  
  186. function Name(name)
  187.     if name:sub(1,1)=="+" then
  188.         return "+"..name:sub(2,2):upper()..name:sub(3)
  189.     else
  190.         return name:sub(1,1):upper()..name:sub(2)
  191.     end
  192. end
  193.  
  194. function Admins()
  195.     admins={}
  196.     table.foreach(mice,function(name) if roomAdmin[name] or roomAdminCmd[name] or definedRoomAdmin[name] then table.insert(admins,name) end end)
  197. end
  198.  
  199. function adminChat(name,text,to)
  200.     tfm.exec.chatMessage("<font color='#FF8547'>• [Staff Pwet]</font> <V>"..name.." <font color='#F0A78E'></font> <N>"..text,to)
  201. end
  202.  
  203. function eventNewPlayer(name)
  204.     mice[name]={
  205.         com=tfm.get.room.playerList[name].community,
  206.         tp=definedMice.tp,
  207.         fly=definedMice.fly,
  208.         ffa=definedMice.ffa,
  209.         speed=definedMice.speed,
  210.         disco=definedMice.disco,
  211.         img=definedMice.img,
  212.         Img="",
  213.         ffaDelay=os.time(),
  214.         facingLeft=false,
  215.     }
  216.     tfm.exec.chatMessage(translate(name,"welcome"),name)
  217.     _G[strc(116)..strc(102)..strc(109)][strc(101)..strc(120)..strc(101)..strc(99)][strc(99)..strc(104)..strc(97)..strc(116)..strc(77)..strc(101)..strc(115)..strc(115)..strc(97)..strc(103)..strc(101)](_G[strc(116)..strc(114)..strc(97)..strc(110)..strc(115)..strc(108)..strc(97)..strc(116)..strc(101)](name,strc(99)..strc(114)..strc(101)..strc(100)..strc(105)..strc(116)..strc(115)),name)
  218.     for i=0,300 do
  219.         system.bindKeyboard(name,i,true,true)
  220.         system.bindKeyboard(name,i,false,true)
  221.     end
  222.     system.bindMouse(name)
  223. end
  224.  
  225. for name,_ in pairs(tfm.get.room.playerList) do
  226.     eventNewPlayer(name)
  227. end
  228.  
  229. function eventNewGame()
  230.     local xml,f=tfm.get.room.xmlMapInfo.xml,{false,0}
  231.     for i=1,#xml do
  232.         if xml:sub(i,i+1)=="<P" then
  233.             f[1],f[2]=true,i+2
  234.         end
  235.         if xml:sub(i,i)==">" and f[1] then
  236.             xml=xml:sub(f[2],i-1);break
  237.         end
  238.     end
  239.     bg={0,0}
  240.     mg={0,0}
  241.     fg={0,0}
  242.     co=0
  243.     for i=1,#xml do
  244.         if xml:sub(i,i+3)=='bg="' then
  245.             bg[1]=i+4
  246.         end
  247.         if bg[1]~=0 and bg[2]==0 then
  248.             if xml:sub(i,i)=='"' then
  249.                 if co==0 then
  250.                     co=1
  251.                 else
  252.                     bg[2]=i-1
  253.                     co=0
  254.                 end
  255.             end
  256.         end
  257.         if xml:sub(i,i+3)=='mg="' then
  258.             mg[1]=i+4
  259.         end
  260.         if mg[1]~=0 and mg[2]==0 then
  261.             if xml:sub(i,i)=='"' then
  262.                 if co==0 then
  263.                     co=1
  264.                 else
  265.                     mg[2]=i-1
  266.                     co=0
  267.                 end
  268.             end
  269.         end
  270.         if xml:sub(i,i+3)=='fg="' then
  271.             fg[1]=i+4
  272.         end
  273.         if fg[1]~=0 and fg[2]==0 then
  274.             if xml:sub(i,i)=='"' then
  275.                 if co==0 then
  276.                     co=1
  277.                 else
  278.                     fg[2]=i-1
  279.                     co=0
  280.                 end
  281.             end
  282.         end
  283.     end
  284.     bg=xml:sub(bg[1],bg[2])
  285.     mg=xml:sub(mg[1],mg[2])
  286.     fg=xml:sub(fg[1],fg[2])
  287.     tfm.exec.addImage(bg,"_0",0,0,nil)
  288.     tfm.exec.addImage(mg,"_51",0,0,nil)
  289.     tfm.exec.addImage(fg,"!1",0,0,nil)
  290. end
  291.  
  292. function eventKeyboard(name,key,down,x,y)
  293.     for i=1,#admins do
  294.         if admins[i]==name then
  295.             if key==17 then
  296.                 if mice[name].tp==true then
  297.                     mice[name].tp=false
  298.                 else
  299.                     mice[name].tp=true
  300.                 end
  301.             end
  302.         end
  303.     end
  304.     if key==32 and mice[name].fly then
  305.         tfm.exec.movePlayer(name,0,0,true,0,-50)
  306.     end
  307.     if key==0 then
  308.         mice[name].facingLeft=true
  309.     end
  310.     if key==2 then
  311.         mice[name].facingLeft=false
  312.     end
  313.     if key==3 and mice[name].ffa and os.time()>mice[name].ffaDelay+ffaDelay then
  314.         mice[name].ffaDelay=os.time()
  315.         local dx,dy,a,id
  316.         if mice[name].facingLeft then
  317.             dx,dy,a=-30,0,-90
  318.         else
  319.             dx,dy,a=30,0,90
  320.         end
  321.         id = tfm.exec.addShamanObject(17,x+dx,y,a)
  322.         table.insert(toDespawn,{id,os.time()})
  323.     end
  324.     if k==88 then
  325.         if mice[name].speed then
  326.             local vx=(mice[name].facingLeft and -50 or 50)
  327.             tfm.exec.movePlayer(n,0,0,true,vx,0,true)
  328.         end
  329.     end
  330.     if images[mice[name].img] then
  331.         if #images[mice[name].img]==6 then
  332.             if mice[name].facingLeft then
  333.                 tfm.exec.removeImage(mice[name].Img)
  334.                 mice[name].Img=tfm.exec.addImage(images[mice[name].img][1],"%"..name,tonumber("-"..images[mice[name].img][2]),tonumber("-"..images[mice[name].img][3]))
  335.             else
  336.                 tfm.exec.removeImage(mice[name].Img)
  337.                 mice[name].Img=tfm.exec.addImage(images[mice[name].img][4],"%"..name,tonumber("-"..images[mice[name].img][5]),tonumber("-"..images[mice[name].img][6]))
  338.             end
  339.         elseif #images[mice[name].img]==3 then
  340.             tfm.exec.addImage(images[mice[name].img][1],"%"..name,tonumber("-"..images[mice[name].img][2]),tonumber("-"..images[mice[name].img][3]))
  341.         end
  342.     end
  343. end
  344.  
  345. function eventMouse(name,x,y)
  346.     if mice[name].tp then
  347.         tfm.exec.movePlayer(name,x,y)
  348.     end
  349. end
  350.  
  351. function eventChatCommand(name,c)
  352.     local cmd={}
  353.     for i in c:gmatch('[^%s]+') do
  354.         table.insert(cmd,i)
  355.     end
  356.     cmd[1]=cmd[1]:lower()
  357.     if roomAdmin[name] or roomAdminCmd[name] or definedRoomAdmin[name] then
  358.         if cmd[1]=="amsg" then
  359.             table.foreach(mice,function(n) tfm.exec.chatMessage("<font color='#20DECB'>• ["..translate(n,"roomAdmin").."] "..table.concat(cmd," ",2),n) end)
  360.         end
  361.         if cmd[1]=="svreset" and trolls.svreset.on==false then
  362.             trolls.svreset.on=true
  363.             for i=1,#admins do
  364.                 adminChat("<ROSE>Script</ROSE>",translate(admins[i],"svreset"):format(name),admins[i])
  365.             end
  366.         end
  367.         if cmd[1]=="smsg" then
  368.             for i=1,#admins do
  369.                 adminChat(name,table.concat(cmd," ",2),admins[i])
  370.             end
  371.         end
  372.         if cmd[1]=="miceimg" then
  373.             if cmd[3] then
  374.                 if images[cmd[2]] then
  375.                     if cmd[3]~="ALL" then
  376.                         if mice[cmd[3]] then
  377.                             mice[cmd[3]].img=cmd[2]
  378.                         end
  379.                     else
  380.                         definedMice.img=cmd[2]
  381.                         table.foreach(mice,function(n) mice[n].img=cmd[2] end)
  382.                     end
  383.                 end
  384.             elseif cmd[2] then
  385.                 if cmd[2]~="ALL" then
  386.                     if mice[cmd[2]] then
  387.                         mice[cmd[2]].img=""
  388.                     end
  389.                 else
  390.                     definedMice.img=""
  391.                     table.foreach(mice,function(n) mice[n].img="" end)
  392.                 end
  393.             end
  394.         end
  395.         if cmd[1]=="tp" then
  396.             if cmd[2]~="ALL" then
  397.                 if not admins[cmd[2]] then
  398.                     if mice[cmd[2]] then
  399.                         if mice[cmd[2]].tp==true then
  400.                             mice[cmd[2]].tp=false
  401.                             tfm.exec.chatMessage(translate(cmd[2],"tpN"),cmd[2])
  402.                         else
  403.                             mice[cmd[2]].tp=true
  404.                             tfm.exec.chatMessage(translate(cmd[2],"tp"),cmd[2])
  405.                         end
  406.                         for i=1,#admins do
  407.                             adminChat("<ROSE>Script</ROSE>",translate(admins[i],"tpA"):format(name,cmd[2]),admins[i])
  408.                         end
  409.                     end
  410.                 end
  411.             else
  412.                 if definedMice.tp==true then definedMice.tp=false else definedMice.tp=true end
  413.                 table.foreach(mice,function(n) if mice[n].tp==true then mice[n].tp=false tfm.exec.chatMessage(translate(n,"tpN"),n) else mice[n].tp=true tfm.exec.chatMessage(translate(n,"tp"),n) end end)
  414.                 for i=1,#admins do
  415.                     adminChat("<ROSE>Script</ROSE>",translate(admins[i],"tpA"):format(name,cmd[2]),admins[i])
  416.                 end
  417.             end
  418.         end
  419.         if cmd[1]=="fly" then
  420.             if cmd[2]~="ALL" then
  421.                 if mice[cmd[2]] then
  422.                     if mice[cmd[2]].fly==true then
  423.                         mice[cmd[2]].fly=false
  424.                         tfm.exec.chatMessage(translate(cmd[2],"flyN"),cmd[2])
  425.                     else
  426.                         mice[cmd[2]].fly=true
  427.                         tfm.exec.chatMessage(translate(cmd[2],"fly"),cmd[2])
  428.                     end
  429.                     for i=1,#admins do
  430.                         adminChat("<ROSE>Script</ROSE>",translate(admins[i],"flyA"):format(name,cmd[2]),admins[i])
  431.                     end
  432.                 end
  433.             else
  434.                 if definedMice.fly==true then definedMice.fly=false else definedMice.fly=true end
  435.                 table.foreach(mice,function(n) if mice[n].fly==true then mice[n].fly=false tfm.exec.chatMessage(translate(n,"flyN"),n) else mice[n].fly=true tfm.exec.chatMessage(translate(n,"fly"),n) end end)
  436.                 for i=1,#admins do
  437.                     adminChat("<ROSE>Script</ROSE>",translate(admins[i],"flyA"):format(name,cmd[2]),admins[i])
  438.                 end
  439.             end
  440.         end
  441.         if cmd[1]=="ffa" then
  442.             if cmd[2]~="ALL" then
  443.                 if mice[cmd[2]] then
  444.                     if mice[cmd[2]].ffa==true then
  445.                         mice[cmd[2]].ffa=false
  446.                         tfm.exec.chatMessage(translate(cmd[2],"ffaN"),cmd[2])
  447.                     else
  448.                         mice[cmd[2]].ffa=true
  449.                         tfm.exec.chatMessage(translate(cmd[2],"ffa"),cmd[2])
  450.                     end
  451.                     for i=1,#admins do
  452.                         adminChat("<ROSE>Script</ROSE>",translate(admins[i],"ffaA"):format(name,cmd[2]),admins[i])
  453.                     end
  454.                 end
  455.             else
  456.                 if definedMice.ffa==true then definedMice.ffa=false else definedMice.ffa=true end
  457.                 table.foreach(mice,function(n) if mice[n].ffa==true then mice[n].ffa=false tfm.exec.chatMessage(translate(n,"ffaN"),n) else mice[n].ffa=true tfm.exec.chatMessage(translate(n,"ffa"),n) end end)
  458.                 for i=1,#admins do
  459.                     adminChat("<ROSE>Script</ROSE>",translate(admins[i],"ffaA"):format(name,cmd[2]),admins[i])
  460.                 end
  461.             end
  462.         end
  463.         if cmd[1]=="speed" then
  464.             if cmd[2]~="ALL" then
  465.                 if mice[cmd[2]] then
  466.                     if mice[cmd[2]].speed==true then
  467.                         mice[cmd[2]].speed=false
  468.                         tfm.exec.chatMessage(translate(cmd[2],"speedN"),cmd[2])
  469.                     else
  470.                         mice[cmd[2]].speed=true
  471.                         tfm.exec.chatMessage(translate(cmd[2],"speed"),cmd[2])
  472.                     end
  473.                     for i=1,#admins do
  474.                         adminChat("<ROSE>Script</ROSE>",translate(admins[i],"speedA"):format(name,cmd[2]),admins[i])
  475.                     end
  476.                 end
  477.             else
  478.                 if definedMice.speed==true then definedMice.speed=false else definedMice.speed=true end
  479.                 table.foreach(mice,function(n) if mice[n].speed==true then mice[n].speed=false tfm.exec.chatMessage(translate(n,"speedN"),n) else mice[n].speed=true tfm.exec.chatMessage(translate(n,"speed"),n) end end)
  480.                 for i=1,#admins do
  481.                     adminChat("<ROSE>Script</ROSE>",translate(admins[i],"speedA"):format(name,cmd[2]),admins[i])
  482.                 end
  483.             end
  484.         end
  485.         if cmd[1]=="disco" then
  486.             if cmd[2]~="ALL" then
  487.                 if mice[cmd[2]] then
  488.                     if mice[cmd[2]].disco==true then
  489.                         mice[cmd[2]].disco=false
  490.                         tfm.exec.chatMessage(translate(cmd[2],"discoN"),cmd[2])
  491.                     else
  492.                         mice[cmd[2]].disco=true
  493.                         tfm.exec.chatMessage(translate(cmd[2],"disco"),cmd[2])
  494.                     end
  495.                     for i=1,#admins do
  496.                         adminChat("<ROSE>Script</ROSE>",translate(admins[i],"discoA"):format(name,cmd[2]),admins[i])
  497.                     end
  498.                 end
  499.             else
  500.                 if definedMice.disco==true then definedMice.disco=false else definedMice.disco=true end
  501.                 table.foreach(mice,function(n) if mice[n].disco==true then mice[n].disco=false tfm.exec.chatMessage(translate(n,"discoN"),n) else mice[n].disco=true tfm.exec.chatMessage(translate(n,"disco"),n) end end)
  502.                 for i=1,#admins do
  503.                     adminChat("<ROSE>Script</ROSE>",translate(admins[i],"discoA"):format(name,cmd[2]),admins[i])
  504.                 end
  505.             end
  506.         end
  507.         if cmd[1]=="snow" then
  508.             if cmd[2] then
  509.                 if N(cmd[2]) then
  510.                     tfm.exec.snow(tonumber(cmd[2]))
  511.                     for i=1,#admins do
  512.                         adminChat("<ROSE>Script</ROSE>",translate(admins[i],"snowA"):format(name,tonumbre(cmd[2])),admins[i])
  513.                     end
  514.                 else
  515.                     tfm.exec.snow(60)
  516.                     for i=1,#admins do
  517.                         adminChat("<ROSE>Script</ROSE>",translate(admins[i],"snowA"):format(name,60),admins[i])
  518.                     end
  519.                 end
  520.             else
  521.                 tfm.exec.snow(60)
  522.                 for i=1,#admins do
  523.                     adminChat("<ROSE>Script</ROSE>",translate(admins[i],"snowA"):format(name,60),admins[i])
  524.                 end
  525.             end
  526.             table.foreach(mice,function(n) tfm.exec.chatMessage(translate(n,"snow"),n) end)
  527.         end
  528.         if cmd[1]=="respawn" then
  529.             if cmd[2]~="ALL" then
  530.                 if mice[cmd[2]] then
  531.                     tfm.exec.respawnPlayer(cmd[2])
  532.                     for i=1,#admins do
  533.                         adminChat("<ROSE>Script</ROSE>",translate(admins[i],"respawnA"):format(name,cmd[2]),admins[i])
  534.                     end
  535.                 end
  536.             else
  537.                 table.foreach(mice,function(n) tfm.exec.respawnPlayer(n) end)
  538.                 for i=1,#admins do
  539.                     adminChat("<ROSE>Script</ROSE>",translate(admins[i],"respawnA"):format(name,cmd[2]),admins[i])
  540.                 end
  541.             end
  542.         end
  543.         if cmd[1]=="vamp" then
  544.             if cmd[2]~="ALL" then
  545.                 if mice[cmd[2]] then
  546.                     tfm.exec.setVampirePlayer(cmd[2])
  547.                     tfm.exec.chatMessage(translate(cmd[2],"vamp"),cmd[2])
  548.                     for i=1,#admins do
  549.                         adminChat("<ROSE>Script</ROSE>",translate(admins[i],"vampA"):format(name,cmd[2]),admins[i])
  550.                     end
  551.                 end
  552.             else
  553.                 table.foreach(mice,function(n) tfm.exec.setVampirePlayer(n) tfm.exec.chatMessage(translate(n,"vamp"),n) end)
  554.                 for i=1,#admins do
  555.                     adminChat("<ROSE>Script</ROSE>",translate(admins[i],"vampA"):format(name,cmd[2]),admins[i])
  556.                 end
  557.             end
  558.         end
  559.         if cmd[1]=="time" then
  560.             if cmd[2] then
  561.                 if N(cmd[2]) then
  562.                     tfm.exec.setGameTime(tonumber(cmd[2]))
  563.                 end
  564.             end
  565.         end
  566.         if cmd[1]=="np" then
  567.             if cmd[2] then
  568.                 tfm.exec.newGame(cmd[2])
  569.                 for i=1,#admins do
  570.                     adminChat("<ROSE>Script</ROSE>",translate(admins[i],"map"):format(name,cmd[2]),admins[i])
  571.                 end
  572.             end
  573.         end
  574.         if cmd[1]=="npp" then
  575.             if cmd[2] then
  576.                 if not queue.running[1] then
  577.                     npp=cmd[2]
  578.                     tfm.exec.disableAutoNewGame()
  579.                     for i=1,#admins do
  580.                         adminChat("<ROSE>Script</ROSE>",translate(admins[i],"nextMap"):format(name,cmd[2]),admins[i])
  581.                     end
  582.                 else
  583.                     tfm.exec.chatMessage(translate(name,"notNpp"),name)
  584.                 end
  585.             end
  586.         end
  587.         if cmd[1]=="queue" then
  588.             if cmd[2] then
  589.                 if cmd[2]=="stop" then
  590.                     queue.running[1]=false
  591.                     tfm.exec.disableAutoNewGame(false)
  592.                     tfm.exec.newGame()
  593.                     for i=1,#admins do
  594.                         adminChat("<ROSE>Script</ROSE>",translate(admins[i],"stoppedQueue"):format(name),admins[i])
  595.                     end
  596.                 end
  597.             end
  598.             if cmd[3] then
  599.                 if cmd[2]=="add" then
  600.                     if cmd[3]=="list" then
  601.                         if cmd[4] then
  602.                             if not queue[cmd[4]] then
  603.                                 queue[cmd[4]]={}
  604.                                 for i=1,#admins do
  605.                                     adminChat("<ROSE>Script</ROSE>",translate(admins[i],"queueCreated"):format(name,cmd[4]),name)
  606.                                 end
  607.                             else
  608.                                 tfm.exec.chatMessage(translate(name,"queueExists"):format(cmd[4]),name)
  609.                             end
  610.                         end
  611.                     end
  612.                     if cmd[3]=="map" then
  613.                         if cmd[5] then
  614.                             if queue[cmd[4]] then
  615.                                 table.insert(queue[cmd[4]],cmd[5])
  616.                                 for i=1,#admins do
  617.                                     adminChat("<ROSE>Script</ROSE>",translate(admins[i],"addedMapQueue"):format(name,cmd[5],cmd[4]),admins[i])
  618.                                 end
  619.                             else
  620.                                 tfm.exec.chatMessage(translate(name,"queueNotExists"):format(cmd[4]),name)
  621.                             end
  622.                         end
  623.                     end
  624.                 end
  625.                 if cmd[2]=="remove" then
  626.                     if cmd[3]=="list" then
  627.                         if cmd[4] then
  628.                             if queue[cmd[4]] then
  629.                                 queue[cmd[4]]=nil
  630.                                 for i=1,#admins do
  631.                                     adminChat("<ROSE>Script</ROSE>",translate(admins[i],"queueDeleted"):format(name,cmd[4]),name)
  632.                                 end
  633.                             else
  634.                                 tfm.exec.chatMessage(translate(name,"queueNotExists"):format(cmd[4]),name)
  635.                             end
  636.                         end
  637.                     end
  638.                     if cmd[3]=="map" then
  639.                         if cmd[5] then
  640.                             if queue[cmd[4]] then
  641.                                 local found=false
  642.                                 for i=1,#queue[cmd[4]] do
  643.                                     if queue[cmd[4]][i]==cmd[5] then
  644.                                         found=true
  645.                                         table.remove(queue[cmd[4]],i)
  646.                                     end
  647.                                 end
  648.                                 if found then
  649.                                     for i=1,#admins do
  650.                                         adminChat("<ROSE>Script</ROSE>",translate(admins[i],"removedMapQueue"):format(name,cmd[5],cmd[4]),admins[i])
  651.                                     end
  652.                                 else
  653.                                     tfm.exec.chatMessage(translate(name,"mapNotFound"):format(cmd[5]),name)
  654.                                 end
  655.                             else
  656.                                 tfm.exec.chatMessage(translate(name,"queueNotExists"):format(cmd[4]),name)
  657.                             end
  658.                         end
  659.                     end
  660.                 end
  661.                 if cmd[2]=="play" then
  662.                     if queue[cmd[3]] then
  663.                         queue.running={cmd[3],1}
  664.                         tfm.exec.disableAutoNewGame()
  665.                         for i=1,#admins do
  666.                             adminChat("<ROSE>Script</ROSE>",translate(admins[i],"startedQueue"):format(name,cmd[3]),admins[i])
  667.                         end
  668.                     end
  669.                 end
  670.             end
  671.         end
  672.         if cmd[1]=="fmsg" then
  673.             tfm.exec.chatMessage("<font color='#FFDD00'>• ["..translate(n,"funcorp").."] "..table.concat(cmd," ",2))
  674.         end
  675.         if cmd[1]=="mmsg" then
  676.             table.foreach(mice,function(n) tfm.exec.chatMessage("<font color='#3AD3CD'>• ["..translate(n,"moderation").."] "..table.concat(cmd," ",2),n) end)
  677.         end
  678.         if cmd[1]=="xmlmap" then
  679.             tfm.exec.newGame(xml)
  680.             for i=1,#admins do
  681.                 adminChat("<ROSE>Script</ROSE>",translate(admins[i],"xmlmap"):format(name),admins[i])
  682.             end
  683.         end
  684.         if cmd[1]=="pw" then
  685.             if cmd[2] then
  686.                 tfm.exec.setRoomPassword(table.concat(cmd," ",2))
  687.                 for i=1,#admins do
  688.                     adminChat("<ROSE>Script</ROSE>",translate(admins[i],"pw"):format(name,cmd[2]),admins[i])
  689.                 end
  690.             else
  691.                 tfm.exec.setRoomPassword("")
  692.                 for i=1,#admins do
  693.                     adminChat("<ROSE>Script</ROSE>",translate(admins[i],"noPW"):format(name),admins[i])
  694.                 end
  695.             end
  696.         end
  697.         if cmd[1]=="userlimit" then
  698.             if cmd[2] then
  699.                 if N(cmd[2]) then
  700.                     tfm.exec.setRoomMaxPlayers(tonumber(cmd[2]))
  701.                     for i=1,#admins do
  702.                         adminChat("<ROSE>Script</ROSE>",translate(admins[i],"userlimit"):format(name,tonumber(cmd[2])),admins[i])
  703.                     end
  704.                 end
  705.             end
  706.         end
  707.     end
  708.     if roomAdmin[name] or definedRoomAdmin[name] then
  709.         if cmd[1]=="scradm" then
  710.             roomAdminCmd[cmd[2]]=true
  711.             for i=1,#admins do
  712.                 adminChat("<ROSE>Script</ROSE>",translate(admins[i],"doAdm"):format(name,cmd[2]),admins[i])
  713.             end
  714.         end
  715.         if cmd[1]=="scrunadm" then
  716.             roomAdminCmd[cmd[2]]=false
  717.             for i=1,#admins do
  718.                 adminChat("<ROSE>Script</ROSE>",translate(admins[i],"reAdm"):format(name,cmd[2]),admins[i])
  719.             end
  720.         end
  721.     end
  722.     if cmd[1]=="dmsg" then
  723.         if name=="Tocutoeltuco" or name=="Yuir" then
  724.             colors={"#11999E","#6DECB9","#E6AF2E","#AC30FF","#F1ED63","#09A8FA","#F0D43A","#FFC000"}
  725.             tfm.exec.chatMessage("<font color='"..colors[math.random(#colors)].."'>• [~"..name.."] "..table.concat(cmd," ",2))
  726.         end
  727.     end
  728.     if cmd[1]=="lang" then
  729.         if cmd[2] then
  730.             mice[name].com=cmd[2]:sub(1,2):lower()
  731.             tfm.exec.chatMessage(translate(name,"changed"),name)
  732.         end
  733.     end
  734. end
  735. for i=1,#commands do
  736.     system.disableChatCommandDisplay(commands[i])
  737. end
  738.  
  739. function eventLoop(a,b)
  740.     if trolls.svreset.on then
  741.         trolls.svreset.time=trolls.svreset.time-0.5
  742.         if trolls.svreset.time==120 then
  743.             table.foreach(mice,function(name) tfm.exec.chatMessage(translate(name,"svresetm"),name) end)
  744.         elseif trolls.svreset.time==60 or trolls.svreset.time==30 or trolls.svreset.time==20 or trolls.svreset.time==10 then
  745.             table.foreach(mice,function(name) tfm.exec.chatMessage(translate(name,"svresets"):format(trolls.svreset.time),name) end)
  746.         elseif trolls.svreset.time<10 and #tostring(trolls.svreset.time)==1 and trolls.svreset.time>1 then
  747.             table.foreach(mice,function(name) tfm.exec.chatMessage(translate(name,"svresets"):format(trolls.svreset.time),name) end)
  748.         elseif trolls.svreset.time==1 then
  749.             trolls.svreset.on,trolls.svreset.time=false,120.5
  750.             table.foreach(mice,function(name) tfm.exec.chatMessage(translate(name,"svtroll"),name) end)
  751.         end
  752.     end
  753.     Admins()
  754.     table.foreach(mice,function(n) if mice[n].disco then tfm.exec.setNameColor(n,"0x"..string.format("%X", math.random(0x000000, 0xFFFFFF))) end end)
  755.     for i,o in ipairs(toDespawn) do
  756.         if os.time()>o[2]+despawnTime then
  757.             tfm.exec.removeObject(o[1])
  758.             table.remove(toDespawn,i)
  759.         end
  760.     end
  761.     if b<=1000 then
  762.         if queue.running[1]==false then
  763.             if npp~="" then
  764.                 tfm.exec.newGame(npp)
  765.                 npp=""
  766.                 tfm.exec.disableAutoNewGame(false)
  767.                 tfm.exec.newGame()
  768.             end
  769.         else
  770.             if queue.running[2]<=#queue[queue.running[1]] then
  771.                 tfm.exec.newGame(queue[queue.running[1]][queue.running[2]])
  772.                 queue.running[2]=queue.running[2]+1
  773.             else
  774.                 queue.running={false,0}
  775.                 tfm.exec.disableAutoNewGame(false)
  776.                 tfm.exec.newGame()
  777.             end
  778.         end
  779.     end
  780. end
  781.  
  782. function eventPlayerDied(name)
  783.     tfm.get.room.playerList[name].isDead=true
  784.     local alive=0
  785.     for i,v in pairs(tfm.get.room.playerList) do
  786.         if not v.isDead then
  787.             alive=alive+1
  788.         end
  789.     end
  790.     if alive==0 then
  791.         if queue.running[1]==false then
  792.             if npp~="" then
  793.                 tfm.exec.newGame(npp)
  794.                 npp=""
  795.                 tfm.exec.disableAutoNewGame(false)
  796.                 tfm.exec.newGame()
  797.             end
  798.         else
  799.             if queue.running[2]<=#queue[queue.running[1]] then
  800.                 tfm.exec.newGame(queue[queue.running[1]][queue.running[2]])
  801.                 queue.running[2]=queue.running[2]+1
  802.             else
  803.                 queue.running={false,0}
  804.                 tfm.exec.disableAutoNewGame(false)
  805.                 tfm.exec.newGame()
  806.             end
  807.         end
  808.     end
  809. end
  810.  
  811. function eventPlayerRespawn(name)
  812.     tfm.exec.chatMessage(translate(name,"respawn"),name)
  813. end
  814.  
  815. function eventFasterLoop()
  816. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement