Advertisement
Guest User

#Tutu

a guest
Jul 26th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 30.13 KB | None | 0 0
  1. tfm.exec.chatMessage=print
  2. admins={Turkitutu=true}
  3. id={}
  4. data={}
  5. Cheese={}
  6. ghosts={}
  7. noafk={}
  8. tspace=false
  9. dataname={}
  10. GhostKing=""
  11. players={}
  12. langs={"ar","en"}
  13. RADIUS=150
  14. mice,t,tt,stime=0,0,0,10
  15. maxScore=0
  16. keys={70,37,38,39,40,90,32,0,1,2,3}
  17. stime=10
  18. POINTS_SKILL1,POINTS_SKILL2,POINTS_SKILL3=500,1500,2500
  19. POINTS_PLAYERS=500
  20.  
  21. module="<font color='#797979'>#Ghost"
  22. tfm.exec.disableAutoShaman(true);
  23. tfm.exec.disableAutoNewGame(true);
  24. maps = {6878399,7005544,7008006,7009733}
  25.  
  26. PV = {7,8,9,10,11,13}
  27. for c, i in pairs({"give","msg","np","stopm","skip"}) do system.disableChatCommandDisplay(i,true) end
  28.  
  29.  
  30. function Ghosts(n)
  31. for i,ghosts in ipairs(ghosts) do
  32. if n==ghosts then
  33. return true
  34. end
  35. end
  36. return
  37. false
  38. end
  39.  
  40. function Noafk(n)
  41. for i,noafk in ipairs(noafk) do if n==noafk then return true end end return false
  42. end
  43.  
  44. function Dataname(n)
  45. for i,dataname in ipairs(dataname) do if n==dataname then return true end end return false
  46. end
  47.  
  48. function Langs(n)
  49. for i,langs in ipairs(langs) do
  50. if n==langs then
  51. return true
  52. end
  53. end
  54. return
  55. false
  56. end
  57.  
  58. TextArea = function(n,id)
  59. if id then
  60. if id == 1 then
  61. ui.removeTextArea(446,n);
  62. ui.removeTextArea(445,n);
  63. ui.removeTextArea(444,n);
  64. ui.removeTextArea(443,n);
  65. 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)
  66. elseif id == 2 then
  67. 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)
  68. 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)
  69. 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)
  70. 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)
  71. 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)
  72. end
  73. end
  74. end
  75.  
  76. function addData(n)
  77. 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}
  78. end
  79.  
  80. function eventNewPlayer(n)
  81. mice=mice+1
  82. players = {};
  83. for n in pairs (tfm.get.room.playerList) do
  84. table.insert(players,n);
  85. for keys, k in pairs(keys) do
  86. tfm.exec.bindKeyboard(n, k, true, true)
  87. end
  88. end
  89. if not Dataname(n) then
  90. addData(n)
  91. table.insert(dataname,n)
  92. end
  93. tfm.exec.chatMessage(getTrans(n,"CHAT_MESSAGE","WELCOME"),n)
  94. TextArea(n,1)
  95. end
  96.  
  97. translation = {
  98. ar = {
  99. CHAT_MESSAGE = {
  100. 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>قم بكتابة",
  101. ERROR_BUY_SKIILS = "<r>لا تملك النقاط الكافية لشراء هذه الاداة",
  102. USE_SKILL_1 = "في وضعية الاستخدام <j>Spirit</j> تم وضع<br>لإستعمالها <j>[F]</j> اضغط",
  103. USE_SKILL_2 = "في وضعية الاستخدام <j>Speed</j> تم وضع<br>لإستعمالها <j>[F]</j> اضغط",
  104. USE_SKILL_3 = "في وضعية الاستخدام <j>Acrobat</j> تم وضع<br>لإستعمالها <j>[F]</j> اضغط",
  105. WON_MOUSE= "<VP>لقد تحصلت على 50 نقطة",
  106. KILL_MOUSE = "<R>بقتلك %s قام الشبح",
  107. KILL_MOUSE1 = "<vp>%s تحصلت على 30 نقطة بفضل نجاحك في قتل",
  108. SET_GHOST_PLAYER = "<j>!انت شبح الان<BR><vp>.قم بمنع الفأران من الفوز بواسطة زر المسافة",
  109. SET_GHOST_KING = "<j>!انت ملك الأشباح الان<BR><vp>.قم بمنع الفأران من الفوز و لا تنسى قدرتك على طيران ايضا.",
  110. GHOST_CHEESE = "<r>لا يجب على الأشباح اخذ قطع الجبن",
  111. ERROR_LANG = "<r>هذه اللغة غير متوفرة</r><br>en, ar <vp>: اللغات المتوفرة",
  112. ERROR_KEY = "<r>أنتظر حتى يمتلئ شريط الطاقة لديك",
  113.  
  114. },
  115. INFO = {
  116. TITLE = "<b><font size='20'>معلومات</font></b>",
  117. TEXT = "<br><p align='right'><font size='13'>Turkitutu<j> :بواسطة</j><br>Jalalmen - Ahmedasln<j> : بعض الأفكار</j></font><br><font size='11'></p>",
  118. },
  119. SHOP = {
  120. TITLE = "<font size='30' color='#00A2E8' face='Tahoma'><B>متجر</B>",
  121. POINTS_PLAYER = "<font size='13'><p align='center'><font face='Tahoma' color='#D8D8D8'>نقطة <font color='#00A2E8'>%s</font> لديك</font></p>",
  122. TITLE_SKILL_1 = "<b><font color='#00A2E8' face='Tahoma'>فرقعة</b>",
  123. TITLE_SKILL_2 = "<b><font color='#00A2E8' face='Tahoma'>سرعة</b>",
  124. TITLE_SKILL_3 = "<b><font color='#00A2E8' face='Tahoma'>إختراق</b>",
  125. EQUIP_SKILL_1 = "<font color='#FFFFFF'><font size='11'><a href='event:item_skill1'>إرتداء",
  126. EQUIP_SKILL_2 = "<font color='#FFFFFF'><font size='11'><a href='event:item_skill2'>إرتداء",
  127. EQUIP_SKILL_3 = "<font color='#FFFFFF'><font size='11'><a href='event:item_skill3'>إرتداء",
  128. UNEQIIP_SKILL = "<font size='10'><v>تم إرتداءه",
  129. },
  130. PROFIL = {
  131. 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>: المجتمع",
  132. },
  133. HELP = {
  134. TITLE = "<b><font size='20'>مساعدة</font></b>",
  135. 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>.من بين كل الاشباح ألذي معك ",
  136. },
  137. TEXT_AREA = {
  138. CLASE ="اغلاق النافذة",
  139. CHARGER_SPACE = "<p align='center'><font size='10'>[SPACE] اضغط",
  140. CHARGER_SKILL = "<p align='center'><font size='10'>[F] اضغط",
  141. },
  142. },
  143. en = {
  144. CHAT_MESSAGE = {
  145. 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>",
  146. ERROR_BUY_SKIILS = "<r>You don't have enough points to buy this item",
  147. USE_SKILL_1 = "<j>Spirit</j> has been added in use position<br>For use it press <j>[F]</j>",
  148. USE_SKILL_2 = "<j>Speed</j> has been added in use position<br>For use it press <j>[F]</j>",
  149. USE_SKILL_3 = "<j>Acrobat</j> has been added in use position<br>For use it press <j>[F]</j>",
  150. WON_MOUSE = "<vp>You've Got 50 Points",
  151. KILL_MOUSE = "<r>%s Has Killed You",
  152. KILL_MOUSE1 = "",
  153. SET_GHOST_PLAYER = "<j>You're a ghost now!<BR><vp>Prevent the rats from winning by pressing espace",
  154. 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.",
  155. GHOST_CHEESE = "<r>Ghost should not take pieces of cheese ",
  156. ERROR_LANG = "<r>This language is not available</r><br><vp>The Available Launguages:</vp> en, ar",
  157. ERROR_KEY = "<r>Wait until your energy bar fills up.",
  158. },
  159. INFO = {
  160. TITLE = "<b><font size='20'>Info</font></b>",
  161. 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>",
  162. },
  163. SHOP = {
  164. TITLE = "<font size='30' color='#00A2E8' face='Comic Sans MS'><B>Shop</B>",
  165. POINTS_PLAYER = "<font size='13'><p align='center'><font color='#D8D8D8'>You have <font color='#00A2E8'>%s</font> points.</font></p>",
  166. TITLE_SKILL_1 = "<b><font color='#00A2E8' face='Comic Sans MS'>Spirit</b>",
  167. TITLE_SKILL_2 = "<b><font color='#00A2E8' face='Comic Sans MS'>Speed</b>",
  168. TITLE_SKILL_3 = "<b><font color='#00A2E8' face='Comic Sans MS'>Acrobat</b>",
  169. EQUIP_SKILL_1 = "<font color='#FFFFFF'><font size='11'><a href='event:item_skill1'>Equip",
  170. EQUIP_SKILL_2 = "<font color='#FFFFFF'><font size='11'><a href='event:item_skill2'>Equip",
  171. EQUIP_SKILL_3 = "<font color='#FFFFFF'><font size='11'><a href='event:item_skill3'>Equip",
  172. UNEQIIP_SKILL = "<font size='10'><v>Unequip",
  173. },
  174. PROFIL = {
  175. 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>" ,
  176. },
  177. HELP = {
  178. TITLE = "<b><font size='20'>Help</font></b>",
  179. 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.",
  180. },
  181. TEXT_AREA = {
  182. CLASE ="Close",
  183. CHARGER_SPACE = "<p align='center'><font size='10'>press [SPACE]",
  184. CHARGER_SKILL = "<p align='center'><font size='10'>press [F]",
  185. },
  186. },
  187. }
  188.  
  189. for n,player in pairs(tfm.get.room.playerList) do
  190. mice=mice+1
  191. addData(n)
  192. TextArea(n,1)
  193. table.insert(dataname,n)
  194. table.insert(players, n);
  195. for keys, k in pairs(keys) do
  196. tfm.exec.bindKeyboard(n, k, true, true)
  197. end
  198. end
  199.  
  200. getTrans = function(n,id1,id2)
  201. for n in pairs (tfm.get.room.playerList) do
  202. if translation[data[n].lang] then
  203. return translation[data[n].lang][id1][id2]
  204. else
  205. return translation["en"][id1][id2]
  206. end
  207. end
  208. end
  209.  
  210. function eventKeyboard(n, key, down, x, y)
  211. if (key==0 or key== 1 or key== 2 or key== 3) then table.insert(noafk,n) end
  212. if key == 1 then
  213. if n==GhostKing and GhostFly then
  214. tfm.exec.movePlayer(n,0,0,false,0,-30,false)
  215. end
  216.  
  217. elseif key == 0 then
  218. if canImgGhost and n==GhostKing then
  219. if id[n] ~= nil then
  220. tfm.exec.removeImage(id[n])
  221. id[n] = nil
  222. end
  223. id[n] = tfm.exec.addImage("157f3259f31.png", "%"..n, -35, -50) -- ←
  224. end
  225.  
  226. elseif key == 2 then
  227. if canImgGhost and n==GhostKing then
  228. if id[n] ~= nil then
  229. tfm.exec.removeImage(id[n])
  230. id[n] = nil
  231. end
  232. id[n] = tfm.exec.addImage("157f325dcc3.png", "%"..n, -35, -50) -- →
  233. end
  234.  
  235. elseif key == 90 then
  236. if n==GhostKing and GhostFly then
  237. tfm.exec.movePlayer(n,0,0,false,0,-40,false)
  238. end
  239.  
  240. elseif key == 32 then
  241. if Ghosts(n) then
  242. if data[n].Tspace == 76 then
  243. data[n].Tspace = 0
  244. for nn,p in pairs(tfm.get.room.playerList) do
  245. 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
  246. eventPlayerKillByGhosts(n,nn)
  247. end
  248. end
  249. else
  250. tfm.exec.chatMessage(getTrans(n,"CHAT_MESSAGE","ERROR_KEY"),n)
  251. end
  252. end
  253.  
  254. elseif key == 70 and not Ghosts(n) and tspace then
  255. if data[n].Tspace == 76 then
  256. if data[n].item == "skill1" then
  257. tfm.exec.displayParticle(12,x,y+30)
  258. tfm.exec.movePlayer(n,0,0,true,0,-100,false)
  259. data[n].Tspace = 0
  260. elseif data[n].item == "skill2" then
  261. if tfm.get.room.playerList[n].isFacingRight then
  262. tfm.exec.displayParticle(26,x+20,y)
  263. tfm.exec.displayParticle(26,x+30,y)
  264. tfm.exec.displayParticle(26,x+40,y)
  265. tfm.exec.displayParticle(26,x+50,y)
  266. tfm.exec.movePlayer(n,0,0,true,100,0,false)
  267. data[n].Tspace = 0
  268. else
  269. tfm.exec.displayParticle(26,x-20,y)
  270. tfm.exec.displayParticle(26,x-30,y)
  271. tfm.exec.displayParticle(26,x-40,y)
  272. tfm.exec.displayParticle(26,x-50,y)
  273. tfm.exec.movePlayer(n,0,0,true,-100,0,false)
  274. data[n].Tspace = 0
  275. end
  276. elseif data[n].item == "skill3" then
  277. if tfm.get.room.playerList[n].isFacingRight then
  278. tfm.exec.displayParticle(35,x+20,y,0,0,0,0)
  279. tfm.exec.movePlayer(n,x+65,0)
  280. data[n].Tspace = 0
  281. else
  282. tfm.exec.displayParticle(35,x-20,y,0,0,0,0)
  283. tfm.exec.movePlayer(n,x-65,0)
  284. data[n].Tspace = 0
  285. end
  286. end
  287. else
  288. tfm.exec.chatMessage(getTrans(n,"CHAT_MESSAGE","ERROR_KEY"),n)
  289. end
  290. end
  291. end
  292.  
  293. removeshopp = function(n,id)
  294. for s, k in pairs({3621,3622,3623,3624,3625,3626,3627,3628,3629,3630,3631}) do
  295. ui.removeTextArea(9 ..id.. k,n);
  296. end
  297. end
  298. twf = {
  299. ui = {
  300. popups = {},
  301. createPopup = function(id, title,tt, text, player, buttons, closable,shopbt,textbt,shopinfo,textinfo, x, y, w, h, alpha, U)
  302. if tt== true then tt=" _______________________<br>"
  303. elseif tt== false then tt="" end
  304. ui.addTextArea(9 ..id.. 36 .. 21, "",player,x+-2,y+18,w+24,h+14,0x2E221B,0x2E221B,alpha,true);
  305. ui.addTextArea(9 ..id.. 36 .. 22, "",player,x+-1,y+19,w+22,h+12,0x986742,0x986742,alpha,true);
  306. ui.addTextArea(9 ..id.. 36 .. 23, "",player,x+2,y+22,w+16,h+6,0x171311,0x171311,alpha,true);
  307. ui.addTextArea(9 ..id.. 36 .. 24, "",player,x+3,y+23,w+14,h+4,0x091113,0x091113,alpha,true);
  308. 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);
  309.  
  310. if closable then
  311. ui.addTextArea(9 ..id.. 36 .. 26, "",player,x+15,y+h-20+25,w-10,15,0x5D7D90,0x5D7D90,alpha,true);
  312. ui.addTextArea(9 ..id.. 36 .. 27, "",player,x+15,y+h-20+27,w-10,15,0x11171C,0x11171C,alpha,true);
  313. 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);
  314. end;
  315. if shopbt then
  316. if shopinfo==1 then
  317. ui.addTextArea(9 ..id.. 36 .. 26, "",player,x+15,y+h-20+25,w-43,15,0x5D7D90,0x5D7D90,alpha,true);
  318. ui.addTextArea(9 ..id.. 36 .. 27, "",player,x+15,y+h-20+27,w-43,15,0x11171C,0x11171C,alpha,true);
  319. ui.addTextArea(9 ..id.. 36 .. 28, "<p align='center'>"..textbt.."", player,x+15,y+h-20+26,w-43,15,0x3C5064,0x3C5064,alpha,true);
  320. elseif shopinfo==2 then
  321. ui.addTextArea(9 ..id.. 36 .. 26, "",player,x+15,y+h-20+25,w-69,15,0x5D7D90,0x5D7D90,alpha,true);
  322. ui.addTextArea(9 ..id.. 36 .. 27, "",player,x+15,y+h-20+27,w-69,15,0x11171C,0x11171C,alpha,true);
  323. 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);
  324. end end;
  325. if shopinfo==1 then
  326. ui.addTextArea(9 ..id.. 36 .. 29, "",player,x+78,y+h-20+25,w-72,15,0x5D7D90,0x5D7D90,alpha,true);
  327. ui.addTextArea(9 ..id.. 36 .. 30, "",player,x+78,y+h-20+27,w-72,15,0x11171C,0x11171C,alpha,true);
  328. ui.addTextArea(9 ..id.. 36 .. 31, "<p align='center'>"..textinfo.."", player,x+78,y+h-20+26,w-72,15,0x3C5064,0x3C5064,alpha,true);
  329. elseif shopinfo==2 then
  330. ui.addTextArea(9 ..id.. 36 .. 29, "",player,x+352,y+h-20+25,43,15,0x5D7D90,0x5D7D90,alpha,true);
  331. ui.addTextArea(9 ..id.. 36 .. 30, "",player,x+352,y+h-20+27,43,15,0x11171C,0x11171C,alpha,true);
  332. ui.addTextArea(9 ..id.. 36 .. 31, "<p align='center'>"..textinfo.."", player,x+352,y+h-20+26,43,15,0x3C5064,0x3C5064,alpha,true);
  333. elseif shopinfo==0 then
  334. end;
  335. twf.ui.popups[tostring("9"..id.."36")] = 9 ..id.. 36; end,
  336. removePopup = function(id, player)
  337. for s, k in pairs({21,22,23,24,25,26,27,28,29,30,31}) do
  338. ui.removeTextArea(twf.ui.popups[id] .. k, player);
  339. end end,
  340. createLabel = function(id, text, player, x, y)
  341. ui.addTextArea(9 ..id.. 72 .. 22, "<font color='#000000' size='14'>"..text.."</font>", player, x - 1, y, 600, 20, nil, nil, 0.0, true);
  342. ui.addTextArea(9 ..id.. 72 .. 22, "<font color='#000000' size='14'>"..text.."</font>", player, x + 1, y, 600, 20, nil, nil, 0.0, true);
  343. ui.addTextArea(9 ..id.. 72 .. 22, "<font color='#000000' size='14'>"..text.."</font>", player, x, y - 1, 600, 20, nil, nil, 0.0, true);
  344. ui.addTextArea(9 ..id.. 72 .. 22, "<font color='#000000' size='14'>"..text.."</font>", player, x, y + 1, 600, 20, nil, nil, 0.0, true);
  345. ui.addTextArea(9 ..id.. 72 .. 21, "<font color='#ffffff' size='14'>"..text.."</font>", player, x, y, 600, 20, nil, nil, 0.0, true);
  346. end},
  347. trigger = {
  348. popupClose = function(popupId, playerName, callback)
  349. if string.sub(callback, 0, 14) == "closeTWFPopup_" then
  350. twf.ui.removePopup(callback:sub(15), playerName);
  351. for s, k in pairs({2,3,4,5,6}) do
  352. removeshopp(playerName,k)
  353. end
  354. ui.removeTextArea(8764524789,playerName);
  355. end end ;}}
  356.  
  357. function openshop(n)
  358. TextArea(n,1)
  359. 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)
  360. if data[n].skill1 == "false" then
  361. 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)
  362. elseif data[n].skill1 == "true" then
  363. if data[n].item == "skill1" then
  364. 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)
  365. else
  366. 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)
  367. end
  368. end
  369. if data[n].skill2 == "false" then
  370. 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)
  371. elseif data[n].skill2 == "true" then
  372. if data[n].item == "skill2" then
  373. 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)
  374. else
  375. 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)
  376. end
  377. end
  378. if data[n].skill3 == "false" then
  379. 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)
  380. elseif data[n].skill3 == "true" then
  381. if data[n].item == "skill3" then
  382. 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)
  383. else
  384. 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)
  385. end
  386. end
  387. end
  388.  
  389. function BuySkill(n,id,points)
  390. if data[n].PV >= points then
  391. data[n].PV=data[n].PV-points
  392. if id == 1 then data[n].skill1= "true"
  393. elseif id ==2 then data[n].skill2= "true"
  394. elseif id ==3 then data[n].skill3= "true"
  395. end
  396. openshop(n)
  397. else
  398. openshop(n)
  399. tfm.exec.chatMessage(getTrans(n,"CHAT_MESSAGE","ERROR_BUY_SKIILS"),n)
  400. end
  401. end
  402.  
  403. function EquipSkill(n,id)
  404. data[n].item = "skill"..id..""
  405. openshop(n)
  406. tfm.exec.chatMessage(getTrans(n,"CHAT_MESSAGE","USE_SKILL_"..id..""),n)
  407. end
  408.  
  409. function OpenProfil(ProfilName,n)
  410. TextArea(n,1)
  411. k="<ch>___________________"
  412. 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))
  413. 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)
  414. end
  415.  
  416. function OpenHelp(n)
  417. TextArea(n,1)
  418. if data[n].lang == "ar" then
  419. twf.ui.createPopup(1,getTrans(n,"HELP","TITLE"),true,"",n, buttonsArray, true,false,"",0,"", 210, 65, 352, 260, 1, true)
  420. ui.addTextArea(8764524789,getTrans(n,"HELP","TEXT"),n, 240, 145, 335, 180, 0x000001, nil, 0.0,true)
  421. else
  422. twf.ui.createPopup(1,getTrans(n,"HELP","TITLE"),true,getTrans(n,"HELP","TEXT"),n, buttonsArray, true,false,"",0,"", 210, 65, 352, 270, 1, true)
  423. end
  424. end
  425.  
  426. function OpenInfo(n)
  427. TextArea(n,1)
  428. twf.ui.createPopup(1,getTrans(n,"INFO","TITLE"),true,getTrans(n,"INFO","TEXT"),n, buttonsArray, true,false,"",0,"", 210,70, 350, 190, 1, true)
  429. end
  430.  
  431. function eventTextAreaCallback(textAreaId,n, callback)
  432. twf.trigger.popupClose(textAreaId,n, callback);
  433. if callback=="help" then OpenHelp(n)
  434. elseif callback=="info" then OpenInfo(n)
  435. elseif callback=="profil" then OpenProfil(n,n)
  436. elseif callback=="shop" then openshop(n)
  437. elseif callback=="openArea" then TextArea(n,2)
  438. elseif callback=="claseArea" then TextArea(n,1)
  439. elseif callback=="shop_skill1" then BuySkill(n,1,POINTS_SKILL1)
  440. elseif callback=="shop_skill2" then BuySkill(n,2,POINTS_SKILL2)
  441. elseif callback=="shop_skill3" then BuySkill(n,3,POINTS_SKILL3)
  442. elseif callback=="item_skill1" then EquipSkill(n,1)
  443. ui.addTextArea(500,"",n, 13, 17, 80, 18, 0x000001, n, 0.7,true)
  444. ui.addTextArea(501,"",n, 15.5, 17, data[n].Tspace, 16.5, 0x066CE4,0x066CE4, 1,true)
  445. ui.addTextArea(502,getTrans(n,"TEXT_AREA","CHARGER_SKILL"),n, 16, 21, 76, 16.5, nil,nil, 0,true)
  446. elseif callback=="item_skill2" then EquipSkill(n,2)
  447. ui.addTextArea(500,"",n, 13, 17, 80, 18, 0x000001, n, 0.7,true)
  448. ui.addTextArea(501,"",n, 15.5, 17, data[n].Tspace, 16.5, 0x066CE4,0x066CE4, 1,true)
  449. ui.addTextArea(502,getTrans(n,"TEXT_AREA","CHARGER_SKILL"),n, 16, 21, 76, 16.5, nil,nil, 0,true)
  450. elseif callback=="item_skill3" then EquipSkill(n,3)
  451. ui.addTextArea(500,"",n, 13, 17, 80, 18, 0x000001, n, 0.7,true)
  452. ui.addTextArea(501,"",n, 15.5, 17, data[n].Tspace, 16.5, 0x066CE4,0x066CE4, 1,true)
  453. ui.addTextArea(502,getTrans(n,"TEXT_AREA","CHARGER_SKILL"),n, 16, 21, 76, 16.5, nil,nil, 0,true)
  454. end
  455. end
  456.  
  457. buttonsArray = "";
  458.  
  459. function Pn(n)
  460. world={}
  461. worldd={}
  462. j=n:len()
  463. o=0
  464. c=1
  465. for i=j,1,-1 do
  466. o=o+1 table.insert(world,n:sub(o,o)) end
  467. table.insert(worldd,world[1].upper(world[1]))
  468. for y,p in pairs(world) do
  469. if c < j then
  470. c=c+1
  471. table.insert(worldd,world[c].lower(world[c]))
  472. end end
  473. return table.concat(worldd,"")
  474. end
  475.  
  476. function eventChatCommand(n,c)
  477. local args={}
  478. for s in c:gmatch("%S+") do
  479. table.insert(args, s)
  480. end
  481. args[1]=args[1]:lower()
  482. if args[1] == "give" and admins[n] then
  483. args[2] = Pn(args[2])
  484. if Dataname(args[2]) then
  485. data[args[2]].PV=data[args[2]].PV+args[3]
  486. end
  487. elseif args[1] == "stopm" and admins[n] then
  488. system.exit()
  489. elseif args[1] == "skip" and admins[n] then
  490. tfm.exec.newGame(maps[math.random(#maps)]);
  491. elseif args[1] == "msg" and admins[n] then
  492. if args[2] == nil then
  493. ui.addPopup(1,2,"",n, 300, 166, 200, true)
  494. else
  495. ui.addPopup(1,2,"",args[2], 300, 166, 200, true)
  496. end
  497. elseif args[1] == "np" and admins[n] then
  498. tfm.exec.newGame(args[2]);
  499. end
  500. if args[1] == "p" then
  501. if args[2] == nil then
  502. OpenProfil(n,n)
  503. else
  504. args[2] = Pn(args[2])
  505. if Dataname(args[2]) then
  506. OpenProfil(args[2],n)
  507. else
  508. ------------------------------------------------------------chatMessage('error to the profil')--------------------------------------------------------
  509. end
  510. end
  511. elseif args[1] == "lang" then
  512. if args[2] == nil then
  513. tfm.exec.chatMessage(getTrans(n,"CHAT_MESSAGE","ERROR_LANG"),n)
  514. else
  515. args[2] = args[2]:lower()
  516. if Langs(args[2]) then
  517. data[n].lang=args[2]
  518. else
  519. tfm.exec.chatMessage(getTrans(n,"CHAT_MESSAGE","ERROR_LANG"),n)
  520. end
  521. end
  522. elseif args[1] == "shop" then
  523. openshop(n)
  524. elseif args[1] == "help" then
  525. OpenHelp(n)
  526. elseif args[1] == "info" then
  527. OpenInfo(n)
  528. end
  529. end
  530.  
  531.  
  532. function RandomPlayers(ttype)
  533. k={}
  534. mm=0
  535. mn=0
  536. if ttype== "PlayerNotGhost" then
  537. for j,p in pairs(tfm.get.room.playerList) do
  538. if (not Ghosts(j)) and (not p.isDead) then
  539. table.insert(k, j);
  540. mn=mn+1
  541. end end
  542. mm=math.random(1,mn)
  543. return table.concat(k,"",mm,mm)
  544. elseif ttype=="PlayerGhost" then
  545. for j,p in pairs(tfm.get.room.playerList) do
  546. if (Ghosts(j)) and (not p.isDead) then
  547. table.insert(k, j);
  548. mn=mn+1
  549. end end
  550. mm=math.random(1,mn)
  551. return table.concat(k,"",mm,mm)
  552. elseif ttype=="all" then
  553. for j,p in pairs(tfm.get.room.playerList) do
  554. if (not p.isDead) then
  555. table.insert(k, j);
  556. mn=mn+1
  557. end end
  558. mm=math.random(1,mn)
  559. return table.concat(k,"",mm,mm)
  560. end -- end ttype
  561. end -- end function
  562.  
  563. function PlayerMaxScore(ttype)
  564. if ttype=="NamePlayerMaxScore" or "ScorePlayerMaxScore" then
  565. maxScore=0
  566. score={}
  567. name=""
  568. local x=0
  569. for n,p in pairs(tfm.get.room.playerList) do table.insert(score,p.score); end
  570. for n,p in pairs(score) do x=x+1
  571. if score[x] >= maxScore then maxScore = score[x] end
  572. end
  573. for n,p in pairs(tfm.get.room.playerList) do if p.score == maxScore then name = n
  574. end
  575. end
  576. if ttype=="Name" then
  577. return name
  578. elseif ttype=="Score" then
  579. return maxScore
  580. end -- end ttype
  581. end -- end ttype
  582. end -- end function
  583.  
  584.  
  585. function eventNewGame()
  586. ui.setMapName(module)
  587. tfm.exec.setPlayerScore(GhostKing,0)
  588. GhostKing=""
  589. stime,t,alive=10,0,0
  590. GhostFly,canImage= false,false
  591. ghosts={}
  592. noafk={}
  593. for n in pairs(tfm.get.room.playerList) do
  594. tfm.exec.setNameColor(n,0x8A8886)
  595. data[n].timee = 0
  596. data[n].Tspace = 76
  597. ui.removeTextArea(448,n);
  598. ui.removeTextArea(502,n);
  599. ui.removeTextArea(501,n);
  600. ui.removeTextArea(500,n);
  601. end
  602. tfm.exec.setGameTime(120)
  603. for name,player in pairs(tfm.get.room.playerList) do
  604. alive=alive+1
  605. end
  606. canGhosts,canImgGhost=true,false
  607. tspace=false
  608. end
  609.  
  610. function setGhostKing(king)
  611. GhostKing=king
  612. id[king] = tfm.exec.addImage("157f325dcc3.png", "%"..king, -35, -50)
  613. table.insert(ghosts,king)
  614. ui.setMapName(""..module.."<G> | </G><N>The king Of Ghosts :<J> "..king)
  615. tfm.exec.chatMessage(getTrans(king,"CHAT_MESSAGE","SET_GHOST_KING"),king)
  616. tfm.exec.setNameColor(king,0x0B0B0B)
  617. canImgGhost,GhostFly=true,true
  618. tspace=true
  619. data[king].king_ghosts=data[king].king_ghosts+1
  620. end
  621.  
  622. function setGhostPlayer(n)
  623. table.insert(ghosts,n)
  624. tfm.exec.setNameColor(n,0x8C0814)
  625. tfm.exec.chatMessage(getTrans(n,"CHAT_MESSAGE","SET_GHOST_PLAYER"),n)
  626. end
  627.  
  628. function eventLoop(timePassed, timeLeft)
  629. for n in pairs(tfm.get.room.playerList) do
  630. if data[n].Tspace <76 then
  631. ui.removeTextArea(502,n);
  632. if Ghosts(n) then
  633. data[n].Tspace=data[n].Tspace+20
  634. else
  635. data[n].Tspace=data[n].Tspace+3
  636. end
  637. if data[n].Tspace >76 then
  638. data[n].Tspace=76
  639. end
  640. if Ghosts(n) or data[n].item~="" then
  641. ui.addTextArea(501,"",n, 15.5, 17,data[n].Tspace, 16.5, 0x066CE4,0x066CE4, 1,true)
  642. end
  643. end
  644. if data[n].Tspace == 76 then
  645. if tspace then
  646. if Ghosts(n) then
  647. ui.addTextArea(500,"",n, 13, 17, 80, 18, 0x000001, n, 0.7,true)
  648. ui.addTextArea(502,getTrans(n,"TEXT_AREA","CHARGER_SPACE"),n, 16, 21, 76, 16.5, nil,nil, 0,true)
  649. else
  650. if data[n].item~= "" then
  651. ui.addTextArea(500,"",n, 13, 17, 80, 18, 0x000001, n, 0.7,true)
  652. ui.addTextArea(502,getTrans(n,"TEXT_AREA","CHARGER_SKILL"),n, 16, 21, 76, 16.5, nil,nil, 0,true)
  653. end
  654. end
  655. end
  656. end
  657. end
  658.  
  659. if alive == 0 or timeLeft < 1000 then
  660. nextRound();
  661. end
  662. t=t+1
  663. 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
  664. ui.setMapName(""..module.."<G> | </G><N>The selection of the ghosts after: <V> "..stime) end
  665. if stime>=-1 then stime=stime-0.5 end
  666. if stime==0 then
  667. setGhostKing(PlayerMaxScore("Name"))
  668. if canGhosts then
  669. if mice>= 5 then
  670. setGhostPlayer(RandomPlayers("PlayerNotGhost"))
  671. elseif mice> 10 then
  672. setGhostPlayer(RandomPlayers("PlayerNotGhost"))
  673. elseif mice> 15 then
  674. setGhostPlayer(RandomPlayers("PlayerNotGhost"))
  675. elseif mice> 20 then
  676. setGhostPlayer(RandomPlayers("PlayerNotGhost"))
  677. end
  678. for n in pairs(tfm.get.room.playerList) do if not Ghosts(n) then
  679. tfm.exec.giveMeep(n)
  680. end end
  681. for n in pairs(tfm.get.room.playerList) do
  682. if Ghosts(n) or data[n].item ~="" then
  683. ui.addTextArea(500,"",n, 13, 17, 80, 18, 0x000001, nil, 0.7,true)
  684. ui.addTextArea(501,"",n, 15.5, 17, data[n].Tspace, 16.5, 0x066CE4,0x066CE4, 1,true)
  685. end end
  686. end
  687. end
  688. end
  689.  
  690. function eventPlayerKillByGhosts(n,nn)
  691. print(nn.." killed!")
  692. data[nn].kill=data[nn].kill+1
  693. data[n].PV=data[n].PV+30
  694. tfm.exec.chatMessage(getTrans(nn,"CHAT_MESSAGE","KILL_MOUSE"):format(n),nn)
  695. tfm.exec.chatMessage(getTrans(n,"CHAT_MESSAGE","KILL_MOUSE1"):format(nn),n)
  696. tfm.exec.displayParticle(13, tfm.get.room.playerList[nn].x, tfm.get.room.playerList[nn].y, 0, 0, 0, 5, nil)
  697. tfm.exec.displayParticle(13, tfm.get.room.playerList[nn].x, tfm.get.room.playerList[nn].y, 0, 0, 5, 0, nil)
  698. tfm.exec.displayParticle(13, tfm.get.room.playerList[nn].x, tfm.get.room.playerList[nn].y, 0, 0, 0, -5, nil)
  699. tfm.exec.displayParticle(13, tfm.get.room.playerList[nn].x, tfm.get.room.playerList[nn].y, 0, 0, -5, 0, nil)
  700. tfm.exec.killPlayer(nn)
  701. end
  702.  
  703. function eventPopupAnswer(idpopup, name, answer)
  704. if idpopup==1 then
  705. tfm.exec.chatMessage(answer)
  706. end
  707. end
  708.  
  709. function nextRound()
  710. tfm.exec.newGame(maps[math.random(#maps)]);
  711. end
  712.  
  713. function eventPlayerDied(name)
  714. if not data[name].CheeseGhost then
  715. local i=0
  716. local n
  717. for pname,player in pairs(tfm.get.room.playerList) do
  718. if not player.isDead then
  719. i=i+1
  720. n=pname
  721. end
  722. end
  723. if i==0 then
  724. tfm.exec.setGameTime(8)
  725. elseif i==1 then
  726. tfm.exec.setGameTime(20)
  727. end
  728. else
  729. data[name].CheeseGhost=false
  730. end
  731. end
  732.  
  733. function eventPlayerWon(n,timeElapsed, timeElapsedSinceRespawn )
  734. tfm.exec.chatMessage(getTrans(n,"CHAT_MESSAGE","WON_MOUSE"),n)
  735. data[n].won=data[n].won+1
  736. data[n].PV=data[n].PV+50
  737. data[n].timee = 0
  738. end
  739.  
  740. function eventPlayerGetCheese(n)
  741. if Ghosts(n) then
  742. data[n].CheeseGhost=true
  743. tfm.exec.killPlayer(n)
  744. tfm.exec.respawnPlayer(n)
  745. tfm.exec.chatMessage(getTrans(n,"CHAT_MESSAGE","GHOST_CHEESE"),n)
  746. end
  747. end
  748.  
  749. function eventPlayerLeft(name)
  750. players = {};
  751. mice=mice-1
  752. for p,_ in pairs(tfm.get.room.playerList) do
  753. table.insert(players, p);
  754. end
  755. end
  756. tfm.exec.newGame(maps[math.random(#maps)]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement