Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tfm.exec.chatMessage=print
- admins={Turkitutu=true}
- id={}
- data={}
- Cheese={}
- ghosts={}
- noafk={}
- tspace=false
- dataname={}
- GhostKing=""
- players={}
- langs={"ar","en"}
- RADIUS=150
- mice,t,tt,stime=0,0,0,10
- maxScore=0
- keys={70,37,38,39,40,90,32,0,1,2,3}
- stime=10
- POINTS_SKILL1,POINTS_SKILL2,POINTS_SKILL3=500,1500,2500
- POINTS_PLAYERS=500
- module="<font color='#797979'>#Ghost"
- tfm.exec.disableAutoShaman(true);
- tfm.exec.disableAutoNewGame(true);
- maps = {6878399,7005544,7008006,7009733}
- PV = {7,8,9,10,11,13}
- for c, i in pairs({"give","msg","np","stopm","skip"}) do system.disableChatCommandDisplay(i,true) end
- function Ghosts(n)
- for i,ghosts in ipairs(ghosts) do
- if n==ghosts then
- return true
- end
- end
- return
- false
- end
- function Noafk(n)
- for i,noafk in ipairs(noafk) do if n==noafk then return true end end return false
- end
- function Dataname(n)
- for i,dataname in ipairs(dataname) do if n==dataname then return true end end return false
- end
- function Langs(n)
- for i,langs in ipairs(langs) do
- if n==langs then
- return true
- end
- end
- return
- false
- end
- TextArea = function(n,id)
- if id then
- if id == 1 then
- ui.removeTextArea(446,n);
- ui.removeTextArea(445,n);
- ui.removeTextArea(444,n);
- ui.removeTextArea(443,n);
- ui.addTextArea(442, "<V><p align='center'><B><v><j><a href='event:openArea'><font size='16'>»",n, 775, 18, 15, nil, 0x000001, nil, 0.7,true)
- elseif id == 2 then
- ui.addTextArea(446, "<V><p align='center'><B><v><j><a href='event:claseArea'><font size='16'>«", n, 630, 18, 15, nil, 0x000001, nil, 0.7,true)
- ui.addTextArea(445, "<V><p align='center'><B><v><j><font size='16'><a href='event:info'>!",n, 660, 18, 15, nil, 0x000001, nil, 0.7,true)
- ui.addTextArea(444, "<V><p align='center'><B><v><j><font size='16'><a href='event:profil'>P",n, 690, 18, 15, nil, 0x000001, nil, 0.7,true)
- ui.addTextArea(443, "<V><p align='center'><B><v><j><font size='12'><a href='event:shop'>shop",n, 720, 23, 40, 18, 0x000001, nil, 0.7,true)
- ui.addTextArea(442, "<V><p align='center'><B><v><j><a href='event:help'><font size='16'>?",n, 775, 18, 15, nil, 0x000001, nil, 0.7,true)
- end
- end
- end
- function addData(n)
- data[n]={won=0,kill=0,king_ghosts=0,lang=tfm.get.room.playerList[n].community,PV=POINTS_PLAYERS,item="",skill1="false",skill2="false",skill3="false",skill="false",timee=0,Tspace=76,CheeseGhost=false}
- end
- function eventNewPlayer(n)
- mice=mice+1
- players = {};
- for n in pairs (tfm.get.room.playerList) do
- table.insert(players,n);
- for keys, k in pairs(keys) do
- tfm.exec.bindKeyboard(n, k, true, true)
- end
- end
- if not Dataname(n) then
- addData(n)
- table.insert(dataname,n)
- end
- tfm.exec.chatMessage(getTrans(n,"CHAT_MESSAGE","WELCOME"),n)
- TextArea(n,1)
- end
- translation = {
- ar = {
- CHAT_MESSAGE = {
- WELCOME = "<vp>#Ghost مرحبًا بك في<br><j>لفتح قائمة مساعدة<v> !help <j>قم بكتابة<br><j>لفتح المتجر<v> !shop <j>قم بكتابة<br><j>لفتح ملف شخصي<v> !p أسم شخص <j>-</j> !p <j>قم بكتابة<br><j>لفتح معلومات<v> !info <j>قم بكتابة",
- ERROR_BUY_SKIILS = "<r>لا تملك النقاط الكافية لشراء هذه الاداة",
- USE_SKILL_1 = "في وضعية الاستخدام <j>Spirit</j> تم وضع<br>لإستعمالها <j>[F]</j> اضغط",
- USE_SKILL_2 = "في وضعية الاستخدام <j>Speed</j> تم وضع<br>لإستعمالها <j>[F]</j> اضغط",
- USE_SKILL_3 = "في وضعية الاستخدام <j>Acrobat</j> تم وضع<br>لإستعمالها <j>[F]</j> اضغط",
- WON_MOUSE= "<VP>لقد تحصلت على 50 نقطة",
- KILL_MOUSE = "<R>بقتلك %s قام الشبح",
- KILL_MOUSE1 = "<vp>%s تحصلت على 30 نقطة بفضل نجاحك في قتل",
- SET_GHOST_PLAYER = "<j>!انت شبح الان<BR><vp>.قم بمنع الفأران من الفوز بواسطة زر المسافة",
- SET_GHOST_KING = "<j>!انت ملك الأشباح الان<BR><vp>.قم بمنع الفأران من الفوز و لا تنسى قدرتك على طيران ايضا.",
- GHOST_CHEESE = "<r>لا يجب على الأشباح اخذ قطع الجبن",
- ERROR_LANG = "<r>هذه اللغة غير متوفرة</r><br>en, ar <vp>: اللغات المتوفرة",
- ERROR_KEY = "<r>أنتظر حتى يمتلئ شريط الطاقة لديك",
- },
- INFO = {
- TITLE = "<b><font size='20'>معلومات</font></b>",
- TEXT = "<br><p align='right'><font size='13'>Turkitutu<j> :بواسطة</j><br>Jalalmen - Ahmedasln<j> : بعض الأفكار</j></font><br><font size='11'></p>",
- },
- SHOP = {
- TITLE = "<font size='30' color='#00A2E8' face='Tahoma'><B>متجر</B>",
- POINTS_PLAYER = "<font size='13'><p align='center'><font face='Tahoma' color='#D8D8D8'>نقطة <font color='#00A2E8'>%s</font> لديك</font></p>",
- TITLE_SKILL_1 = "<b><font color='#00A2E8' face='Tahoma'>فرقعة</b>",
- TITLE_SKILL_2 = "<b><font color='#00A2E8' face='Tahoma'>سرعة</b>",
- TITLE_SKILL_3 = "<b><font color='#00A2E8' face='Tahoma'>إختراق</b>",
- EQUIP_SKILL_1 = "<font color='#FFFFFF'><font size='11'><a href='event:item_skill1'>إرتداء",
- EQUIP_SKILL_2 = "<font color='#FFFFFF'><font size='11'><a href='event:item_skill2'>إرتداء",
- EQUIP_SKILL_3 = "<font color='#FFFFFF'><font size='11'><a href='event:item_skill3'>إرتداء",
- UNEQIIP_SKILL = "<font size='10'><v>تم إرتداءه",
- },
- PROFIL = {
- TEXT="<p align='right'><font size='14'><br><v><Won><n> : عدد مرات النجاة<br><br><v><Died><n> : عدد مرات الموت<br><br><v><King_Ghosts><n> : عدد مرات القيادة<br><br><br><p align='center'><j><Community> <n>: المجتمع",
- },
- HELP = {
- TITLE = "<b><font size='20'>مساعدة</font></b>",
- TEXT = "<p align='right'><font size='14'><j>: مهمة الفئران<br></j><font size='12'>كل ماعليك فعله هو التقاط قطعة الجبن و اخذها الى الجحر دون <BR>.ان يمسكك شبح و يقوم بقتلك <br><font size='14'><j>: مهمة الشبح<br></j><font size='12'>عند اختيارك كشبح كل ماعليك فعله هو محاولة منع الفئران<BR>.من دخول الجحر و قتلها و ذالك عبر لمس الفأر لفترة قصيرة <br><font size='14'><j>: مهمة ملك الاشباح<br></j><font size='12'>إذا كنت ملك الاشباح, عليك مساعدة فريقك في قتلِ ألفئران <br>وذلك بأنك ألوحيد ألذي يملك قدرة (الطيران) ولتستخدم تلك ألقدرة<br> عليك بالضغط على زر مسافة, فأنت ألذي يمكنك الطيران <br>.من بين كل الاشباح ألذي معك ",
- },
- TEXT_AREA = {
- CLASE ="اغلاق النافذة",
- CHARGER_SPACE = "<p align='center'><font size='10'>[SPACE] اضغط",
- CHARGER_SKILL = "<p align='center'><font size='10'>[F] اضغط",
- },
- },
- en = {
- CHAT_MESSAGE = {
- WELCOME = "<vp>Welcome to #Ghost<br><J>Type <v>!help </v>فo open Help menu<br>Type <v>!shop </v>to open shop<br>Type<v> !p </v> or <v> !p PlayerName </v>to open profile<br>Type <v>!info </v>to menu info<br>",
- ERROR_BUY_SKIILS = "<r>You don't have enough points to buy this item",
- USE_SKILL_1 = "<j>Spirit</j> has been added in use position<br>For use it press <j>[F]</j>",
- USE_SKILL_2 = "<j>Speed</j> has been added in use position<br>For use it press <j>[F]</j>",
- USE_SKILL_3 = "<j>Acrobat</j> has been added in use position<br>For use it press <j>[F]</j>",
- WON_MOUSE = "<vp>You've Got 50 Points",
- KILL_MOUSE = "<r>%s Has Killed You",
- KILL_MOUSE1 = "",
- SET_GHOST_PLAYER = "<j>You're a ghost now!<BR><vp>Prevent the rats from winning by pressing espace",
- SET_GHOST_KING = "<j>You're a king ghosts now!<BR><vp>Prevent the rats from winning and don't forget your power of flying.",
- GHOST_CHEESE = "<r>Ghost should not take pieces of cheese ",
- ERROR_LANG = "<r>This language is not available</r><br><vp>The Available Launguages:</vp> en, ar",
- ERROR_KEY = "<r>Wait until your energy bar fills up.",
- },
- INFO = {
- TITLE = "<b><font size='20'>Info</font></b>",
- TEXT = "<br><font size='13'><v>Made by : </v>Turkitutu<br><v>Some Ideas by : </v>Jalalmen - Ahmedasln<br><v>Translation To English: </v>Drassyan - Bodykudo</font><br><font size='11'></p>",
- },
- SHOP = {
- TITLE = "<font size='30' color='#00A2E8' face='Comic Sans MS'><B>Shop</B>",
- POINTS_PLAYER = "<font size='13'><p align='center'><font color='#D8D8D8'>You have <font color='#00A2E8'>%s</font> points.</font></p>",
- TITLE_SKILL_1 = "<b><font color='#00A2E8' face='Comic Sans MS'>Spirit</b>",
- TITLE_SKILL_2 = "<b><font color='#00A2E8' face='Comic Sans MS'>Speed</b>",
- TITLE_SKILL_3 = "<b><font color='#00A2E8' face='Comic Sans MS'>Acrobat</b>",
- EQUIP_SKILL_1 = "<font color='#FFFFFF'><font size='11'><a href='event:item_skill1'>Equip",
- EQUIP_SKILL_2 = "<font color='#FFFFFF'><font size='11'><a href='event:item_skill2'>Equip",
- EQUIP_SKILL_3 = "<font color='#FFFFFF'><font size='11'><a href='event:item_skill3'>Equip",
- UNEQIIP_SKILL = "<font size='10'><v>Unequip",
- },
- PROFIL = {
- TEXT="<font size='14'><br><n>Total Escape : <v><Won><br><br><n>Total Death : <v><Died> <br><br><n>Total King Ghosts : <v><King_Ghosts><br><br><br><p align='center'><n>Community : <j><Community>" ,
- },
- HELP = {
- TITLE = "<b><font size='20'>Help</font></b>",
- TEXT = "<font size='14'><j>Mission of Mice :<br></j><font size='12'>You should catch the cheese then enter the hole without the ghost catch and dont let he kill you<br><font size='14'><j>Mission of Ghosts : <br></j><font size='12'>When bat got choosed All you have to do is try to prevent mice from Entering a burrow and kill her Before time runs out<br><font size='14'><j>Mission of The King Ghosts : <br></j><font size='12'>If you are The Ghost, you must help your team to kill mice and that you're the only one who has the ability of (flight) and for use this ability on a space, then you're the only one who can fly, of all the ghosts.",
- },
- TEXT_AREA = {
- CLASE ="Close",
- CHARGER_SPACE = "<p align='center'><font size='10'>press [SPACE]",
- CHARGER_SKILL = "<p align='center'><font size='10'>press [F]",
- },
- },
- }
- for n,player in pairs(tfm.get.room.playerList) do
- mice=mice+1
- addData(n)
- TextArea(n,1)
- table.insert(dataname,n)
- table.insert(players, n);
- for keys, k in pairs(keys) do
- tfm.exec.bindKeyboard(n, k, true, true)
- end
- end
- getTrans = function(n,id1,id2)
- for n in pairs (tfm.get.room.playerList) do
- if translation[data[n].lang] then
- return translation[data[n].lang][id1][id2]
- else
- return translation["en"][id1][id2]
- end
- end
- end
- function eventKeyboard(n, key, down, x, y)
- if (key==0 or key== 1 or key== 2 or key== 3) then table.insert(noafk,n) end
- if key == 1 then
- if n==GhostKing and GhostFly then
- tfm.exec.movePlayer(n,0,0,false,0,-30,false)
- end
- elseif key == 0 then
- if canImgGhost and n==GhostKing then
- if id[n] ~= nil then
- tfm.exec.removeImage(id[n])
- id[n] = nil
- end
- id[n] = tfm.exec.addImage("157f3259f31.png", "%"..n, -35, -50) -- ←
- end
- elseif key == 2 then
- if canImgGhost and n==GhostKing then
- if id[n] ~= nil then
- tfm.exec.removeImage(id[n])
- id[n] = nil
- end
- id[n] = tfm.exec.addImage("157f325dcc3.png", "%"..n, -35, -50) -- →
- end
- elseif key == 90 then
- if n==GhostKing and GhostFly then
- tfm.exec.movePlayer(n,0,0,false,0,-40,false)
- end
- elseif key == 32 then
- if Ghosts(n) then
- if data[n].Tspace == 76 then
- data[n].Tspace = 0
- for nn,p in pairs(tfm.get.room.playerList) do
- if (nn ~= n) and (p.x >= x-(RADIUS/2) and p.x <= x+(RADIUS/2)) and (p.y >= y-(RADIUS/2) and p.y <= y+(RADIUS/2)) then
- eventPlayerKillByGhosts(n,nn)
- end
- end
- else
- tfm.exec.chatMessage(getTrans(n,"CHAT_MESSAGE","ERROR_KEY"),n)
- end
- end
- elseif key == 70 and not Ghosts(n) and tspace then
- if data[n].Tspace == 76 then
- if data[n].item == "skill1" then
- tfm.exec.displayParticle(12,x,y+30)
- tfm.exec.movePlayer(n,0,0,true,0,-100,false)
- data[n].Tspace = 0
- elseif data[n].item == "skill2" then
- if tfm.get.room.playerList[n].isFacingRight then
- tfm.exec.displayParticle(26,x+20,y)
- tfm.exec.displayParticle(26,x+30,y)
- tfm.exec.displayParticle(26,x+40,y)
- tfm.exec.displayParticle(26,x+50,y)
- tfm.exec.movePlayer(n,0,0,true,100,0,false)
- data[n].Tspace = 0
- else
- tfm.exec.displayParticle(26,x-20,y)
- tfm.exec.displayParticle(26,x-30,y)
- tfm.exec.displayParticle(26,x-40,y)
- tfm.exec.displayParticle(26,x-50,y)
- tfm.exec.movePlayer(n,0,0,true,-100,0,false)
- data[n].Tspace = 0
- end
- elseif data[n].item == "skill3" then
- if tfm.get.room.playerList[n].isFacingRight then
- tfm.exec.displayParticle(35,x+20,y,0,0,0,0)
- tfm.exec.movePlayer(n,x+65,0)
- data[n].Tspace = 0
- else
- tfm.exec.displayParticle(35,x-20,y,0,0,0,0)
- tfm.exec.movePlayer(n,x-65,0)
- data[n].Tspace = 0
- end
- end
- else
- tfm.exec.chatMessage(getTrans(n,"CHAT_MESSAGE","ERROR_KEY"),n)
- end
- end
- end
- removeshopp = function(n,id)
- for s, k in pairs({3621,3622,3623,3624,3625,3626,3627,3628,3629,3630,3631}) do
- ui.removeTextArea(9 ..id.. k,n);
- end
- end
- twf = {
- ui = {
- popups = {},
- createPopup = function(id, title,tt, text, player, buttons, closable,shopbt,textbt,shopinfo,textinfo, x, y, w, h, alpha, U)
- if tt== true then tt=" _______________________<br>"
- elseif tt== false then tt="" end
- ui.addTextArea(9 ..id.. 36 .. 21, "",player,x+-2,y+18,w+24,h+14,0x2E221B,0x2E221B,alpha,true);
- ui.addTextArea(9 ..id.. 36 .. 22, "",player,x+-1,y+19,w+22,h+12,0x986742,0x986742,alpha,true);
- ui.addTextArea(9 ..id.. 36 .. 23, "",player,x+2,y+22,w+16,h+6,0x171311,0x171311,alpha,true);
- ui.addTextArea(9 ..id.. 36 .. 24, "",player,x+3,y+23,w+14,h+4,0x091113,0x091113,alpha,true);
- ui.addTextArea(9 ..id.. 36 .. 25, "<p align='center'><font size='15' face='verdana'><V>"..title.."</p></font><R>"..tt.."<p align='left'><font size='12' /><N>\n"..text,player,x+4,y+24,w+12,h+2,0x122528,0x122528,alpha,true);
- if closable then
- ui.addTextArea(9 ..id.. 36 .. 26, "",player,x+15,y+h-20+25,w-10,15,0x5D7D90,0x5D7D90,alpha,true);
- ui.addTextArea(9 ..id.. 36 .. 27, "",player,x+15,y+h-20+27,w-10,15,0x11171C,0x11171C,alpha,true);
- ui.addTextArea(9 ..id.. 36 .. 28, "<p align='center'><font size='11'><font color='#FFFFFF'><a href='event:closeTWFPopup_".. 9 ..id.. 36 .."'>"..getTrans(player,"TEXT_AREA","CLASE").."</a>", player,x+15,y+h-20+26,w-10,15,0x3C5064,0x3C5064,alpha,true);
- end;
- if shopbt then
- if shopinfo==1 then
- ui.addTextArea(9 ..id.. 36 .. 26, "",player,x+15,y+h-20+25,w-43,15,0x5D7D90,0x5D7D90,alpha,true);
- ui.addTextArea(9 ..id.. 36 .. 27, "",player,x+15,y+h-20+27,w-43,15,0x11171C,0x11171C,alpha,true);
- ui.addTextArea(9 ..id.. 36 .. 28, "<p align='center'>"..textbt.."", player,x+15,y+h-20+26,w-43,15,0x3C5064,0x3C5064,alpha,true);
- elseif shopinfo==2 then
- ui.addTextArea(9 ..id.. 36 .. 26, "",player,x+15,y+h-20+25,w-69,15,0x5D7D90,0x5D7D90,alpha,true);
- ui.addTextArea(9 ..id.. 36 .. 27, "",player,x+15,y+h-20+27,w-69,15,0x11171C,0x11171C,alpha,true);
- ui.addTextArea(9 ..id.. 36 .. 28, "<p align='center'><font size='11'><font color='#FFFFFF'><a href='event:closeTWFPopup_".. 9 ..id.. 36 .."'>"..getTrans(player,"TEXT_AREA","CLASE").."</a>", player,x+15,y+h-20+26,w-69,15,0x3C5064,0x3C5064,alpha,true);
- end end;
- if shopinfo==1 then
- ui.addTextArea(9 ..id.. 36 .. 29, "",player,x+78,y+h-20+25,w-72,15,0x5D7D90,0x5D7D90,alpha,true);
- ui.addTextArea(9 ..id.. 36 .. 30, "",player,x+78,y+h-20+27,w-72,15,0x11171C,0x11171C,alpha,true);
- ui.addTextArea(9 ..id.. 36 .. 31, "<p align='center'>"..textinfo.."", player,x+78,y+h-20+26,w-72,15,0x3C5064,0x3C5064,alpha,true);
- elseif shopinfo==2 then
- ui.addTextArea(9 ..id.. 36 .. 29, "",player,x+352,y+h-20+25,43,15,0x5D7D90,0x5D7D90,alpha,true);
- ui.addTextArea(9 ..id.. 36 .. 30, "",player,x+352,y+h-20+27,43,15,0x11171C,0x11171C,alpha,true);
- ui.addTextArea(9 ..id.. 36 .. 31, "<p align='center'>"..textinfo.."", player,x+352,y+h-20+26,43,15,0x3C5064,0x3C5064,alpha,true);
- elseif shopinfo==0 then
- end;
- twf.ui.popups[tostring("9"..id.."36")] = 9 ..id.. 36; end,
- removePopup = function(id, player)
- for s, k in pairs({21,22,23,24,25,26,27,28,29,30,31}) do
- ui.removeTextArea(twf.ui.popups[id] .. k, player);
- end end,
- createLabel = function(id, text, player, x, y)
- ui.addTextArea(9 ..id.. 72 .. 22, "<font color='#000000' size='14'>"..text.."</font>", player, x - 1, y, 600, 20, nil, nil, 0.0, true);
- ui.addTextArea(9 ..id.. 72 .. 22, "<font color='#000000' size='14'>"..text.."</font>", player, x + 1, y, 600, 20, nil, nil, 0.0, true);
- ui.addTextArea(9 ..id.. 72 .. 22, "<font color='#000000' size='14'>"..text.."</font>", player, x, y - 1, 600, 20, nil, nil, 0.0, true);
- ui.addTextArea(9 ..id.. 72 .. 22, "<font color='#000000' size='14'>"..text.."</font>", player, x, y + 1, 600, 20, nil, nil, 0.0, true);
- ui.addTextArea(9 ..id.. 72 .. 21, "<font color='#ffffff' size='14'>"..text.."</font>", player, x, y, 600, 20, nil, nil, 0.0, true);
- end},
- trigger = {
- popupClose = function(popupId, playerName, callback)
- if string.sub(callback, 0, 14) == "closeTWFPopup_" then
- twf.ui.removePopup(callback:sub(15), playerName);
- for s, k in pairs({2,3,4,5,6}) do
- removeshopp(playerName,k)
- end
- ui.removeTextArea(8764524789,playerName);
- end end ;}}
- function openshop(n)
- TextArea(n,1)
- twf.ui.createPopup(1,getTrans(n,"SHOP","TITLE"),getTrans(n,"SHOP","POINTS_PLAYER"):format(data[n].PV),"",n,"",false,true,"",2,"<font color='#FFFFFF'>« 1/1 »", 210,50, 390, 250, 1, true)
- if data[n].skill1 == "false" then
- twf.ui.createPopup(2,getTrans(n,"SHOP","TITLE_SKILL_1"),false,"",n,"",false,true,"<font color='#FFFFFF'><a href='event:shop_skill1'>"..POINTS_SKILL1.."",1,"<p align='center'><font color='#FFFFFF'><font size='11'><b>?", 230,140, 90, 110, 1, true)
- elseif data[n].skill1 == "true" then
- if data[n].item == "skill1" then
- twf.ui.createPopup(2,getTrans(n,"SHOP","TITLE_SKILL_1"),false,"",n,"",false,true,getTrans(n,"SHOP","UNEQIIP_SKILL"),1,"<p align='center'><font color='#FFFFFF'><font size='11'><b>?", 230,140, 90, 110, 1, true)
- else
- twf.ui.createPopup(2,getTrans(n,"SHOP","TITLE_SKILL_1"),false,"",n,"",false,true,getTrans(n,"SHOP","EQUIP_SKILL_1"),1,"<p align='center'><font color='#FFFFFF'><font size='11'><b>?", 230,140, 90, 110, 1, true)
- end
- end
- if data[n].skill2 == "false" then
- twf.ui.createPopup(3,getTrans(n,"SHOP","TITLE_SKILL_2"),false,"",n,"",false,true,"<font color='#FFFFFF'><a href='event:shop_skill2'>"..POINTS_SKILL2.."",1,"<p align='center'><font color='#FFFFFF'><font size='11'><b>?",360,140, 90, 110, 1, true)
- elseif data[n].skill2 == "true" then
- if data[n].item == "skill2" then
- twf.ui.createPopup(3,getTrans(n,"SHOP","TITLE_SKILL_2"),false,"",n,"",false,true,getTrans(n,"SHOP","UNEQIIP_SKILL"),1,"<p align='center'><font color='#FFFFFF'><font size='11'><b>?",360,140, 90, 110, 1, true)
- else
- twf.ui.createPopup(3,getTrans(n,"SHOP","TITLE_SKILL_2"),false,"",n,"",false,true,getTrans(n,"SHOP","EQUIP_SKILL_2"),1,"<p align='center'><font color='#FFFFFF'><font size='11'><b>?",360,140, 90, 110, 1, true)
- end
- end
- if data[n].skill3 == "false" then
- twf.ui.createPopup(4,getTrans(n,"SHOP","TITLE_SKILL_3"),false,"",n,"",false,1,"<font color='#FFFFFF'><a href='event:shop_skill3'>"..POINTS_SKILL3.."",1,"<p align='center'><font color='#FFFFFF'><font size='11'><b>?",490,140, 90, 110, 1, true)
- elseif data[n].skill3 == "true" then
- if data[n].item == "skill3" then
- twf.ui.createPopup(4,getTrans(n,"SHOP","TITLE_SKILL_3"),false,"",n,"",false,true,getTrans(n,"SHOP","UNEQIIP_SKILL"),1,"<p align='center'><font color='#FFFFFF'><font size='11'><b>?",490,140, 90, 110, 1, true)
- else
- twf.ui.createPopup(4,getTrans(n,"SHOP","TITLE_SKILL_3"),false,"",n,"",false,true,getTrans(n,"SHOP","EQUIP_SKILL_3"),1,"<p align='center'><font color='#FFFFFF'><font size='11'><b>?", 490,140, 90, 110, 1, true)
- end
- end
- end
- function BuySkill(n,id,points)
- if data[n].PV >= points then
- data[n].PV=data[n].PV-points
- if id == 1 then data[n].skill1= "true"
- elseif id ==2 then data[n].skill2= "true"
- elseif id ==3 then data[n].skill3= "true"
- end
- openshop(n)
- else
- openshop(n)
- tfm.exec.chatMessage(getTrans(n,"CHAT_MESSAGE","ERROR_BUY_SKIILS"),n)
- end
- end
- function EquipSkill(n,id)
- data[n].item = "skill"..id..""
- openshop(n)
- tfm.exec.chatMessage(getTrans(n,"CHAT_MESSAGE","USE_SKILL_"..id..""),n)
- end
- function OpenProfil(ProfilName,n)
- TextArea(n,1)
- k="<ch>___________________"
- Text_profil = (getTrans(n,"PROFIL","TEXT"):gsub("<Won>",data[ProfilName].won):gsub("<Died>",data[ProfilName].kill):gsub("<King_Ghosts>",data[ProfilName].king_ghosts):gsub("<Community>",tfm.get.room.playerList[ProfilName].community))
- twf.ui.createPopup(1, "<font size='20'><b>"..ProfilName.."</b></font>",k,Text_profil,n,buttonsArray,true,false,"",0,"", 280,50, 210, 250, 1, true)
- end
- function OpenHelp(n)
- TextArea(n,1)
- if data[n].lang == "ar" then
- twf.ui.createPopup(1,getTrans(n,"HELP","TITLE"),true,"",n, buttonsArray, true,false,"",0,"", 210, 65, 352, 260, 1, true)
- ui.addTextArea(8764524789,getTrans(n,"HELP","TEXT"),n, 240, 145, 335, 180, 0x000001, nil, 0.0,true)
- else
- twf.ui.createPopup(1,getTrans(n,"HELP","TITLE"),true,getTrans(n,"HELP","TEXT"),n, buttonsArray, true,false,"",0,"", 210, 65, 352, 270, 1, true)
- end
- end
- function OpenInfo(n)
- TextArea(n,1)
- twf.ui.createPopup(1,getTrans(n,"INFO","TITLE"),true,getTrans(n,"INFO","TEXT"),n, buttonsArray, true,false,"",0,"", 210,70, 350, 190, 1, true)
- end
- function eventTextAreaCallback(textAreaId,n, callback)
- twf.trigger.popupClose(textAreaId,n, callback);
- if callback=="help" then OpenHelp(n)
- elseif callback=="info" then OpenInfo(n)
- elseif callback=="profil" then OpenProfil(n,n)
- elseif callback=="shop" then openshop(n)
- elseif callback=="openArea" then TextArea(n,2)
- elseif callback=="claseArea" then TextArea(n,1)
- elseif callback=="shop_skill1" then BuySkill(n,1,POINTS_SKILL1)
- elseif callback=="shop_skill2" then BuySkill(n,2,POINTS_SKILL2)
- elseif callback=="shop_skill3" then BuySkill(n,3,POINTS_SKILL3)
- elseif callback=="item_skill1" then EquipSkill(n,1)
- ui.addTextArea(500,"",n, 13, 17, 80, 18, 0x000001, n, 0.7,true)
- ui.addTextArea(501,"",n, 15.5, 17, data[n].Tspace, 16.5, 0x066CE4,0x066CE4, 1,true)
- ui.addTextArea(502,getTrans(n,"TEXT_AREA","CHARGER_SKILL"),n, 16, 21, 76, 16.5, nil,nil, 0,true)
- elseif callback=="item_skill2" then EquipSkill(n,2)
- ui.addTextArea(500,"",n, 13, 17, 80, 18, 0x000001, n, 0.7,true)
- ui.addTextArea(501,"",n, 15.5, 17, data[n].Tspace, 16.5, 0x066CE4,0x066CE4, 1,true)
- ui.addTextArea(502,getTrans(n,"TEXT_AREA","CHARGER_SKILL"),n, 16, 21, 76, 16.5, nil,nil, 0,true)
- elseif callback=="item_skill3" then EquipSkill(n,3)
- ui.addTextArea(500,"",n, 13, 17, 80, 18, 0x000001, n, 0.7,true)
- ui.addTextArea(501,"",n, 15.5, 17, data[n].Tspace, 16.5, 0x066CE4,0x066CE4, 1,true)
- ui.addTextArea(502,getTrans(n,"TEXT_AREA","CHARGER_SKILL"),n, 16, 21, 76, 16.5, nil,nil, 0,true)
- end
- end
- buttonsArray = "";
- function Pn(n)
- world={}
- worldd={}
- j=n:len()
- o=0
- c=1
- for i=j,1,-1 do
- o=o+1 table.insert(world,n:sub(o,o)) end
- table.insert(worldd,world[1].upper(world[1]))
- for y,p in pairs(world) do
- if c < j then
- c=c+1
- table.insert(worldd,world[c].lower(world[c]))
- end end
- return table.concat(worldd,"")
- end
- function eventChatCommand(n,c)
- local args={}
- for s in c:gmatch("%S+") do
- table.insert(args, s)
- end
- args[1]=args[1]:lower()
- if args[1] == "give" and admins[n] then
- args[2] = Pn(args[2])
- if Dataname(args[2]) then
- data[args[2]].PV=data[args[2]].PV+args[3]
- end
- elseif args[1] == "stopm" and admins[n] then
- system.exit()
- elseif args[1] == "skip" and admins[n] then
- tfm.exec.newGame(maps[math.random(#maps)]);
- elseif args[1] == "msg" and admins[n] then
- if args[2] == nil then
- ui.addPopup(1,2,"",n, 300, 166, 200, true)
- else
- ui.addPopup(1,2,"",args[2], 300, 166, 200, true)
- end
- elseif args[1] == "np" and admins[n] then
- tfm.exec.newGame(args[2]);
- end
- if args[1] == "p" then
- if args[2] == nil then
- OpenProfil(n,n)
- else
- args[2] = Pn(args[2])
- if Dataname(args[2]) then
- OpenProfil(args[2],n)
- else
- ------------------------------------------------------------chatMessage('error to the profil')--------------------------------------------------------
- end
- end
- elseif args[1] == "lang" then
- if args[2] == nil then
- tfm.exec.chatMessage(getTrans(n,"CHAT_MESSAGE","ERROR_LANG"),n)
- else
- args[2] = args[2]:lower()
- if Langs(args[2]) then
- data[n].lang=args[2]
- else
- tfm.exec.chatMessage(getTrans(n,"CHAT_MESSAGE","ERROR_LANG"),n)
- end
- end
- elseif args[1] == "shop" then
- openshop(n)
- elseif args[1] == "help" then
- OpenHelp(n)
- elseif args[1] == "info" then
- OpenInfo(n)
- end
- end
- function RandomPlayers(ttype)
- k={}
- mm=0
- mn=0
- if ttype== "PlayerNotGhost" then
- for j,p in pairs(tfm.get.room.playerList) do
- if (not Ghosts(j)) and (not p.isDead) then
- table.insert(k, j);
- mn=mn+1
- end end
- mm=math.random(1,mn)
- return table.concat(k,"",mm,mm)
- elseif ttype=="PlayerGhost" then
- for j,p in pairs(tfm.get.room.playerList) do
- if (Ghosts(j)) and (not p.isDead) then
- table.insert(k, j);
- mn=mn+1
- end end
- mm=math.random(1,mn)
- return table.concat(k,"",mm,mm)
- elseif ttype=="all" then
- for j,p in pairs(tfm.get.room.playerList) do
- if (not p.isDead) then
- table.insert(k, j);
- mn=mn+1
- end end
- mm=math.random(1,mn)
- return table.concat(k,"",mm,mm)
- end -- end ttype
- end -- end function
- function PlayerMaxScore(ttype)
- if ttype=="NamePlayerMaxScore" or "ScorePlayerMaxScore" then
- maxScore=0
- score={}
- name=""
- local x=0
- for n,p in pairs(tfm.get.room.playerList) do table.insert(score,p.score); end
- for n,p in pairs(score) do x=x+1
- if score[x] >= maxScore then maxScore = score[x] end
- end
- for n,p in pairs(tfm.get.room.playerList) do if p.score == maxScore then name = n
- end
- end
- if ttype=="Name" then
- return name
- elseif ttype=="Score" then
- return maxScore
- end -- end ttype
- end -- end ttype
- end -- end function
- function eventNewGame()
- ui.setMapName(module)
- tfm.exec.setPlayerScore(GhostKing,0)
- GhostKing=""
- stime,t,alive=10,0,0
- GhostFly,canImage= false,false
- ghosts={}
- noafk={}
- for n in pairs(tfm.get.room.playerList) do
- tfm.exec.setNameColor(n,0x8A8886)
- data[n].timee = 0
- data[n].Tspace = 76
- ui.removeTextArea(448,n);
- ui.removeTextArea(502,n);
- ui.removeTextArea(501,n);
- ui.removeTextArea(500,n);
- end
- tfm.exec.setGameTime(120)
- for name,player in pairs(tfm.get.room.playerList) do
- alive=alive+1
- end
- canGhosts,canImgGhost=true,false
- tspace=false
- end
- function setGhostKing(king)
- GhostKing=king
- id[king] = tfm.exec.addImage("157f325dcc3.png", "%"..king, -35, -50)
- table.insert(ghosts,king)
- ui.setMapName(""..module.."<G> | </G><N>The king Of Ghosts :<J> "..king)
- tfm.exec.chatMessage(getTrans(king,"CHAT_MESSAGE","SET_GHOST_KING"),king)
- tfm.exec.setNameColor(king,0x0B0B0B)
- canImgGhost,GhostFly=true,true
- tspace=true
- data[king].king_ghosts=data[king].king_ghosts+1
- end
- function setGhostPlayer(n)
- table.insert(ghosts,n)
- tfm.exec.setNameColor(n,0x8C0814)
- tfm.exec.chatMessage(getTrans(n,"CHAT_MESSAGE","SET_GHOST_PLAYER"),n)
- end
- function eventLoop(timePassed, timeLeft)
- for n in pairs(tfm.get.room.playerList) do
- if data[n].Tspace <76 then
- ui.removeTextArea(502,n);
- if Ghosts(n) then
- data[n].Tspace=data[n].Tspace+20
- else
- data[n].Tspace=data[n].Tspace+3
- end
- if data[n].Tspace >76 then
- data[n].Tspace=76
- end
- if Ghosts(n) or data[n].item~="" then
- ui.addTextArea(501,"",n, 15.5, 17,data[n].Tspace, 16.5, 0x066CE4,0x066CE4, 1,true)
- end
- end
- if data[n].Tspace == 76 then
- if tspace then
- if Ghosts(n) then
- ui.addTextArea(500,"",n, 13, 17, 80, 18, 0x000001, n, 0.7,true)
- ui.addTextArea(502,getTrans(n,"TEXT_AREA","CHARGER_SPACE"),n, 16, 21, 76, 16.5, nil,nil, 0,true)
- else
- if data[n].item~= "" then
- ui.addTextArea(500,"",n, 13, 17, 80, 18, 0x000001, n, 0.7,true)
- ui.addTextArea(502,getTrans(n,"TEXT_AREA","CHARGER_SKILL"),n, 16, 21, 76, 16.5, nil,nil, 0,true)
- end
- end
- end
- end
- end
- if alive == 0 or timeLeft < 1000 then
- nextRound();
- end
- t=t+1
- if stime>= 1 and (stime == 1 or stime == 2 or stime == 3 or stime == 4 or stime == 5 or stime == 6 or stime == 7 or stime == 8 or stime == 9 or stime == 10) then
- ui.setMapName(""..module.."<G> | </G><N>The selection of the ghosts after: <V> "..stime) end
- if stime>=-1 then stime=stime-0.5 end
- if stime==0 then
- setGhostKing(PlayerMaxScore("Name"))
- if canGhosts then
- if mice>= 5 then
- setGhostPlayer(RandomPlayers("PlayerNotGhost"))
- elseif mice> 10 then
- setGhostPlayer(RandomPlayers("PlayerNotGhost"))
- elseif mice> 15 then
- setGhostPlayer(RandomPlayers("PlayerNotGhost"))
- elseif mice> 20 then
- setGhostPlayer(RandomPlayers("PlayerNotGhost"))
- end
- for n in pairs(tfm.get.room.playerList) do if not Ghosts(n) then
- tfm.exec.giveMeep(n)
- end end
- for n in pairs(tfm.get.room.playerList) do
- if Ghosts(n) or data[n].item ~="" then
- ui.addTextArea(500,"",n, 13, 17, 80, 18, 0x000001, nil, 0.7,true)
- ui.addTextArea(501,"",n, 15.5, 17, data[n].Tspace, 16.5, 0x066CE4,0x066CE4, 1,true)
- end end
- end
- end
- end
- function eventPlayerKillByGhosts(n,nn)
- print(nn.." killed!")
- data[nn].kill=data[nn].kill+1
- data[n].PV=data[n].PV+30
- tfm.exec.chatMessage(getTrans(nn,"CHAT_MESSAGE","KILL_MOUSE"):format(n),nn)
- tfm.exec.chatMessage(getTrans(n,"CHAT_MESSAGE","KILL_MOUSE1"):format(nn),n)
- tfm.exec.displayParticle(13, tfm.get.room.playerList[nn].x, tfm.get.room.playerList[nn].y, 0, 0, 0, 5, nil)
- tfm.exec.displayParticle(13, tfm.get.room.playerList[nn].x, tfm.get.room.playerList[nn].y, 0, 0, 5, 0, nil)
- tfm.exec.displayParticle(13, tfm.get.room.playerList[nn].x, tfm.get.room.playerList[nn].y, 0, 0, 0, -5, nil)
- tfm.exec.displayParticle(13, tfm.get.room.playerList[nn].x, tfm.get.room.playerList[nn].y, 0, 0, -5, 0, nil)
- tfm.exec.killPlayer(nn)
- end
- function eventPopupAnswer(idpopup, name, answer)
- if idpopup==1 then
- tfm.exec.chatMessage(answer)
- end
- end
- function nextRound()
- tfm.exec.newGame(maps[math.random(#maps)]);
- end
- function eventPlayerDied(name)
- if not data[name].CheeseGhost then
- local i=0
- local n
- for pname,player in pairs(tfm.get.room.playerList) do
- if not player.isDead then
- i=i+1
- n=pname
- end
- end
- if i==0 then
- tfm.exec.setGameTime(8)
- elseif i==1 then
- tfm.exec.setGameTime(20)
- end
- else
- data[name].CheeseGhost=false
- end
- end
- function eventPlayerWon(n,timeElapsed, timeElapsedSinceRespawn )
- tfm.exec.chatMessage(getTrans(n,"CHAT_MESSAGE","WON_MOUSE"),n)
- data[n].won=data[n].won+1
- data[n].PV=data[n].PV+50
- data[n].timee = 0
- end
- function eventPlayerGetCheese(n)
- if Ghosts(n) then
- data[n].CheeseGhost=true
- tfm.exec.killPlayer(n)
- tfm.exec.respawnPlayer(n)
- tfm.exec.chatMessage(getTrans(n,"CHAT_MESSAGE","GHOST_CHEESE"),n)
- end
- end
- function eventPlayerLeft(name)
- players = {};
- mice=mice-1
- for p,_ in pairs(tfm.get.room.playerList) do
- table.insert(players, p);
- end
- end
- tfm.exec.newGame(maps[math.random(#maps)]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement