Advertisement
Guest User

tribe thing

a guest
Mar 2nd, 2015
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 35.87 KB | None | 0 0
  1. admins={Umielyon=true, Cgtmouse=true, Kageroutea=true}
  2. Admins={'Umielyon', 'Cgtmouse','Kageroutea'}
  3. function isAdmin(name)
  4.     return (admins[name] or false)
  5. end
  6.  
  7. alive = 0
  8. maps = {[[0]], [[1]], [[2]], [[3]], [[4]], [[5]], [[6]], [[10]], [[11]], [[12]], [[13]], [[15]], [[16]], [[17]], [[18]], [[19]], [[20]], [[21]], [[24]], [[25]], [[26]], [[27]], [[30]], [[31]], [[32]], [[34]], [[35]], [[36]], [[37]], [[38]], [[39]], [[40]], [[41]], [[44]], [[45]], [[46]], [[47]], [[48]], [[49]], [[50]], [[51]], [[52]], [[53]], [[54]], [[56]], [[59]], [[60]], [[62]], [[63]], [[64]], [[65]], [[66]], [[67]], [[68]], [[69]], [[71]], [[72]], [[73]], [[75]], [[76]], [[79]], [[80]], [[81]], [[86]], [[90]], [[91]], [[92]], [[93]], [[94]], [[95]], [[96]], [[97]], [[98]], [[99]], [[100]], [[114]], [[115]], [[116]], [[117]], [[118]], [[119]], [[120]], [[121]], [[127]], [[128]], [[129]], [[130]], [[131]], [[132]], [[133]], [[134]], [[136]], [[138]], [[139]], [[140]], [[141]], [[142]], [[143]], [[3298059]], [[5042951]], [[5049504]], [[5088589]], [[5054044]], [[3298059]], [[4186033]], [[433332]], [[1964128]], [[1406626]], [[743739]], [[126092]], [[413242]], [[909734]], [[183760]], [[1124454]], [[776051]], [[1836964]], [[187088]], [[773147]], [[426398]], [[3820670]], [[3017381]], [[367747]], [[357214]], [[371007]], [[365734]], [[444118]], [[607131]], [[2104751]], [[2199656]], [[953233]], [[515250]], [[923878]], [[398828]], [[382841]], [[423670]], [[436128]], [[1193841]], [[772825]], [[239941]], [[504166]], [[392150]], [[172357]], [[3534630]], [[474113]], [[1655360]], [[199112]], [[798052]], [[151712]], [[213781]], [[453948]], [[324373]], [[168872]], [[165741]], [[460646]], [[421195]], [[438271]], [[461925]], [[853788]], [[474477]], [[5189816]]}
  9.  
  10. easymaps = {[[4]], [[16]], [[43]], [[44]], [[45]], [[93]], [[94]]}
  11. intermediatemaps = {[[130]],}
  12. hardmaps = {[[10]], [[66]], [[79]], [[120]]}
  13.  
  14. house = {[[4445759]], [[4709828]], [[4583680]]}
  15.  
  16. bans={}
  17. function isBanned(name)
  18.     return(bans[name] or false)
  19. end
  20.  
  21. players={}
  22. namecolor={}
  23. holding={}
  24. vqueue={}
  25. aMenu={
  26.     actions={{'New Map', tfm.exec.newGame, {'Map Code'}, {0}}, {'Set Time', tfm.exec.setGameTime, {'Time', 'Init'}, {120}},
  27.         {'Add Object', tfm.exec.addShamanObject, {'ID', 'X', 'Y', 'Angle', 'Speed X', 'Speed Y', 'Ghost'}, {28, 800, 700, 0, 0, 0}}, {'Remove Object', tfm.exec.removeObject, {'ID'}, {2}},
  28.         {'Move Object', tfm.exec.moveObject, {'ID', 'X', 'Y', 'Offset', 'Speed X', 'Speed Y', 'Offset'}, {2, 10, 10}},
  29.         {'Particle', tfm.exec.displayParticle, {'ID', 'X', 'Y', 'Speed X', 'Speed Y', 'Acceleration X', 'Acceleration Y', 'Target'}, {1, 10, 10, 0, 0, 0, 0}},
  30.         {'Explosion', tfm.exec.explosion, {'X', 'Y', 'Power', 'Distance', 'Mice Only'}, {400, 200, -100, 100}},
  31.         {'Conjuration', tfm.exec.addConjuration, {'X', 'Y', 'Time'}, {10/10, 10/10, 10000}},
  32.         'NICK', {'Kill', tfm.exec.killPlayer}, {'Give Cheese', tfm.exec.giveCheese}, {'Victory', tfm.exec.playerVictory},
  33.         {'Shaman', tfm.exec.setShaman}, {'Meep', tfm.exec.giveMeep}, {'Vampire', tfm.exec.setVampirePlayer},
  34.         {'Respawn', tfm.exec.respawnPlayer}, {'Set Score', tfm.exec.setPlayerScore, {'Score', 'Add'}, {1, true}},
  35.         {'Set Color', tfm.exec.setNameColor, {'Color'}, {0}},
  36.         {'Move Player', tfm.exec.movePlayer, {'X', 'Y', 'Offset', 'Speed X', 'Speed Y', 'Offset'}, {400, 200}}},
  37.     text='<R><a href="event:close"><b>Close</b></a><N>',
  38.     nickID=0}
  39. langs = {
  40.     EN = {
  41.         clear="Clear",
  42.         close="Close",
  43.         shaman="Become Shaman",
  44.         changemap="Change Map",
  45.         changemapattempt="attempted to change the map!",
  46.         exit=" has left the room.",
  47.         teleport="Toggle Teleportation",
  48.         color="Name Color",
  49.         resetmap="Reset Map",
  50.         fly="Toggle Flight",
  51.         meep="Give Meep",
  52.         time="Infinite Map Time",
  53.         path="Toggle Path (WIP)",
  54.         snowball="Super Snowball",
  55.         heart="Heart Clicks",
  56.         gravity="No Gravity",
  57.         admin="Admin Menu",
  58.         banned="You are banned from this room!",
  59.         vanillamode="Sham Practice Mode",
  60.         rules="           Video Player Rules (WIP):\n\n1. You must abide by the video queue.\n\n2. If a video is longer than around 6 mins, after that allotted time another video may be played at any time. There are exceptions that can be made.\n\n3. Please be respectful of other people's video choices.\n\n4. Try to avoid playing videos that are looping videos of clips that are really short.",
  61.         joinqueue="Join Queue",
  62.         leavequeue="Leave Queue",
  63.         vqueuetitle="Video Queue:\n\n",
  64.         vqueuetext="",
  65.         toggleui="Toggle UI"
  66.     }
  67. }
  68. text = langs.EN
  69.  
  70. function init()
  71.     command.addHandler("cp", cp)
  72.     for i=1, #aMenu.actions do
  73.         if aMenu.actions[i]=='NICK' then
  74.             aMenu.text=aMenu.text..'\n<V><u>%s</u><J>'
  75.             aMenu.nickID=i
  76.         else
  77.             aMenu.text=aMenu.text..string.format('\n<a href="event:amenu%d">%s</a>', i, aMenu.actions[i][1])
  78.             if aMenu.actions[i][3] then
  79.                 aMenu.text=aMenu.text..string.format(' <a href="event:amenup%d">&gt;</a>', i)
  80.             end
  81.         end
  82.     end
  83.     teleandflylock = false
  84.     snowballlock = false
  85.     X = 0
  86.     Y = 0
  87.     ID = 0
  88.     Angle = 0
  89.     SpeedX = 0
  90.     SpeedY = 0
  91. umielyonx = 0
  92. umielyony = 0
  93.     cgtmousex = 0
  94. cgtmousey = 0
  95.     kagerouteax = 0
  96.     kagerouteay = 0
  97.     place = 0
  98.     totalplayers = 0
  99.     vanillamodevote = 0
  100.     for name in pairs(tfm.get.room.playerList) do
  101.         holding[name] = false
  102.         eventNewPlayer(name)
  103.     end
  104. end
  105.  
  106. function updateVQueueText()
  107.     text.vqueuetext = ""
  108.     for trash in pairs(vqueue) do
  109.         text.vqueuetext = text.vqueuetext..vqueue[trash].."\n"
  110.     end
  111. end
  112.  
  113. function eventNewPlayer(name)
  114.     tfm.exec.respawnPlayer(name)
  115.     alive = alive+1
  116.     if totalplayers == nil then
  117.         totalplayers = 0
  118.     end
  119.     totalplayers = totalplayers+1
  120.    
  121.     if isBanned(name) ~= true then
  122.         ui.addTextArea(104, "<a href='event:shaman'><B>"..text.shaman.."</a>", name, -200, 40, 150, 20, 0x465A6E, 0x324650, 1, true)  
  123.         ui.addTextArea(105, "<a href='event:changemap'><B>"..text.changemap.."</a>", name, -200, 70, 150, 20, 0x465A6E, 0x324650, 1, true)  
  124.         ui.addTextArea(112, "<a href='event:vanillamode'><N2>"..text.vanillamode.."</a>", name, -200, 100, 150, 20, 0x465A6E, 0x324650, 1, true)
  125.         ui.addTextArea(106, "<a href='event:teleport'><N2>"..text.teleport.."</a>", name, -200, 130, 150, 20, 0x465A6E, 0x324650, 1, true)
  126.         ui.addTextArea(107, "<a href='event:fly'><N2>"..text.fly.."</a>", name, -200, 160, 150, 20, 0x465A6E, 0x324650, 1, true)
  127.         ui.addTextArea(108, "<a href='event:meep'><B>"..text.meep.."</a>", name, -200, 190, 150, 20, 0x465A6E, 0x324650, 1, true)
  128.         ui.addTextArea(109, "<a href='event:color'><B>"..text.color.."</a>", name, -200, 220, 150, 20, 0x465A6E, 0x324650, 1, true)
  129.         ui.addTextArea(110, "<a href='event:close'><N2>"..text.path.."</a>", name, -200, 250, 150, 20, 0x465A6E, 0x324650, 1, true)
  130.         ui.addTextArea(111, "<a href='event:snowball'><N2>"..text.snowball.."</a>", name, -200, 280, 150, 20, 0x465A6E, 0x324650, 1, true)
  131.         ui.addTextArea(300, "<a href='event:joinqueue'><B>"..text.joinqueue.."</a>", name, 850, 40, 150, 20, 0x465A6E, 0x324650, 1, true)
  132.         ui.addTextArea(301, "<a href='event:leavequeue'><N2>"..text.leavequeue.."</a>", name, 850, 70, 150, 20, 0x465A6E, 0x324650, 1, true)
  133.         updateVQueueText()
  134.         ui.addTextArea(302, "<B>"..text.vqueuetitle.."</B>"..text.vqueuetext, name, 850, 130, 150, 200, 0x465A6E, 0x324650, 1, true)
  135.         ui.addTextArea(400, "<a href='event:toggleui'><B>"..text.toggleui.."</a>", name, 850, 575, 150, 20, 0x000001, 0x000001, 1, true)
  136.     end
  137.  
  138.     time = 0
  139.    
  140.     if isAdmin(name) then
  141.         ui.addTextArea(153, "<a href='event:heart'>"..text.heart.."</a>", name, -200, 495, 150, 20, 0x000001, 0x000001, 1, true)
  142.         ui.addTextArea(152, "<a href='event:gravity'>"..text.gravity.."</a>", name, -200, 515, 150, 20, 0x000001, 0x000001, 1, true)
  143.         ui.addTextArea(151, "<a href='event:time'><ROSE>"..text.time.."</a>", name, -200, 535, 150, 20, 0x000001, 0x000001, 1, true)
  144.         ui.addTextArea(150, "<a href='event:resetmap'><R>"..text.resetmap.."</a>", name, -200, 555, 150, 20, 0x000001, 0x000001, 1, true)
  145.         ui.addTextArea(149, "<a href='event:admin'><J>"..text.admin.."</a>", name, -200, 575, 150, 20, 0x000001, 0x000001, 1, true)
  146.  
  147.         -- Rules here for now
  148.         -- ui.addPopup(1337, 0, rules, name, 200, 150, 400, true)
  149.     end
  150.     mapcode = tfm.get.room.currentMap
  151.     if mapcode == "@4445759" then
  152.         tfm.exec.setUIMapName("<VP>Cloud Strife - House")
  153.     else
  154.         tfm.exec.setUIMapName("<VP>Cloud Strife - Map "..mapcode)
  155.     end
  156.     players[name]={keys={}, aMenu={target=name, pID=0, params={}}}
  157.     system.bindMouse(name, true)
  158.     tfm.exec.bindKeyboard(name, 16, true, true)
  159.     tfm.exec.bindKeyboard(name, 16, false, true)
  160.     tfm.exec.bindKeyboard(name, 17, true, true)
  161.     tfm.exec.bindKeyboard(name, 17, false, true)
  162.     tfm.exec.bindKeyboard(name, 107, true, true)
  163.  
  164.     for name in pairs(namecolor) do
  165.         if namecolor[name] ~= nil then
  166.             tfm.exec.setNameColor(name, "0x"..namecolor[name])
  167.         end
  168.     end
  169. end
  170.  
  171. function eventPlayerLeft(playerName)
  172.     ui.addTextArea(786, "<V>"..playerName.." "..text.exit.."       <p align='right'><R><a href='event:close'>X</a></p>", playerList, 400, 375, 300, 20, 1, true)
  173.     totalplayers = totalplayers-1
  174.     alive = alive-1
  175.  
  176.     -- Video Queue Removal
  177.     for trash in pairs(vqueue) do
  178.         if vqueue[trash] == playerName then
  179.             table.remove(vqueue, trash)
  180.             ui.removeTextArea(302, playerList)
  181.             updateVQueueText()
  182.             ui.addTextArea(302, "<B>"..text.vqueuetitle.."</B>"..text.vqueuetext, playerList, 850, 130, 150, 160, 0x465A6E, 0x324650, 1, true)
  183.             break
  184.         end
  185.     end
  186. end
  187. for name, player in pairs(tfm.get.room.playerList) do
  188.     eventNewPlayer(name)
  189. end
  190.  
  191. function eventPlayerDied(name)
  192.     tfm.exec.setPlayerScore(name,-1,true)
  193.     if vanillamodeon == true then
  194.         alive = alive-1
  195.     else
  196.         tfm.exec.respawnPlayer(name)
  197.     end
  198.     for name in pairs(namecolor) do
  199.         if namecolor[name] ~= nil then
  200.             tfm.exec.setNameColor(name, "0x"..namecolor[name])
  201.         end
  202.     end
  203. end
  204.  
  205. function eventPlayerRespawn(name)
  206.     for name in pairs(namecolor) do
  207.         if namecolor[name] ~= nil then
  208.             tfm.exec.setNameColor(name, "0x"..namecolor[name])
  209.         end
  210.     end
  211.     alive = alive+1
  212. end
  213.  
  214. function eventPlayerGetCheese(name)
  215.     tfm.exec.setPlayerScore(name,1,true)
  216. end
  217.  
  218. function eventPlayerWon(name)
  219.     place = place+1
  220.     if place == 1 then
  221.         tfm.exec.setPlayerScore(name,5,true)
  222.     elseif place == 2 then
  223.         tfm.exec.setPlayerScore(name,3,true)
  224.     elseif place == 3 then
  225.         tfm.exec.setPlayerScore(name,2,true)
  226.     else
  227.         tfm.exec.setPlayerScore(name,1,true)
  228.     end
  229.     alive = alive-1
  230.     if vanillamodeon == false then
  231.         tfm.exec.respawnPlayer(name)
  232.     end
  233. end
  234.  
  235. function eventTextAreaCallback(ID, name, callback)
  236.     if callback=="shaman" then
  237.         tfm.exec.setShaman(name)
  238.     end
  239.     if callback=="changemap" then
  240.         ui.addPopup(65, 2, "Enter Map Code:", name, 300, 200, 200, true)
  241.     end
  242.     if callback=="close" then
  243.         ui.removeTextArea(87, name) ui.removeTextArea(45, name) ui.removeTextArea(85, name) ui.removeTextArea(6, name) ui.removeTextArea(7, name) ui.removeTextArea(8, name) ui.removeTextArea(9, name) ui.removeTextArea(786, name) ui.removeTextArea(123, name) ui.removeTextArea(124, name) ui.removeTextArea(125, name) ui.removeTextArea(126, name) ui.removeTextArea(1, name) ui.removeTextArea(2, name) ui.removeTextArea(3, name) ui.removeTextArea(4, name) ui.removeTextArea(5, name) ui.removeTextArea(6, name) ui.removeTextArea(127, name) ui.removeTextArea(128, name) ui.removeTextArea(129, name)
  244.     end
  245.     if callback=="teleport" then
  246.         for name, player in pairs(tfm.get.room.playerList) do
  247.                 system.bindMouse(name, true)
  248.         end
  249.         if teleporton == true then
  250.             teleporton = false
  251.                 if isBanned(name) ~= true then
  252.                     ui.removeTextArea(106, playerList)
  253.                     ui.addTextArea(106, "<a href='event:teleport'><N2>"..text.teleport.."</a>", playerList, -200, 130, 150, 20, 0x465A6E, 0x324650, 1, true)
  254.                 end
  255.         else
  256.             if teleandflylock == false then
  257.                 teleporton = true
  258.                 if isBanned(name) ~= true then
  259.                     ui.removeTextArea(106, playerList)
  260.                     ui.addTextArea(106, "<a href='event:teleport'><a:hover><b>"..text.teleport.."</a>", playerList, -200, 130, 150, 20, 0x465A6E, 0x324650, 1, true)
  261.                 end
  262.             end
  263.         end
  264.     elseif callback=="color" then
  265.         ui.addPopup(67, 2, "Enter Hex Color Code:\n\nWarning: Colored Name will reset\nupon death.", name, 300, 200, 200, true)
  266.     elseif callback=="resetmap" then
  267.         -- tfm.exec.newGame()
  268.         tfm.exec.newGame(4445759)
  269.         tfm.exec.disableAutoShaman(true)
  270.         tfm.exec.disableAutoTimeLeft(true)
  271.         tfm.exec.disableAutoNewGame(true)
  272.         tfm.exec.disableAfkDeath(true)
  273.         gravity = 1
  274.         print(name.." reset the map.")
  275.     elseif callback=="time" then
  276.         print(name.." activated infinite map time.")
  277.         tfm.exec.disableAutoNewGame(true)
  278.         tfm.exec.setGameTime(0)
  279.     elseif callback=="fly" then
  280.         if flyon == true then
  281.             flyon = false
  282.             for name, player in pairs(tfm.get.room.playerList) do
  283.                 tfm.exec.bindKeyboard(name, 32, true, false)
  284.             end
  285.                 if isBanned(name) ~= true then
  286.                     ui.removeTextArea(107, playerList)
  287.                     ui.addTextArea(107, "<a href='event:fly'><N2>"..text.fly.."</a>", playerList, -200, 160, 150, 20, 0x465A6E, 0x324650, 1, true)
  288.                 end
  289.         else
  290.             if teleandflylock == false then
  291.                 flyon = true
  292.                 for name, player in pairs(tfm.get.room.playerList) do
  293.                     tfm.exec.bindKeyboard(name, 32, true, true)
  294.                 end
  295.                 if isBanned(name) ~= true then
  296.                     ui.removeTextArea(107, playerList)
  297.                     ui.addTextArea(107, "<a href='event:fly'><a:hover><b>"..text.fly.."</a>", playerList, -200, 160, 150, 20, 0x465A6E, 0x324650, 1, true)
  298.                 end
  299.             end
  300.         end
  301.     elseif callback=="meep" then
  302.         tfm.exec.giveMeep(name)
  303.     elseif callback=="path" then
  304.         if pathon == true then
  305.             pathon = false
  306.             holding = false
  307.             tfm.exec.bindKeyboard(name, 32, true, false)
  308.             tfm.exec.bindKeyboard(name, 32, false, false)
  309.             ui.addTextArea(125, ""..name.." toggled<V> Paths<N> off!        <p align='right'><R><a href='event:close'>X</a></p>", playerList, 20, 220, 250, 20, 0x000001, 0x000001, 1, true)
  310.         else
  311.             flyon = false
  312.             pathon = true
  313.             holding = false
  314.             tfm.exec.bindKeyboard(name, 32, true, true)
  315.             tfm.exec.bindKeyboard(name, 32, false, true)
  316.             ui.addTextArea(125, ""..name.." toggled<V> Paths<N> on!        <p align='right'><R><a href='event:close'>X</a></p>", playerList, 20, 220, 250, 20, 0x000001, 0x000001, 1, true)
  317.         end
  318.     elseif callback=="snowball" and snowballlock==false then
  319.         if snowon == true then
  320.             snowon = false
  321.             teleandflylock = false
  322.             if isBanned(name) ~= true then
  323.                 ui.removeTextArea(106, playerList)
  324.                 ui.addTextArea(106, "<a href='event:teleport'><N2>"..text.teleport.."</a>", playerList, -200, 130, 150, 20, 0x465A6E, 0x324650, 1, true)
  325.                 ui.removeTextArea(107, playerList)
  326.                 ui.addTextArea(107, "<a href='event:fly'><N2>"..text.fly.."</a>", playerList, -200, 160, 150, 20, 0x465A6E, 0x324650, 1, true)
  327.                 ui.removeTextArea(111, playerList)
  328.                 ui.addTextArea(111, "<a href='event:snowball'><N2>"..text.snowball.."</a>", playerList, -200, 280, 150, 20, 0x465A6E, 0x324650, 1, true)
  329.             end
  330.         else
  331.             snowon = true
  332.             teleandflylock = true
  333.                 if isBanned(name) ~= true then
  334.                     ui.removeTextArea(106, playerList)
  335.                     ui.addTextArea(106, "<a href='event:teleport'><N2>̶T̶o̶g̶g̶l̶e̶ ̶T̶e̶l̶e̶p̶o̶r̶t̶a̶t̶i̶o̶n̶</a>", playerList, -200, 130, 150, 20, 0x465A6E, 0x324650, 1, true)
  336.                     ui.removeTextArea(107, playerList)
  337.                     ui.addTextArea(107, "<a href='event:fly'><N2>T̶o̶g̶g̶l̶e̶ ̶F̶l̶i̶g̶h̶t̶</a>", playerList, -200, 160, 150, 20, 0x465A6E, 0x324650, 1, true)
  338.                 end
  339.             if teleporton == true then
  340.                 teleporton = false
  341.             end
  342.             if flyon == true then
  343.                 flyon = false
  344.             end
  345.             if isBanned(name) ~= true then
  346.                 ui.removeTextArea(111, playerList)
  347.                 ui.addTextArea(111, "<a href='event:snowball'><a:hover><B>"..text.snowball.."</a>", playerList, -200, 280, 150, 20, 0x465A6E, 0x324650, 1, true)
  348.             end
  349.         end
  350.     elseif callback=="heart" then
  351.         if hearton == true then
  352.             hearton = false
  353.             print(name.." deactivated heart clicks.")
  354.         else
  355.             hearton = true
  356.             system.bindMouse (name, true)
  357.             print(name.." activated heart clicks.")
  358.         end
  359.     elseif callback=="gravity" then
  360.         print(name.." activated no gravity.")
  361.         gravity = 0
  362.         tfm.exec.newGame(xml)
  363.     elseif callback:sub(1, 6)=='amenu0' then
  364.         players[name].aMenu.target=callback:sub(7)
  365.         ui.removeTextArea(1, name)
  366.         ui.addTextArea(2, aMenu.text:format(callback:sub(7)), name, 10, 20, nil, nil, 1, 0, 0.7, true)
  367.     elseif callback:sub(1, 6)=='amenup' then
  368.         local aID, pID=tonumber(callback:sub(7)), players[name].aMenu.pID
  369.         if type(aMenu.actions[pID])=='table' and aMenu.actions[pID][3] then
  370.             for i=1, #aMenu.actions[pID][3] do
  371.                 ui.addPopup(i, 0, '', name, 9e5, 9e5, 1, true)
  372.             end
  373.         end
  374.         if pID==aID then
  375.             players[name].aMenu.pID=0
  376.         else
  377.             if type(aMenu.actions[aID])=='table' and aMenu.actions[aID][3] then
  378.                 if not players[name].aMenu.params[aID] then
  379.                     players[name].aMenu.params[aID]=aMenu.actions[aID][4] and table.copy(aMenu.actions[aID][4]) or {}
  380.                 end
  381.                 players[name].aMenu.pID=aID
  382.                 for i=1, #aMenu.actions[aID][3] do
  383.                     showParamPopup(name, i, aMenu.actions[aID][3][i], players[name].aMenu.params[aID][i])
  384.                 end
  385.             end
  386.         end
  387.     elseif callback:sub(1, 5)=='amenu' then
  388.         local aID=tonumber(callback:sub(6))
  389.         if type(aMenu.actions[aID])=='table' then
  390.             if aID>aMenu.nickID then
  391.                 callPlayerFunction(players[name].aMenu.target, aMenu.actions[aID][2], unpack(players[name].aMenu.params[aID] or aMenu.actions[aID][4] or {}))
  392.             else
  393.                 aMenu.actions[aID][2](unpack(players[name].aMenu.params[aID] or aMenu.actions[aID][4] or {}))
  394.             end
  395.         end
  396.     elseif callback=="admin" then
  397.         eventTextAreaCallback(1, name, 'amenu0*')
  398.     elseif callback=="vanillamode" then
  399.         if vanillamodeon == true then
  400.             vanillamodeon = false
  401.             teleandflylock = false
  402.             snowballlock = false
  403.             tfm.exec.disableAutoNewGame(false)
  404.             if isBanned(name) ~= true then
  405.                 ui.removeTextArea(111, playerList)
  406.                 ui.addTextArea(111, "<a href='event:snowball'><N2>"..text.snowball.."</a>", playerList, -200, 280, 150, 20, 0x465A6E, 0x324650, 1, true)
  407.                 ui.removeTextArea(112, playerList)
  408.                 ui.addTextArea(112, "<a href='event:vanillamodevote'><N2>"..text.vanillamode.."</a>", playerList, -200, 100, 150, 20, 0x465A6E, 0x324650, 1, true)
  409.                 ui.removeTextArea(106, playerList)
  410.                 ui.addTextArea(106, "<a href='event:teleport'><N2>"..text.teleport.."</a>", playerList, -200, 130, 150, 20, 0x465A6E, 0x324650, 1, true)
  411.                 ui.removeTextArea(107, playerList)
  412.                 ui.addTextArea(107, "<a href='event:fly'><N2>"..text.fly.."</a>", playerList, -200, 160, 150, 20, 0x465A6E, 0x324650, 1, true)
  413.             end
  414.         else
  415.             vanillamodeon = true
  416.             teleandflylock = true
  417.             snowballlock = true
  418.             tfm.exec.disableAutoNewGame(true)
  419.             if isBanned(name) ~= true then
  420.                 ui.removeTextArea(111, playerList)
  421.                 ui.addTextArea(111, "<a href='event:snowball'><N2>S̶u̶p̶e̶r̶ ̶S̶n̶o̶w̶b̶a̶l̶l̶</a>", playerList, -200, 280, 150, 20, 0x465A6E, 0x324650, 1, true)
  422.                 ui.removeTextArea(106, playerList)
  423.                 ui.addTextArea(106, "<a href='event:teleport'><N2>̶T̶o̶g̶g̶l̶e̶ ̶T̶e̶l̶e̶p̶o̶r̶t̶a̶t̶i̶o̶n̶</a>", playerList, -200, 130, 150, 20, 0x465A6E, 0x324650, 1, true)
  424.                 ui.removeTextArea(107, playerList)
  425.                 ui.addTextArea(107, "<a href='event:fly'><N2>T̶o̶g̶g̶l̶e̶ ̶F̶l̶i̶g̶h̶t̶</a>", playerList, -200, 160, 150, 20, 0x465A6E, 0x324650, 1, true)
  426.                 ui.removeTextArea(112, playerList)
  427.                 ui.addTextArea(112, "<a href='event:vanillamodevote'><a:hover><B>"..text.vanillamode.."</a>", playerList, -200, 100, 150, 20, 0x465A6E, 0x324650, 1, true)
  428.             nextRound()
  429.             end
  430.         end
  431.     elseif callback=="vanillamodevote" then
  432.         vanillamodevote = 0
  433.         ui.addPopup(42, 1, "Vote to toggle Sham Practice Mode?", playerList, 10, 320, 180, true)
  434.     elseif callback=="joinqueue" then
  435.         canQueue = true
  436.         for trash in pairs(vqueue) do
  437.             if vqueue[trash] == name then
  438.                 canQueue = false
  439.                 break
  440.             end
  441.         end
  442.         if canQueue then
  443.             table.insert(vqueue, name)
  444.             ui.removeTextArea(300, name)
  445.             ui.addTextArea(300, "<a href='event:joinqueue'><N2>"..text.joinqueue.."</a>", name, 850, 40, 150, 20, 0x465A6E, 0x324650, 1, true)
  446.             ui.removeTextArea(301, name)
  447.             ui.addTextArea(301, "<a href='event:leavequeue'><a:hover><B>"..text.leavequeue.."</a>", name, 850, 70, 150, 20, 0x465A6E, 0x324650, 1, true)
  448.             ui.removeTextArea(302, playerList)
  449.             updateVQueueText()
  450.             ui.addTextArea(302, "<B>"..text.vqueuetitle.."</B>"..text.vqueuetext, playerList, 850, 130, 150, 200, 0x465A6E, 0x324650, 1, true)
  451.             invqueue = true
  452.         else
  453.             ui.addPopup(1338, 0, "You are already on the queue list!", name, 200, 150, 200, true)
  454.         end
  455.     elseif callback=="leavequeue" then
  456.         canRemove = false
  457.         for trash in pairs(vqueue) do
  458.             if vqueue[trash] == name then
  459.                 canRemove = true
  460.                 table.remove(vqueue, trash)
  461.                 break
  462.             end
  463.         end
  464.         if canRemove then
  465.             ui.removeTextArea(300, name)
  466.             ui.addTextArea(300, "<a href='event:joinqueue'><B>"..text.joinqueue.."</a>", name, 850, 40, 150, 20, 0x465A6E, 0x324650, 1, true)
  467.             ui.removeTextArea(301, name)
  468.             ui.addTextArea(301, "<a href='event:leavequeue'><N2>"..text.leavequeue.."</a>", name, 850, 70, 150, 20, 0x465A6E, 0x324650, 1, true)
  469.             ui.removeTextArea(302, playerList)
  470.             updateVQueueText()
  471.             ui.addTextArea(302, "<B>"..text.vqueuetitle.."</B>"..text.vqueuetext, playerList, 850, 130, 150, 200, 0x465A6E, 0x324650, 1, true)
  472.             invqueue = false
  473.         else
  474.             ui.addPopup(1338, 0, "You can't remove nothing, your brain should know this.", name, 200, 150, 200, true)
  475.         end
  476.     elseif callback=="toggleui" then
  477.         if uiToggled == true then
  478.             ui.addTextArea(104, "<a href='event:shaman'><B>"..text.shaman.."</a>", name, -200, 40, 150, 20, 0x465A6E, 0x324650, 1, true)  
  479.             ui.addTextArea(105, "<a href='event:changemap'><B>"..text.changemap.."</a>", name, -200, 70, 150, 20, 0x465A6E, 0x324650, 1, true)  
  480.             if vanillamodeon == true then
  481.                 ui.addTextArea(112, "<a href='event:vanillamodevote'><a:hover><B>"..text.vanillamode.."</a>", name, -200, 100, 150, 20, 0x465A6E, 0x324650, 1, true)
  482.             else
  483.                 ui.addTextArea(112, "<a href='event:vanillamode'><N2>"..text.vanillamode.."</a>", name, -200, 100, 150, 20, 0x465A6E, 0x324650, 1, true)
  484.             end
  485.             if teleporton == true then
  486.                 ui.addTextArea(106, "<a href='event:teleport'><a:hover><b>"..text.teleport.."</a>", name, -200, 130, 150, 20, 0x465A6E, 0x324650, 1, true)
  487.             else
  488.                 if teleandflylock == true then
  489.                     ui.addTextArea(106, "<a href='event:teleport'><N2>̶T̶o̶g̶g̶l̶e̶ ̶T̶e̶l̶e̶p̶o̶r̶t̶a̶t̶i̶o̶n̶</a>", playerList, -200, 130, 150, 20, 0x465A6E, 0x324650, 1, true)
  490.                 else
  491.                     ui.addTextArea(106, "<a href='event:teleport'><N2>"..text.teleport.."</a>", name, -200, 130, 150, 20, 0x465A6E, 0x324650, 1, true) 
  492.                 end
  493.             end
  494.             if flyon == true then
  495.                 ui.addTextArea(107, "<a href='event:fly'><a:hover><b>"..text.fly.."</a>", name, -200, 160, 150, 20, 0x465A6E, 0x324650, 1, true)
  496.             else
  497.                 if teleandflylock == true then
  498.                     ui.addTextArea(107, "<a href='event:fly'><N2>T̶o̶g̶g̶l̶e̶ ̶F̶l̶i̶g̶h̶t̶</a>", playerList, -200, 160, 150, 20, 0x465A6E, 0x324650, 1, true)
  499.                 else
  500.                     ui.addTextArea(107, "<a href='event:fly'><N2>"..text.fly.."</a>", name, -200, 160, 150, 20, 0x465A6E, 0x324650, 1, true)
  501.                 end
  502.             end
  503.             ui.addTextArea(108, "<a href='event:meep'><B>"..text.meep.."</a>", name, -200, 190, 150, 20, 0x465A6E, 0x324650, 1, true)
  504.             ui.addTextArea(109, "<a href='event:color'><B>"..text.color.."</a>", name, -200, 220, 150, 20, 0x465A6E, 0x324650, 1, true)
  505.             ui.addTextArea(110, "<a href='event:close'><N2>"..text.path.."</a>", name, -200, 250, 150, 20, 0x465A6E, 0x324650, 1, true)
  506.             if snowon == true then
  507.                 ui.addTextArea(111, "<a href='event:snowball'><a:hover><B>"..text.snowball.."</a>", playerList, -200, 280, 150, 20, 0x465A6E, 0x324650, 1, true)
  508.             else
  509.                 ui.addTextArea(111, "<a href='event:snowball'><N2>"..text.snowball.."</a>", name, -200, 280, 150, 20, 0x465A6E, 0x324650, 1, true)
  510.             end
  511.             if invqueue == true then
  512.                 ui.addTextArea(300, "<a href='event:joinqueue'><N2>"..text.joinqueue.."</a>", name, 850, 40, 150, 20, 0x465A6E, 0x324650, 1, true)
  513.                 ui.addTextArea(301, "<a href='event:leavequeue'><a:hover><B>"..text.leavequeue.."</a>", name, 850, 70, 150, 20, 0x465A6E, 0x324650, 1, true)
  514.             else
  515.                 ui.addTextArea(300, "<a href='event:joinqueue'><B>"..text.joinqueue.."</a>", name, 850, 40, 150, 20, 0x465A6E, 0x324650, 1, true)
  516.                 ui.addTextArea(301, "<a href='event:leavequeue'><N2>"..text.leavequeue.."</a>", name, 850, 70, 150, 20, 0x465A6E, 0x324650, 1, true)       
  517.             end
  518.             updateVQueueText()
  519.             ui.addTextArea(302, "<B>"..text.vqueuetitle.."</B>"..text.vqueuetext, name, 850, 130, 150, 200, 0x465A6E, 0x324650, 1, true)
  520.             ui.addTextArea(400, "<a href='event:toggleui'><B>"..text.toggleui.."</a>", name, 850, 575, 150, 20, 0x000001, 0x000001, 1, true)
  521.  
  522.             uiToggled = false
  523.             ui.removeTextArea(400, name)
  524.             ui.addTextArea(400, "<a href='event:toggleui'><B>"..text.toggleui.."</a>", name, 850, 575, 150, 20, 0x000001, 0x000001, 1, true)
  525.         else
  526.             ui.removeTextArea(104, name)
  527.             ui.removeTextArea(105, name)
  528.             ui.removeTextArea(106, name)
  529.             ui.removeTextArea(107, name)
  530.             ui.removeTextArea(108, name)
  531.             ui.removeTextArea(109, name)
  532.             ui.removeTextArea(110, name)
  533.             ui.removeTextArea(111, name)
  534.             ui.removeTextArea(112, name)
  535.            
  536.             ui.removeTextArea(300, name)
  537.             ui.removeTextArea(301, name)
  538.             ui.removeTextArea(302, name)
  539.  
  540.             uiToggled = true
  541.             ui.removeTextArea(400, name)
  542.             ui.addTextArea(400, "<a href='event:toggleui'><a:hover><B>"..text.toggleui.."</a>", name, 850, 575, 150, 20, 0x000001, 0x000001, 1, true)
  543.         end
  544.     end
  545. end
  546.  
  547. function eventKeyboard(name, key, down, x, y)
  548.     players[name].keys[key]=down
  549.     if flyon == true then
  550.         if key==32 then
  551.             tfm.exec.movePlayer(name, 0, 0, true, 0, -50, false)
  552.         end
  553.     end
  554.     if pathon==true then
  555.         if key==32 then
  556.             if down then
  557.                 holding[name] = true
  558.             else
  559.                 holding[name] = false
  560.             end
  561.         end
  562.     end
  563.     if key==107 then
  564.         mousex = tfm.get.room.playerList[name].x
  565.         mousey = tfm.get.room.playerList[name].y
  566.         print("X:"..mousex.."   Y:"..mousey)
  567.     end
  568. end
  569.  
  570. function eventMouse(name, x, y, mousex, mousey)
  571.     if players[name].keys[16] and isAdmin(name) then
  572.         local pList={}
  573.         for n, p in pairs(tfm.get.room.playerList) do
  574.             if math.abs(p.x-x)<25 and math.abs(p.y-y)<25 then
  575.                 table.insert(pList, n)
  576.             end
  577.         end
  578.         if #pList>1 then
  579.             local s='<R><a href="event:close"><b>Close</b></a><V>'
  580.             for i=1, #pList do
  581.                 s=s..string.format('\n<a href="event:amenu0%s">%s</a>', pList[i], pList[i])
  582.             end
  583.             local maxy=380-(14*(#pList+1))
  584.             local y=y>maxy and maxy or y
  585.             ui.addTextArea(1, s, name, x, y, nil, nil, 1, 0, 0.7)
  586.         elseif #pList==1 then
  587.             eventTextAreaCallback(1, name, 'amenu0'..pList[1])
  588.         end
  589.     end
  590.     if players[name].keys[17] and isAdmin(name) then
  591.         local pList={}
  592.         for n, p in pairs(tfm.get.room.playerList) do
  593.             if math.abs(p.x-x)<4500 and math.abs(p.y-y)<4500 then
  594.                 table.insert(pList, n)
  595.             end
  596.         end
  597.         if #pList>1 then
  598.             local s='<R><a href="event:close"><b>Close</b></a><V>'
  599.             for i=1, #pList do
  600.                 s=s..string.format('\n<a href="event:amenu0%s">%s</a>', pList[i], pList[i])
  601.             end
  602.             local maxy=380-(14*(#pList+1))
  603.             local y=y>maxy and maxy or y
  604.             ui.addTextArea(1, s, name, x, y, nil, nil, 1, 0, 0.7)
  605.         elseif #pList==1 then
  606.             eventTextAreaCallback(1, name, 'amenu0'..pList[1])
  607.         end
  608.     end
  609.     if teleporton == true then
  610.         mousex = tfm.get.room.playerList[name].x
  611.         mousey = tfm.get.room.playerList[name].y
  612.         tfm.exec.movePlayer(name, x, y, false, 0, 1, false)
  613.         tfm.exec.displayParticle(36, mousex, mousey, 0, -20, 0, 0, nil)
  614.         tfm.exec.movePlayer(name, x, y, false, 0, 1, false)
  615.         y = y-160
  616.         tfm.exec.displayParticle(36, x, y, 0, 20, 0, 0, nil)
  617.         y = y+160
  618.     end
  619.     if teleporton == nil then
  620.         teleporton = false
  621.     end
  622.     if hearton == true then
  623.         local size = 5;
  624.         local x_position = x;
  625.         local y_position = y;
  626.  
  627.         for t=0, 2*math.pi, 0.1 do
  628.        
  629.             x=(16*math.sin(t)^3)*size + x_position
  630.             y=(13*math.cos(t)-5*math.cos(2*t)-2*math.cos(3*t)-math.cos(4*t))*size
  631.             y=-y + y_position
  632.            
  633.             tfm.exec.addShamanObject(0, x, y);
  634.            
  635.         end
  636.     if hearton == nil then
  637.         hearton = false
  638.     end
  639.     else
  640.         end
  641. end
  642.  
  643. function eventLoop(time, remainingtime, name, x, y)
  644.     if snowon == true and snowballlock == false then
  645.         tfm.exec.snow(1, 100)
  646.     end
  647.     if vanillamodeon == true then
  648.         if alive <= 0 or remainingtime <= 1000 then
  649.             nextRound();
  650.             tfm.exec.disableAutoNewGame(false)
  651.             tfm.exec.disableAutoShaman(false)
  652.         end
  653.     end
  654.     for name,player in pairs(tfm.get.room.playerList) do
  655.         if player.isShaman then
  656.             for name in pairs(namecolor) do
  657.                 if namecolor[name] ~= nil then
  658.                     tfm.exec.setNameColor(name, "0x"..namecolor[name])
  659.                 end
  660.             end
  661.         end
  662.     end
  663.     if vanillamodeon==true and mapcode~=4445759 then
  664.         if teleporton==true then
  665.             tfm.exec.newGame(4445759)
  666.             teleporton = false
  667.             if isBanned(name) ~= true then
  668.                 ui.removeTextArea(106, playerList)
  669.                     ui.addTextArea(106, "<a href='event:teleport'><N2>"..text.teleport.."</a>", playerList, -200, 130, 150, 20, 0x465A6E, 0x324650, 1, true)
  670.             end
  671.         end
  672.         if flyon==true then
  673.             tfm.exec.newGame(4445759)
  674.             flyon = false
  675.             for name, player in pairs(tfm.get.room.playerList) do
  676.                 tfm.exec.bindKeyboard(name, 32, true, false)
  677.             end
  678.             if isBanned(name) ~= true then
  679.                 ui.removeTextArea(107, playerList)
  680.                 ui.addTextArea(107, "<a href='event:fly'><N2>"..text.fly.."</a>", playerList, -200, 160, 150, 20, 0x465A6E, 0x324650, 1, true)
  681.             end
  682.         end
  683.         if snowon==true then
  684.             tfm.exec.newGame(4445759)
  685.             snowon = false
  686.             teleandflylock = false
  687.             if isBanned(name) ~= true then
  688.                 ui.removeTextArea(106, playerList)
  689.                 ui.addTextArea(106, "<a href='event:teleport'><N2>"..text.teleport.."</a>", playerList, -200, 130, 150, 20, 0x465A6E, 0x324650, 1, true)
  690.                 ui.removeTextArea(107, playerList)
  691.                 ui.addTextArea(107, "<a href='event:fly'><N2>"..text.fly.."</a>", playerList, -200, 160, 150, 20, 0x465A6E, 0x324650, 1, true)
  692.                 ui.removeTextArea(111, playerList)
  693.                 ui.addTextArea(111, "<a href='event:snowball'><N2>"..text.snowball.."</a>", playerList, -200, 280, 150, 20, 0x465A6E, 0x324650, 1, true)
  694.             end
  695.         end
  696.     end
  697.     for name,player in pairs(tfm.get.room.playerList) do
  698.         if player.playerName == "Umielyon" then
  699. umielyonx = player.x
  700. umielyony = player.y
  701.         end
  702.         if player.playerName == "Cgtmouse" then
  703. cgtmousex = player.x
  704. cgtmousey = player.y
  705.         end
  706.         if player.playerName == "Kageroutea" then
  707.             kagerouteax = player.x
  708.             kagerouteay = player.y
  709.         end
  710.     end
  711.     if pathon == true then
  712.         for name,player in pairs(tfm.get.room.playerList) do
  713.             if holding[name] == true then
  714.                 tfm.exec.addConjuration(player.x/10, player.y/10+2, 10000)
  715.             end
  716.         end
  717.     end
  718. end
  719.  
  720. function nextRound()
  721.     tfm.exec.disableAutoNewGame(true)
  722.     tfm.exec.newGame(maps[math.random(#maps)]);
  723. end
  724.  
  725. function eventNewGame()
  726.         for name,player in pairs(tfm.get.room.playerList) do
  727.             if player.isShaman then
  728.                 tfm.exec.setPlayerScore(name,0,false)
  729.             end
  730.         end
  731.     totalplayers = 0
  732.     for name,player in pairs(tfm.get.room.playerList) do
  733.         totalplayers = totalplayers+1
  734.     end
  735.     tfm.exec.disableAutoNewGame(true)
  736.     tfm.exec.disableAutoScore(true)
  737.     alive = 0
  738.     place = 0
  739.     for name, player in pairs(tfm.get.room.playerList) do
  740.         alive = alive+1
  741.     end
  742.     mapcode = tfm.get.room.currentMap
  743.     if mapcode == "@4445759" then
  744.         tfm.exec.setUIMapName("<VP>Cloud Strife - House")
  745.     else
  746.         tfm.exec.setUIMapName("<VP>Cloud Strife - Map "..mapcode)
  747.         tfm.exec.disableAutoShaman(false)
  748.     end
  749.     if gravity == 0 then
  750.         xml = tfm.get.room.xmlMapInfo.xml:gsub("<P ", "<P G=\"0, 0\"")
  751.     else
  752.     end
  753. --  if vanillamodeon == true then
  754. --      xml = tfm.get.room.xmlMapInfo.xml:gsub("<P /><Z><S /><D><P ", "<P G=\"0,0\" /><Z><S /><D><P X=\"400\" P=\"1,0\" C=\"fdfdfd\" Y=\"209\" T=\"89\"")
  755. --  end
  756. end
  757.  
  758. function eventPopupAnswer(ID, name, answer)
  759.     local aID=players[name].aMenu.pID
  760.     if ID == 42 then
  761.         if answer == "yes" then
  762.             vanillamodevote = vanillamodevote+1
  763.             if vanillamodevote >= (totalplayers/2)+(totalplayers/4) then
  764.                 ui.addPopup(42, 0, "Vote succeeded.", playerList, 10, 320, 180, true)
  765.                 vanillamodevote = 0
  766.                 eventTextAreaCallback(42, name, vanillamode)
  767.             end
  768.         end
  769.     elseif aMenu.actions[aID] and aMenu.actions[aID][3] and ID>=1 and ID<=#aMenu.actions[aID][3] then
  770.         if answer=='' then
  771.             players[name].aMenu.params[aID][ID]=nil
  772.         else
  773.             players[name].aMenu.params[aID][ID]=answer
  774.         end
  775.         showParamPopup(name, ID, aMenu.actions[aID][3][ID], players[name].aMenu.params[aID][ID])
  776.     elseif ID == 65 then
  777.         if answer == "" then
  778.         else
  779.             tfm.exec.newGame(answer)
  780.             ui.addTextArea(786, "<V>"..name.." <N>"..text.changemapattempt.."        <p align='right'><R><a href='event:close'>X</a></p>", playerList, 400, 500, 300, 20, 1, true, true)  
  781.             flyon = false
  782.             teleporton = false
  783.         end
  784.     elseif ID == 67 then
  785.         if answer == "" then
  786.         else
  787.             tfm.exec.setNameColor(name, "0x" .. answer)
  788.             namecolor[name] = answer
  789.         end
  790.     end
  791. end
  792.  
  793. function showParamPopup(name, i, key, val)
  794.     ui.addPopup(i, 2, string.format('<p align="center"><b>%s:</b> %s', key, tostring(val or '')), name, 170+(((i-1)%6)*105), (math.floor((i-1)/6)*75)+20, 100, true)
  795. end
  796.  
  797. function eventEmotePlayed(emoteName, emote)
  798.     if emote == 3 then
  799.         for name,player in pairs(tfm.get.room.playerList) do
  800.             if player.x<=umielyonx+5 or player.x<=cgtmousex+5 or player.x<=kagerouteax+5 then
  801.                 if player.x>=umielyonx-5 or player.x>=cgtmousex-5 or player.x>=kagerouteax-5 then
  802.                     if player.y<=umielyonry+5 or player.y<=cgtmousey+5 or player.x<=kagerouteay+5 then
  803.                         if player.y>=umielyony-5 or player.y>=cgtmousey-5 or player.y>=kagerouteay-5 then
  804.                             if emoteName == name then
  805.                                 tfm.exec.giveCheese(emoteName)
  806.                             end
  807.                         end
  808.                     end
  809.                 end
  810.             end
  811.         end
  812.     end
  813. end
  814.  
  815. function callPlayerFunction(name, func, ...)
  816.     if name=='*' then
  817.         for n in pairs(tfm.get.room.playerList) do
  818.             func(n, ...)
  819.         end
  820.     else
  821.         func(name, ...)
  822.     end
  823. end
  824.  
  825. function eventChatCommand(name, cmd)
  826. local cmd_args = {}
  827.     for arg in cmd:gmatch("[^%s]+") do
  828.         table.insert(cmd_args, arg)
  829.     end
  830.     if cmd=='shaman' or cmd=='sham' then
  831.         tfm.exec.setShaman(name)
  832.     end
  833.     if cmd=='avampire' or cmd=='avamp' then
  834.         tfm.exec.setVampirePlayer(name)
  835.     end
  836.     if cmd_args[1] == "color" then
  837.         if cmd_args[2] == '' then
  838.             eventNewPlayer(name)
  839.         else
  840.             tfm.exec.setNameColor(name, "0x"..cmd_args[2])
  841.             namecolor[name] = cmd_args[2]
  842.         end
  843.     end
  844.     if cmd=='totalplayers' then
  845.         print(totalplayers)
  846.     end
  847.     if cmd=='totalvotes' then
  848.         print(vanillamodevote)
  849.     end
  850.     if cmd=='meep' then
  851.         tfm.exec.giveMeep(name)
  852.     end
  853.     if isAdmin(name) then
  854.         if cmd=='amenu' then
  855.             eventTextAreaCallback(1, name, 'amenu0'..name)
  856.         elseif cmd:sub(1, 6)=='amenu ' then
  857.             eventTextAreaCallback(1, name, 'amenu0'..cmd:sub(7))
  858.         end
  859.     end
  860. end
  861. command = {handlers = {}}
  862. function command.addHandler(text, handler)
  863.     if command.handlers[text] == nil then
  864.         command.handlers[text] = {}
  865.     end
  866.     table.insert(command.handlers[text], handler)
  867. end
  868. function command.removeHandler(text, handler)
  869.     if command.handlers[text] ~= nil then
  870.         local index
  871.         for i, h in ipairs(command.handlers[text]) do
  872.             if handler == h then
  873.                 index = i
  874.             end
  875.         end
  876.         if index ~= nil then
  877.             table.remove(command.handlers[text], index)
  878.             if #command.handlers[text] == 0 then
  879.                 command.handlers[text] = nil
  880.             end
  881.         end
  882.     end
  883. end
  884. function command.handle(text, player, args)
  885.     if command.handlers[text] ~= nil then
  886.         for i, handler in ipairs(command.handlers[text]) do
  887.             handler(player, unpack(args))
  888.         end
  889.     end
  890. end
  891. function string.split(str, s)
  892.     local res = {};
  893.     for part in string.gmatch(str, "[^" .. s .. "]+") do
  894.         table.insert(res, part)
  895.     end
  896.     return res;
  897. end
  898. function yasayanFareSayisi()
  899.     local i=0
  900.     for _, oyuncu in pairs(tfm.get.room.playerList) do
  901.         if not oyuncu.isDead then
  902.             i=i+1
  903.         end
  904.     end
  905.     return i
  906. end
  907. function unpack (t, i)
  908.     i = i or 1
  909.     local v = t[i]
  910.     if v ~= nil or #t > i then return v, unpack(t, i+1) end
  911. end
  912. function table.copy(t, d)
  913.     d = d or false
  914.     local rt = {}
  915.     for k, v in pairs(t) do
  916.         if d then
  917.             if type(k) == "table" then
  918.                 k = table.copy(k, true)
  919.             end
  920.             if type(v) == "table" then
  921.                 v = table.copy(v, true)
  922.             end
  923.         end
  924.         rt[k] = v
  925.     end
  926.     return rt
  927. end
  928. init()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement