Advertisement
mmmm123m

Untitled

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