Advertisement
NoorTFM

الأرض تحولت إلى حمم بركانية

Mar 6th, 2021
1,236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 24.00 KB | None | 0 0
  1.  
  2. --[[Commands list:
  3. 1. !ms [MSG] = Send a message as a funcorp member.
  4. 2. !start = starts the game!
  5. 3. !stop = stops the game!
  6. 4. !g = will switch the ground(if current ground is lava , then it will switch it to dirt same with dirt to lava)!
  7. 5. !tp all = turn on the tp power(See Other powers list to know how to use it)!
  8. 6. !anvilgod = show anvilgod!
  9.  
  10. Other powers:
  11. 1. If tp power is on , then Mouse click anywhere in the map to teleport everyone aswell as you to the mouse position!
  12. 2. Hold Shift+Mouse click = spawn random objects in your mouse position!
  13. 3. Admins only can use the imagelist
  14. ]]
  15.  
  16. imgList = {
  17.     {"Return To Mouse", "153d331c6b9", 50, 48},
  18.     {"Dora Mouse", "1740e70c6cc", 27, 45, "1740e704f7c",27, 45},
  19.     {"Stripper Horse", "165df07c053", 36, 70, "165df038d30", 36, 70},
  20.     {"Mouse with broom", "155c9fa9ef2", 40, 60, "155c9fab3f1",40, 60},
  21.     {"Meli Mask", "1670d6b8629", 40, 55, "1670d6c6973", 40, 55},
  22.     {"Mouse Feels", "16760a89ce2", 27, 45, "16760a8be17",27, 45},
  23.     {"Mouse Pika", "16760bc8d92", 27, 45, "16760bcabfb", 27,45},
  24.     {"Zalekha", "16f723031cb", 25, 30, "16f6d89a920", 25, 30};
  25.     {"Poop", "155c4a31e48",25, 30},
  26.     {"Toilet", "1507c256bcc", 23, 41, "1507c258fe8", 23, 41},
  27.     {"Dora", "155c4d1de05", 25, 45, "155c4d1f100", 25, 45},
  28.     {"Makka Pakka", "1746b07f701", 30, 60, "1746b0a835c", 30, 60},
  29.     {"Upsy Daisy", "1746b08317b", 30, 65, "1746b095bca", 30, 65},
  30.  
  31.     {"Derp dove", "172e1ca9b44", 35, 40, "172e1ca6f30", 55, 40},
  32.     {"Spiderman", "168a994a147", 50, 61, "168a994c06f", 50, 61},
  33.     {"Spiderman2","168aa026d06", 50, 144, "168aa024cca", 50, 144},
  34.     {"Spiderman3","168aa03190a", 65, 71, "168aa033d46", 65, 71},
  35.     {"Spiderman4", "168aa029248", 50, 147, "168aa02b44d", 50, 147},
  36.     {"Spongebob1","155c49750bd", 30, 38, "155c4976244", 30, 38},
  37.     {"Spongebob2","174da18560a", 30, 45, "174da17dbbe", 30, 45},
  38.     {"Wild Spongebob","155c4aac0b4", 20, 36, "155c4aadc1c", 20, 36},
  39.     {"Jerry", "171524a755e", 40, 42,"1740c7d4de6", 40, 42},
  40.     {"Jerry2", "1740c7a6f61", 38, 35,"171524ab085", 38, 35},
  41.     {"Jerry3","1717581267e", 35, 80,"1717581457e",35, 80},
  42.     {"Jerry4","174d12f563b", 35, 60,"174d12f1634",35, 60},
  43.     {"Jerry5","174d140642c", 40, 70,"174d14019e2",40, 70},
  44.     {"Jerry Yaaa!","1718e694e82", 32, 90,"1718e698ac9",42, 90},
  45.     {"Nibbles", "174d163217a",20, 33,"174d165c0fc",20, 33},
  46.  
  47.     {"Tom1", "174da253891", 20, 52, "174da244df6", 30, 52},
  48.     {"Tom2","1718e3f183d", 40, 65,"1718e3f4491", 30, 65},
  49.     {"Annoying Orange", "155ca0f4af3", 25, 30, "155ca0f5ca7", 25, 30},
  50.     {"Smudge The Cat","1740c8e68af", 45, 65,"1740c8f0857", 45, 65},
  51.     {"Yelling Girl","1740c8ac500", 60, 65,"1740c8a4791", 30, 65},
  52.     {"Shawarma", "155c4b131dc",30, 35,"155c4b14458",30, 35},
  53.     {"HIS NAME IS JOHN CENA", "1556848a816", 20, 35},
  54.     {"Tigrounette", "1557c2e6143", 27, 50},
  55.     {"Melibellule", "165968be277", 35, 55},
  56.     {"Meli 1", "1507b11647d", 40, 50},
  57.     {"Meli 2", "1507b1175bb", 40, 50},
  58.     {"Meli 3", "1507b11865a", 40, 50},
  59.     {"Meli 4", "1740cbdc8ed", 40,60 ,"1507b1196d0", 40, 60},
  60.     {"Cardi B", "175049583f9", 40,40 ,"1750495fec9", 40, 40},
  61.     {"Cardi B 2", "17504a03bff", 25,65 ,"17504a0c32d", 35, 65},
  62.  
  63.     {"Meme boy1","174db462997", 36, 60},
  64.     {"Meme boy2","174db466907", 36, 60},
  65.  
  66.     {"Meow", "168a08101ee", 45, 114, "168a080e0c2", 45, 114},
  67.     {"Meow", "168be2c2308", 50,115, "168be2b7832", 50, 115},
  68.     {"Nee CAT!", "168ebed1afb", 50, 111, "168ebed365e", 50,111},
  69.     {"Nyan CAT!","168be3786ce", 60, 29,"168be37ab13", 60, 29},
  70.     {"Mr.Bean", "168a9a39885", 40, 137, "168a9a3b89f", 40, 137},
  71.     {"Mr.Bean2","168a9a3f843", 57, 152, "168a9a3d80f", 57, 152},
  72.     {"Huuh??", "168b443ea6c", 50, 88,"168b443cc09", 50, 88},
  73.     {"Baldi","1740d1f4816", 20, 75},
  74.     {"Bush","1714bb4b8b1", 34, 21},
  75.  
  76.     {"wat?","168be2e46a2", 55, 79, "168be2d9a28", 55, 79},
  77.     {"Fox : Huh?","168a9914efe", 50, 138, "168a9912f23", 65,138},
  78.     {"Fat Bugs Bunny", "16a1132c123",40, 116,"16a1132a8d5", 40, 116},
  79.     {"Fat Sonic", "168a080bc7f", 50, 63,  "168a0809dae", 50, 63},
  80.     {"Shrek!", "168a9933057", 50, 87,"168a993157e", 50, 87},
  81.     {"Harold Doctor","168a03691f5", 40, 95, "168a0366e69", 40, 95},
  82.     {"Illuminati", "1689fca843e", 50, 70, "1689fca5c2c", 50, 70},
  83.     {"Yee", "1740e52b581", 20, 60, "1740e54207d", 20, 60},
  84.     {"SadCat", "16f7265452d", 50, 75, "16f72691537", 50, 75},
  85.     {"Otah Mshmoshea", "1718e59096d", 50, 70, "1718e593562", 50, 70},
  86.     {"Pennywise (IT)", "170acc07423", 37, 65, "170acc048de", 37, 65},
  87.     {"Jackie chan", "168be33dd35", 60, 52, "168be33feae", 60, 52},
  88.     {"Psyduck", "1740e503949",15, 40,"1740e53a0be",15, 40},
  89.     {"Patrick", "1740e53347e",25, 55,"1740e4fca1d",25, 55},
  90.  
  91.     {"Pink Cat", "153ec4eef26", 23, 30, "153ec4ec77d", 26, 30},
  92.     {"Black Cat", "1740d7e5fa2", 23, 50,"1740d8448b9", 23, 50},
  93.     {"Batman", "174da12a81b", 35, 55,"174da122df6", 35, 55},
  94.  
  95.     {"Cute Groot", "1740d7ea145", 23, 57},
  96.     {"Cute Turtle", "1740d7e24fb", 23, 50},
  97.  
  98.     {"Nekoburger", "153ec7e82d6", 23, 26, "153ec7e664b", 26, 26},
  99.     {"Tabby", "154c592261e", 30, 32, "154c5925a15", 27, 32},
  100.     {"Squirrel", "156d73b5b13", 21, 24, "156d738d5b1", 20, 24},
  101.     {"Peppa Pig", "155777ce1ab", 45, 55, "155777cc660", 45, 55},
  102.     {"Waddles", "155c51325da", 25, 30, "155c5133917", 25, 30},
  103.     {"Ariana Grande", "1740d11d767", 45, 80,  "1740d1246e7", 45, 80},
  104.     {"The Angel Ariana Grande", "1740d18a86d",32, 45,  "1740d190eec", 32, 45},
  105.    
  106.     {"Amoung Us Red", "174d9e1a5cc",20, 30,  "174d9e0072e",20, 30},
  107.     {"Amoung Us Cyan", "174d9e43cac",20, 30,  "174d9e01e9e",20, 30},
  108.     {"Amoung Us Blue", "174d9e4541d",20, 30,  "174d9e03612",20, 30},
  109.     {"Amoung Us Purlple", "174d9e4e0c5",20, 30,  "174d9e0c2be",20, 30},
  110.     {"Amoung Us Green", "174d9e46b8f",20, 30,  "174d9e04d84",20, 30},
  111.     {"Amoung Us Pink", "174d9e482ff",20, 30,  "174d9e064f6",20, 30},
  112.     {"Amoung Us Yellow", "174d9e49a71",20, 30,  "174d9e07c67",20, 30},
  113.     {"Amoung Us Black", "174d9e4b1e2",20, 30,  "174d9e093d9",20, 30},
  114.     {"Amoung Us White", "174d9e4c974",20, 30,  "174d9e0ab49",20, 30},
  115.     {"Mini White Crewmate", "174da0228c6",10, 15,  "174da01d1ae",10, 15},
  116.  
  117. }
  118. menuPages = math.ceil(#imgList/6)
  119.  
  120. keys = {0,2}
  121. _left = 0
  122. _right = 2
  123. memesMenu = true
  124. imgData = {}
  125. facingLeft = {}
  126. imgId = {}
  127.  
  128. mice = {}
  129.  
  130. anvilgod={}
  131. lava={}
  132. anvilgodImg = {"1736c5e3efe.png","1736c86888e.png"}
  133. backgrounds = {"173cf0990b3.png","173cf03fa86.png","173cf0392da.png","17372d45dca.jpg","17372d3d135.png","1736d136ca9.png","1736d34a204.png","17369683742.jpg","173695d6d70.jpg","17369524d79.jpg","17369524d79.jpg","1736951e776.jpg","17305a13915.png","172fd0940c4.png","172fd0847d7.png","1712c2e573f.png","1711ecc824b.jpg","1711e9a5172.jpg","1711e9a072a.jpg","1711e8ce5f7.jpg","1711e8ca452.jpg","1711e8c0569.jpg","165245b5238.jpg","1700112d165.jpg","17001097f5a.jpg","170013d6683.jpg"}
  134. game = {
  135.     admins = {"Noooooooorr#0000","Kiwi_is_here#0558","Massi#0010","Lalajb#0000","Uvfn#0000"},
  136.     time = 8,
  137.     started = false,
  138.     currentGround = "dirt",
  139.     dirtTimer = nil,
  140.     lavaTimer = nil,
  141.     dirtCD = 3000,
  142.     lavaCD = 10000,
  143.     tArea = 10,
  144.     objects = {1,2,3,4,6,7,10,39,59,60,62,68},
  145.     maps = {"6121962","6121962"},
  146.     objectsList = {},
  147.     ground = {}
  148. };
  149. players = {}
  150. local looper = 0
  151. local reapet = truelocal
  152. tpAll = false
  153. local sObjects = false
  154. game.ground.lava = {type = 3,x = 800,y = 387,r = 0.2,f = 0.3,w = 1600,h = 37,gc = true,mc = false}
  155. game.ground.dirt = {type = 6,x = 800,y = 387,r = 0.2,f = 0.3,w = 1600,h = 37,gc = true,mc = true}
  156. translation = {
  157.     en = {welcome="Welcome to FunCorp! Beware! THE FLOOR IS LAVA!!!",
  158.         floorislava="THE FLOOR IS LAVA!",
  159.         win="%s has won the game",
  160.         anvil_here="Anvilgod is here!",
  161.         anvil_nothere="Anvilgod isn't here anymore!"},
  162.     ar = {welcome="!أهلا بكم في الفانكورب! لقد تحولت الأرض الى حمم بركانية،كن حذرا",
  163.         floorislava="!الأرض أصبحت حمم بركانية",
  164.         win="!في الجولة %s فاز",
  165.         anvil_here="!إله السنادين هنا،إحترس",
  166.         anvil_nothere="!لم يعد إله السنادين هنا بعد الآن"},
  167.     ru = {welcome="Добро пожаловать в FunCorp! Осторожно! ПОЛ - ЭТО ЛАВА!!!",
  168.         floorislava="ПОЛ - ЭТО ЛАВА!",
  169.         win="%s выиграл(а) этот раунд.",
  170.         anvil_here="Анвилгод здесь!",
  171.         anvil_nothere="Анвилгод здесь больше нет!"},
  172.     fr = {welcome="Bienvenue sur FunCorp! Attention ! Le sol est en lave!!!",
  173.         floorislava="Le sol est en lave!!!",
  174.         win="%s a gagné la ronde",
  175.         anvil_here="Anvilgod est là!",
  176.         anvil_nothere="Anvilgod n'est plus là!"},
  177.     tr = {welcome="Funcorp'a Hoşgeldiniz! Dikkat! BU ZEMİN LAV!",
  178.         floorislava="BU ZEMİN LAV!",
  179.         win="%s oyunu kazandı.",
  180.         anvil_here="Anvilgod burada!",
  181.         anvil_nothere="Anvilgod artık burada değil!"},
  182. }
  183.    
  184.  
  185. function tran(n, id)
  186.     if translation[tfm.get.room.playerList[n].community] then
  187.       return translation[tfm.get.room.playerList[n].community][id]
  188.     else
  189.       return translation["en"][id]
  190.     end
  191. end
  192.  
  193. function main()
  194.     tfm.exec.disableAutoNewGame(true)
  195.     tfm.exec.disableAutoTimeLeft(true)
  196.     tfm.exec.disableAutoShaman(true)
  197.     tfm.exec.disableAutoScore(true)
  198.     system.disableChatCommandDisplay(nil,true)
  199.     tfm.exec.disablePhysicalConsumables(true)
  200.  
  201.     changeMap()
  202.     table.foreach(
  203.         tfm.get.room.playerList,
  204.         function(name)
  205.             eventNewPlayer(name)
  206.         end
  207.     )
  208. end
  209.  
  210. function changeMap()
  211.     tfm.exec.newGame(game.maps[math.random(1,#game.maps)])
  212. end
  213.  
  214. local setScore = function(name) tfm.exec.setPlayerScore(name, players[name].score, false) end
  215. local refreshTimers = function(ground) if ground == "dirt" then game.dirtTimer = 3 elseif ground == "lava" then game.lavaTimer = 10 else game.lavaTimer = 10 game.dirtTimer = 3 end end
  216.  
  217. function removeObjects()
  218.     for _,i in next,game.objectsList
  219.     do
  220.         tfm.exec.removeObject(i)
  221.     end
  222.     game.objectsList = {}
  223. end
  224.  
  225. local resetProp = function() game.time = 60 game.tArea = 10 game.objectsList = {} game.currentGround = "dirt" refreshTimers() end
  226. local removeAreas = function() for _,area in next,{999,2,666} do ui.removeTextArea(area,nil) end end
  227.  
  228. function alivePlrCount()
  229.     local c = 0
  230.     for n,p in pairs(tfm.get.room.playerList) do
  231.         if not p.isDead then
  232.             c = c + 1
  233.         end
  234.     end
  235.     return c
  236. end
  237.  
  238. local isAdmin = function(name) for _,n in next,game.admins do if n == name then return true end end return false end
  239.  
  240. function spawnObjects(x,y)
  241.     if game.started == true then
  242.         local oC = math.ceil((game.time / 10 > 1 and game.time / 10 or 1))
  243.         local g = false
  244.         local a = nil
  245.         if o == 62 then
  246.             a = 90 g = true
  247.         end
  248.         if x ~= nil and y ~= nil then
  249.             local o = game.objects[math.random(1,#game.objects)]
  250.             if o == 62 then
  251.                 a = 90
  252.                 g = true
  253.             else
  254.                 a = nil
  255.                 g = nil
  256.             end
  257.             local sO = tfm.exec.addShamanObject(o, x, y, (a and a or 0),0,0, (g or false)) table.insert(game.objectsList,sO)
  258.         else
  259.             for i=1,oC,1 do
  260.                 local o = game.objects[math.random(1,#game.objects)]
  261.                 if o ==  62  then
  262.                     a = 90
  263.                     g = true
  264.                 else
  265.                     a = nil
  266.                     g = nil
  267.                 end
  268.                 local sO = tfm.exec.addShamanObject(o, math.random(100,1500), 360, (a and a or 0),0,0, (g or false)) table.insert(game.objectsList,sO)
  269.             end
  270.         end
  271.     end
  272. end  
  273.                
  274. function groundSwitch()
  275.     if game.started == true then
  276.         if game.currentGround == "dirt" then
  277.             local gP = game.ground.lava
  278.             tfm.exec.addPhysicObject(1, gP.x, gP.y, {type = gP.type,width = gP.w,height = gP.h,foreground = false,friction = gP.f, restitution = gP.r, angle = 0, miceCollision = gP.mc, groundCollision = gP.gc})
  279.             if not lava then lava = tfm.exec.addImage("173697132e1.png", "!1", 0, 350, nil) end
  280.             if anvil then
  281.                 spawnAnvilgod()
  282.             end
  283.             for n, player in next, tfm.get.room.playerList do
  284.                 ui.addTextArea(999, "<p align='center'><font size='40' color='#FF0000'>"..tran(n,"floorislava").."</font></p>", n, 140, 125, 520, 119, 0x324650, 0x000000, 0, true)
  285.             end
  286.             if not lava then lava = tfm.exec.addImage("173697132e1.png", "!1", 0, 350, nil) end
  287.                 refreshTimers(game.currentGround)
  288.             game.currentGround = "lava"
  289.         elseif game.currentGround == "lava" then
  290.             local gP = game.ground.dirt
  291.             for _,id in next,game.objectsList do
  292.                 tfm.exec.removeObject(id)
  293.             end
  294.             removeAnvilgod()
  295.             tfm.exec.addPhysicObject(1, gP.x, gP.y, {type = gP.type,width = gP.w,height = gP.h,foreground = false,friction = gP.f, restitution = gP.r, angle = 0, miceCollision = gP.mc, groundCollision = gP.gc})
  296.             if lava then tfm.exec.removeImage(lava) lava = nil end
  297.             refreshTimers(game.currentGround) game.currentGround = "dirt"
  298.             if anvil then
  299.                 removeAnvilgod()
  300.             end
  301.         end
  302.     end
  303. end
  304.  
  305. function giveWin(name)
  306.     tfm.exec.giveCheese(name)
  307.     tfm.exec.playerVictory(name)
  308.     players[name].score = players[name].score + 1
  309.     setScore(name)
  310. end
  311.  
  312. function setGround(g)
  313.     if game.started == false then
  314.         game.currentGround = g
  315.         local gP = game.ground[g]
  316.         if not lava then lava = tfm.exec.addImage("173697132e1.png", "!1", 0, 350, nil) end
  317.         tfm.exec.addPhysicObject(1, gP.x, gP.y, {type = gP.type,width = gP.w,height = gP.h,foreground = false,friction = gP.f, restitution = gP.r, angle = 0, miceCollision = gP.mc, groundCollision = gP.gc})
  318.     else
  319.         game.currentGround = g
  320.         local gP = game.ground[g]
  321.         if lava then tfm.exec.removeImage(lava) lava = nil end
  322.         tfm.exec.addPhysicObject(1, gP.x, gP.y, {type = gP.type,width = gP.w,height = gP.h,foreground = false,friction = gP.f, restitution = gP.r, angle = 0, miceCollision = gP.mc, groundCollision = gP.gc})
  323.         refreshTimers(game.currentGround)
  324.     end
  325. end
  326.  
  327. function eventNewGame()
  328.     removeAnvilgod()
  329.     for n,mouse in pairs(mice) do
  330.         facingLeft[n] = false
  331.         updateImg(n)
  332.     end
  333.     if game.started == true then
  334.         Background = backgrounds[math.random(#backgrounds)]
  335.         tfm.exec.addImage(Background, "_0", 0, 0, n)
  336.         resetProp()
  337.         system.removeTimer(meep)
  338.         meep = nil
  339.         reapet = true
  340.         tfm.exec.setGameTime(game.time, true)
  341.         setGround("dirt")
  342.         meep = system.newTimer(function() table.foreach(tfm.get.room.playerList,function(name) tfm.exec.giveMeep(name) end) end,35000,false)
  343.     else
  344.         resetProp()
  345.         setGround("dirt")
  346.     end
  347. end
  348.  
  349. function eventNewPlayer(name)
  350.     mice[name] = {menuPage = 1}
  351.     for _,k in pairs(keys) do
  352.         tfm.exec.bindKeyboard(name, k, true)
  353.     end
  354.     facingLeft[name] = false
  355.   updateImg(name)
  356.     if memesMenu then
  357.         for _,n in next,game.admins do
  358.             ui.addTextArea(0, "<p align='center'><font color='#010101'><a href='event:openMenu'>CLICK HERE</a></font></p>", n, 714, 380, 82, 16, 0xff5880, 0xff00cc, 0.8, true)
  359.         end
  360.     end
  361.     if Background then tfm.exec.addImage(Background, "_0", 0, 0, name) end
  362.     if players[name] then
  363.         players[name].score = 0
  364.         setScore(name)
  365.     else
  366.         players[name] = {score = 0}
  367.         setScore(name)
  368.     end
  369.     tfm.exec.chatMessage("<font color='#FF7F0F'>"..tran(name,"welcome").."\n",name)
  370.    
  371.     if isAdmin(name) then
  372.         system.bindMouse(name, true)
  373.         system.bindKeyboard(name, 16, false, true)
  374.         system.bindKeyboard(name, 16, true, true)
  375.     end
  376. end
  377.  
  378. function eventPlayerDied(name)
  379.     if game.started == true then
  380.         if alivePlrCount() <= 1 then
  381.             reapet = false removeAreas()
  382.             for name,p in next,tfm.get.room.playerList do
  383.                 if not p.isDead then
  384.                     for n, player in next, tfm.get.room.playerList do
  385.                         ui.addTextArea(2, "<p align='center'><font size='30' color='#FFFF00'>"..string.format(tran(n,"win"),name).."</font></p>", n, 50, 250, 700, 500, 0x324650, 0x000000, 0, true)
  386.                         ui.addTextArea(999, "<p align='center'><font size='50' color='#FF0000'>"..tran(n,"floorislava").." </font></p>", n, 50, 125, 700, 119, 0x324650, 0x000000, 0, true)
  387.                     end
  388.                     giveWin(name)
  389.                 end
  390.             end
  391.             system.newTimer(function() removeAreas() changeMap() end, 5000, false)
  392.         end
  393.     end
  394. end
  395.    
  396. function eventChatCommand(name, command)
  397.     local arg={}
  398.     for argument in command:gmatch('[^%s]+') do
  399.         table.insert(arg,argument)
  400.     end
  401.     if isAdmin(name) == true then
  402.         if arg[1] == "ms" and arg[2] ~= nil then
  403.             local t = command:find('%s')
  404.             local msg = command:sub(t+1)
  405.             tfm.exec.chatMessage("<Fc>• [" ..name .."]:</Fc><CE> " ..msg .."</CE>")
  406.         end
  407.         if arg[1] == "tp" and arg[2] == "all" then
  408.             tfm.exec.chatMessage("<font color='#F95705'>• [FuncorpBot]:</font><bv> You turned ON tp power! <b>Mouse click</b> anywhere on the screen to teleport everyone!</bv>",name)
  409.             tpAll = true
  410.         end
  411.         if arg[1] == "start" then
  412.             if not game.started then
  413.                 game.started = true
  414.                 changeMap()
  415.             end
  416.         elseif arg[1] == "stop" then
  417.             if game.started == true then
  418.                 game.started = false
  419.                 removeAreas()
  420.                 changeMap()
  421.             end
  422.         elseif arg[1] == "g" then
  423.             removeAreas()
  424.             spawnObjects()
  425.             groundSwitch()
  426.         elseif arg[1] == "anvilgod" then
  427.             if anvil == true then
  428.                 anvil = false
  429.                 for n, player in next, tfm.get.room.playerList do
  430.                     tfm.exec.chatMessage("<font color='#FF7F0F'>"..tran(n,"anvil_nothere").."",n)
  431.                 end
  432.             else
  433.                 anvil = true  
  434.                 for n, player in next, tfm.get.room.playerList do
  435.                     tfm.exec.chatMessage("<font color='#FF7F0F'>"..tran(n,"anvil_here").."",n)
  436.                 end
  437.             end
  438.         end
  439.     end
  440. end
  441.  
  442. function checkAnvilgod()
  443.     if not anvilgodHere then
  444.         spawnAnvilgod()
  445.     else
  446.         removeAnvilgod()
  447.     end
  448. end
  449.  
  450.  
  451. function spawnAnvilgod()
  452.     anvilgodHere = true
  453.     xAnvigod = math.random(200,1400)
  454.     tfm.exec.explosion(xAnvigod+80,350,-400,300,false)
  455.     tfm.exec.explosion(xAnvigod+80,250,-400,300,false)
  456.     anvilgod = tfm.exec.addImage(anvilgodImg[math.random(#anvilgodImg)],"_3",xAnvigod,30)
  457. end
  458.  
  459. function removeAnvilgod()
  460.     if anvilgodHere then
  461.         anvilgodHere = false
  462.         if anvilgod then tfm.exec.removeImage(anvilgod) anvilgod=nil end
  463.     end
  464. end
  465.  
  466. function
  467. eventMouse(name, x, y)
  468. if isAdmin(name) then
  469.     if sObjects == true then
  470.         spawnObjects(x,y)
  471.     end
  472.     if tpAll == true then
  473.         for n,p in pairs(tfm.get.room.playerList) do
  474.             tfm.exec.movePlayer(n,x,y,false,0,0,false)
  475.         end
  476.         tpAll = false
  477.     end
  478. end
  479. end
  480.  
  481. function eventLoop(cT, tR)
  482. if game.started == true and reapet == true then
  483.     tR = tR / 1000
  484.     game.time = tR
  485.     looper = looper + 0.5
  486.     if looper == 1 then
  487.         if game.currentGround == "lava" then
  488.             if game.dirtTimer > 0  then
  489.                 game.dirtTimer = game.dirtTimer - 1 elseif
  490.                 game.dirtTimer <= 0 then
  491.                     groundSwitch()
  492.                     ui.removeTextArea(999, nil)
  493.                 end
  494.             end
  495.             if game.currentGround == "dirt" then
  496.                 if game.lavaTimer > 0 then
  497.                     if game.lavaTimer == 4 then
  498.                         spawnObjects()
  499.                     end
  500.                     ui.addTextArea(666, "<p align='center'><font color='0xffffff' face='soopafresh'><font size='90'>" ..game.lavaTimer .."</font></p>", nil, 340, 125, 120, 119, 0x324650, 0x000000, 0, true)
  501.                     game.lavaTimer = game.lavaTimer - 1
  502.                 elseif
  503.                 game.lavaTimer <= 0 then
  504.                     ui.removeTextArea(666,nil)groundSwitch()
  505.                 end
  506.             end
  507.             looper = 0
  508.         end
  509.     end
  510. end
  511.  
  512. function eventKeyboard(name, key, Keydown, x, y)
  513.     if isAdmin(name) then
  514.         if key == 16 then
  515.             if Keydown then
  516.                 sObjects = true
  517.             else
  518.                 sObjects = false
  519.             end
  520.         end
  521.     end
  522.     if key == _left then
  523.           facingLeft[name] = true
  524.       updateImg(name, true)
  525.      
  526.       elseif key == _right then
  527.           facingLeft[name] = false
  528.       updateImg(name, true)
  529.          
  530.       end
  531.   end
  532.  
  533.   function updateImg(name, turning)
  534.     local d = imgData[name]
  535.     if not d then return end
  536.    
  537.     if not d[5] then
  538.         if turning then return
  539.         else
  540.             facingLeft[name] = true
  541.         end
  542.     end
  543.         if imgId[name] then tfm.exec.removeImage(imgId[name]) end
  544.    
  545.     local img,x,y
  546.     if facingLeft[name] then
  547.         img,x,y = d[2],d[3],d[4]
  548.     else
  549.         img,x,y = d[5],d[6],d[7]
  550.     end
  551.         imgId[name] = tfm.exec.addImage(img..".png", "%"..name, -x, -y, nil)
  552. end
  553.  
  554. function eventTextAreaCallback(id, name, cb)
  555.     local mouse = mice[name]
  556.     if id == 0 then
  557.         if mouse.menuOpen then
  558.             mouse.menuOpen = false
  559.             closeMenu(name)
  560.         else
  561.             mouse.menuOpen = true
  562.             openMenu(name)
  563.         end
  564.        
  565.     elseif id == 2 and mouse.menuPage > 1 then
  566.         mouse.menuPage = mouse.menuPage - 1
  567.         openMenu(name)
  568.        
  569.     elseif id == 3 and mouse.menuPage < menuPages then
  570.         mouse.menuPage = mouse.menuPage + 1
  571.         openMenu(name)
  572.        
  573.     elseif id >= 10 and id <= 15 then
  574.         local k = cb:sub(12) + 0
  575.         if k == 1 then
  576.             for name in next, tfm.get.room.playerList do
  577.                 imgData[name] = nil
  578.             end
  579.             tfm.exec.killPlayer(name)
  580.         else
  581.             for name in next, tfm.get.room.playerList do
  582.                 imgData[name] = imgList[k]
  583.             end
  584.         end
  585.         updateImg(name)
  586.        
  587.     end
  588. end
  589.  
  590. function openMenu(name)
  591.     ui.addTextArea(1, "", name, 58, 44, 687, 110, 0x324650, 0x0, 0.4, true)
  592.     ui.addTextArea(16, "<p align='center'><font color='#010101' size='32'> &lt; </font></p>", name, 8, 80, 50, 50, 0x324650, 0x0, 0, true)
  593.     ui.addTextArea(17, "<p align='center'><font color='#010101' size='32'> &gt; </font></p>", name, 737, 80, 50, 50, 0x324650, 0x0, 0, true)
  594.     ui.addTextArea(2, "<p align='center'><font size='32'><a href='event:prevPage'> &lt; </a></font></p>", name, 6, 78, 50, 50, 0x324650, 0x0, 0, true)
  595.     ui.addTextArea(3, "<p align='center'><font size='32'><a href='event:nextPage'> &gt; </a></font></p>", name, 735, 78, 50, 50, 0x324650, 0x0, 0, true)
  596.    
  597.     local mouse = mice[name]
  598.     local page = mouse.menuPage
  599.     local menuImg = mouse.menuImg
  600.    
  601.     if menuImg then
  602.         for i=1,6 do
  603.             if menuImg[i] then tfm.exec.removeImage(menuImg[i]) end
  604.             ui.removeTextArea(9+i, name)
  605.         end
  606.     else
  607.         mouse.menuImg = {}
  608.         menuImg = mouse.menuImg
  609.     end
  610.    
  611.     for i=1,6 do
  612.         local id = (page-1)*6 + i
  613.         local data = imgList[id]
  614.         if not data then break end
  615.        
  616.         local x1 = 63 + 115 * (i-1)
  617.         ui.addTextArea(3+i, "", name, x1, 50, 100, 100, 0x324650, 0x0, 0.1, true)
  618.         ui.addTextArea(9+i, "<p align='center'><a href='event:chooseImage"..id.."'>" .. data[1] .. "</a></p>\"", name, x1, 168, 100, 24, 0x324650, 0x0, 0.6, true)
  619.         menuImg[i] = tfm.exec.addImage(data[2]..".png", "&10000", x1+50 - data[3], 100 - data[4], name)
  620.     end
  621. end
  622.  
  623. function closeMenu(name)
  624.     local menuImg = mice[name].menuImg
  625.     for i=1,6 do
  626.         if menuImg[i] then tfm.exec.removeImage(menuImg[i]) end
  627.     end
  628.     for i=1,17 do
  629.         ui.removeTextArea(i, name)
  630.     end
  631. end
  632.  
  633. main()
  634.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement