Advertisement
Guest User

Untitled

a guest
Apr 26th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.77 KB | None | 0 0
  1. for _,v in pairs({'disableAutoScore','disableAfkDeath','disablePhysicalConsumables','disableAutoNewGame','disableDebugCommand','disableMinimalistMode','disableMortCommand','disableAutoTimeLeft','disableAutoShaman'}) do
  2. tfm.exec[v](true)
  3. end
  4.  
  5. maps={"@7189349","@7205073","@7092301"}
  6. data={}
  7. p={}
  8. objects={}
  9. toDespawn={}
  10. alive=0
  11.  
  12. text={}
  13. lang={}
  14. lang.ar={welcome="<vp>#Treasure اهلا بك في<br><rose>!profile او P لفتح الملف الشخصي اضغط",objective="<j>الهدف : قُم بالبحث عن الجبن المختبئ بين الزينة بالظغط على زر النزول لمدة 3 ثواني.",nocheese= "<r>لا يوجد قطعة جبن هنا",cheese="<vp>لقد وجدتَ الجبن ياي",wrongplace="<r>أنت في المكان الخطأ",cheeseplace="<v>لقد تغير مكان الجبن",trap="<r>لقد وقعت في فخ :("}
  15. lang.en={welcome="<vp>Welcome to #Treasure<br><rose> to show profile press P or Type !profile",objective="<j>Objective: Look for the cheese hidden between the decorations by pressing the down button for 3 seconds",nocheese= "<r>There is no cheese here",cheese="<vp>You found cheese yay",wrongplace="<r>You are in the wrong place",cheeseplace="<v>The place of the cheese has changed",trap=""}
  16. lang.ro={welcome="<vp>Bine ați venit pe #treasure.<br><rose>Pentru a vedea profilul apăsați tasta P sau scrieți în bara de chat !profile",objective="<j>Obiectivul vostru: găsiți brânza ascunsă sub decorațiuni și colectați-o ținând apăsată săgeata jos pentru 3 secunde",nocheese= "<r>Nu e nicio brânză aici",cheese="<vp>Tocmai ai găsit o brânză! Yay!",wrongplace="<r>Ești într-un loc greșit!",cheeseplace="<v>Locația brânzei a fost schimbată.",trap=""}
  17. lang.pl={welcome="<vp>Witaj w #Treasure<br><rose> Aby pokazać profil wćiśnij P lub !profile",objective="<j>Cel: Poszukaj seru ukrytego między dekoracjami, naciskając przycisk w dół przez 3 sekundy",nocheese= "<r>Tu nie ma sera",cheese="<vp>Znalazłeś nowy ser!",wrongplace="<r>Jesteś w złej powierzchni",cheeseplace="<v>Miejsce sera uległo zmianie",trap=""}
  18.  
  19. function ui.timerImage(img,x,y,n,pet,time)
  20. time=time or 5
  21. axis=axis or {100,100}
  22. local img=tfm.exec.addImage(img..".png","_1",x,y,n)
  23. system.newTimer(function()
  24. tfm.exec.removeImage(img,n)
  25. if pet then
  26. DP(0,x,y,n)
  27. for pp=1,#objects do
  28. if x-35==objects[pp].x and y-55==objects[pp].y then
  29. if objects[pp].id==cheeseId then
  30. tfm.exec.giveCheese(n)
  31. tfm.exec.playerVictory(n)
  32. for n,p in pairs (tfm.get.room.playerList) do
  33. tfm.exec.chatMessage(text[n].cheeseplace, n)
  34. end
  35. data[n].keys[3].time=0
  36. cheeseId=math.random(1,#objects)
  37. a[n]=1
  38. else
  39. print("There's No Cheese Here.")
  40. end
  41. end
  42. end
  43. end
  44. end,time*1000,false)
  45. end
  46.  
  47. function setLang(n)
  48. text[n]=lang[tfm.get.room.playerList[n].community] or lang.en
  49. end
  50.  
  51. function Data(n)
  52. data[n]={time=os.time(),keys={[3]={down=false,time=0}},key=0,food=0,food2=0,lists=0,skills={{false},{false,6,time=os.time()},{false,6,time=os.time()},{false,4,time=os.time()},{false,3,time=os.time()},{true,1}}}
  53. end
  54.  
  55. function DP(id,x,y,n)
  56. for i=1, 5 do
  57. tfm.exec.displayParticle(id,x,y,(math.random(30)-15)/5, (math.random(10)-5)/5,0,0,n)
  58. end
  59. end
  60.  
  61. function DieWon()
  62. local i=0
  63. local n
  64. for pn,p in pairs(tfm.get.room.playerList) do
  65. if not p.isDead then
  66. i=i+1
  67. n=pn
  68. end
  69. end
  70. if i==0 then
  71. tfm.exec.newGame(maps[math.random(#maps)])
  72. end
  73. end
  74.  
  75. function eventNewPlayer(n)
  76. setLang(n)
  77. if not data[n] then
  78. Data(n)
  79. end
  80. p[n]={right=false, left=false}
  81. for k=0,100 do
  82. system.bindKeyboard(n, k, true, true)
  83. end
  84. system.bindMouse(n,true, true)
  85. tfm.exec.chatMessage(text[n].welcome, n)
  86. tfm.exec.chatMessage(text[n].objective,n)
  87. end
  88. table.foreach(tfm.get.room.playerList,eventNewPlayer)
  89.  
  90. function eventMouse(n, x, y)
  91. if data[n].skills[5][1] and data[n].skills[5][2] > 0 and data[n].skills[5].time < os.time()-3000 then
  92. data[n].skills[5].time=os.time()
  93. data[n].skills[5][2]=data[n].skills[5][2]-1
  94. tfm.exec.movePlayer(n, x, y, false, 0, 0,false)
  95. end
  96. end
  97.  
  98. function eventNewGame()
  99. alive=0
  100. tfm.exec.setGameTime(123)
  101. for n,p in pairs(tfm.get.room.playerList) do
  102. alive=alive+1
  103. data[n].skills[2][2]=6
  104. data[n].skills[3][2]=6
  105. data[n].skills[4][2]=4
  106. data[n].skills[5][2]=3
  107. data[n].skills[6][2]=1
  108. if data[n].skills[1][1] then
  109. tfm.exec.giveMeep(n)
  110. end
  111. for i=2,5 do
  112. data[n].skills[i].time=os.time()
  113. end
  114. end
  115. if tfm.get.room.currentMap~="@0" then
  116. xml=tfm.get.room.xmlMapInfo.xml
  117. end
  118. objects = {}
  119. local i=0
  120. for ob in string.gmatch(xml, '<D><P .-/></D>') do
  121. for object in string.gmatch(ob, '<P .-/>') do
  122. i=i+1
  123. table.insert(objects,{id=i,x=tonumber(object:match('X="(.-)"')), y=tonumber(object:match('Y="(.-)"'))})
  124. end
  125. end
  126. cheeseId=math.random(1,#objects)
  127. for i=1,#objects do
  128. if objects[i].id==cheeseId then
  129. ui.addTextArea(0,"<p align='center'>Cheese is here","Bodykudo#0000", objects[i].x-50, objects[i].y-30,100,20, nil, nil, 0.7, false)
  130. end
  131. end
  132. end
  133.  
  134. function openProfile(n,p)
  135. ui.addTextArea(1,"<a href='event:close'><b><font color='#926944'><p align='center'>X",n,520,90,15,35,0xFED69A,0x926944,1,true)
  136. ui.addTextArea(2,"",n,225,112,310,160,0x926944,0x926944,1,true)
  137. ui.addTextArea(3,"",n,230,117,300,150,0xFED69A,0xFED69A,1,true)
  138. ui.addTextArea(4,"<b><font size='20' color='#926944'><p align='center'>"..p,n,280,90,200,30,0xFED69A,0x926944,1,true)
  139. end
  140.  
  141. function eventKeyboard(n, k, d, x, y)
  142. data[n].key=k
  143. if k==2 then
  144. p[n].right=true
  145. p[n].left=false
  146. elseif k==0 then
  147. p[n].right=false
  148. p[n].left=true
  149. elseif k==80 then
  150. local id=objects[math.random(#objects)].id
  151. local x=objects[id].x
  152. local y=objects[id].y
  153. ui.timerImage("1622a0ff93a",x-35,y-55,n,true,5)
  154. elseif k==3 then
  155. if d then
  156. data[n].keys[3].down=d
  157. data[n].keys[3].time=os.time()
  158. system.bindKeyboard(n, k, false, true)
  159. else
  160. data[n].keys[3].down=d
  161. system.bindKeyboard(n, k, true, true)
  162. data[n].keys[3].time=0
  163. end
  164. elseif k==1 and data[n].skills[3][1] and data[n].skills[3][2] > 0 and data[n].skills[3].time < os.time()-3000 then
  165. data[n].skills[3].time=os.time()
  166. tfm.exec.movePlayer(n, 0, 0, false, 0, -100,false)
  167. for i = 0,15,.25 do
  168. tfm.exec.displayParticle(({2,11})[((i*4)%2)+1],x+math.sin(i*1.1)*20,y+40+-i*3.5)
  169. end
  170. data[n].skills[3][2]=data[n].skills[3][2]-1
  171. elseif k==32 and data[n].skills[2][1] and data[n].skills[2][2] > 0 and data[n].skills[2].time < os.time()-3000 then
  172. data[n].skills[2].time=os.time()
  173. for i = 1,10 do
  174. tfm.exec.displayParticle(35,x,y,(p[n].righ and 15 or -15),math.random(-3,3))
  175. end
  176.  
  177. tfm.exec.movePlayer(n,0,0,true,p[n].right and 150 or -150,0,false)
  178. data[n].skills[2][2]=data[n].skills[2][2]-1
  179. elseif k==79 and data[n].skills[4][1] and data[n].skills[4][2] > 0 and data[n].skills[4].time < os.time()-3000 then
  180. data[n].skills[4].time=os.time()
  181. data[n].skills[4][2]=data[n].skills[4][2]-1
  182. tfm.exec.displayParticle(35,x+(p[n].right and 20 or -20),y,0,0,0,0)
  183. tfm.exec.movePlayer(n,x+(p[n].right and 65 or -65),y)
  184. end
  185. end
  186.  
  187. function eventLoop(timePassed,timeLeft)
  188. if alive == 0 or timeLeft < 1000 then
  189. tfm.exec.newGame(maps[math.random(#maps)])
  190. end
  191. for n,p in pairs (tfm.get.room.playerList) do
  192. if data[n].time < os.time()-5000 then
  193. ui.removeTextArea(10000,n)
  194. end
  195. a={}
  196. a[n]=4
  197. if data[n].key==3 then
  198. if data[n].keys[3].down then
  199. if data[n].keys[3].time ~= 0 then
  200. DP(0,p.x,p.y,n)
  201. if data[n].keys[3].time < os.time()-3000 then
  202. for pp=1,#objects do
  203. if (p.x > objects[pp].x-20 and p.x < objects[pp].x+20) and (p.y > objects[pp].y-20 and p.y < objects[pp].y+20) then
  204. if objects[pp].id == cheeseId then
  205. tfm.exec.giveCheese(n)
  206. tfm.exec.playerVictory(n)
  207. for n,p in pairs (tfm.get.room.playerList) do
  208. tfm.exec.chatMessage(text[n].cheeseplace, n)
  209. end
  210. data[n].keys[3].time=0
  211. cheeseId=math.random(1,#objects)
  212. a[n]=1
  213. else
  214. as = math.random(0,100)
  215. if as < 20 then
  216. a[n]=3
  217. aa = math.random(0,2)
  218. if aa == 1 then
  219. tfm.exec.displayParticle (10, p.x+30, p.y, 0, 0, 0, 0, n)
  220. tfm.exec.explosion (p.x+30, p.y, 20, 50, true)
  221. else
  222. tfm.exec.displayParticle (10, p.x-30, p.y, 0, 0, 0, 0, n)
  223. tfm.exec.explosion (p.x-30, p.y, 20, 50, true)
  224. end
  225. elseif as > 20 and as < 40 then
  226. a[n]=3
  227. ui.addTextArea (10000, "", n, -500, -400, 9999, 9999, 0x1, 0x1, 1, false)
  228. data[n].time=os.time()
  229. elseif as > 40 and as < 60 then
  230. a[n]=3
  231. local idO = tfm.exec.addShamanObject (math.random(28,29,30,31), p.x, p.y, 0, 0, 0, true)
  232. table.insert(toDespawn,{os.time(),idO})
  233. local idO = tfm.exec.addShamanObject (68, p.x, p.y, 0, 0, 0, false)
  234. table.insert(toDespawn,{os.time(),idO})
  235. elseif as > 60 and as < 80 then
  236. a[n]=3
  237. tfm.exec.movePlayer(n,math.random(50,1550),math.random(50,350),0,0,0,false)
  238. elseif as > 80 then
  239. a[n]=3
  240. tfm.exec.killPlayer(n)
  241. else
  242. a[n]=2
  243. end
  244. data[n].keys[3].time=0
  245. end
  246. else
  247. data[n].keys[3].time=0
  248. end
  249. end
  250. if a[n]==1 then
  251. tfm.exec.chatMessage(text[n].cheese, n)
  252. elseif a[n]==2 then
  253. tfm.exec.chatMessage(text[n].nocheese, n)
  254. elseif a[n]==3 then
  255. tfm.exec.chatMessage(text[n].trap, n)
  256. else
  257. tfm.exec.chatMessage(text[n].wrongplace, n)
  258. end
  259. end
  260. end
  261. else
  262. data[n].key=0
  263. data[n].keys[3].time=0
  264. end
  265. end
  266. end
  267. for i,opp in ipairs(toDespawn) do
  268. if opp[1] <= os.time()-5000 then
  269. tfm.exec.removeObject(opp[2])
  270. table.remove(toDespawn,i)
  271. end
  272. end
  273. end
  274.  
  275. eventPlayerDied=DieWon
  276.  
  277. function eventPlayerWon(n)
  278. data[n].food=data[n].food+1
  279. data[n].food2=data[n].food2+5
  280. if data[n].food2==5 then
  281. data[n].lists=data[n].lists+1
  282. data[n].food2=0
  283. if data[n].lists < 7 then
  284. data[n].skills[data[n].lists][1]=true
  285. end
  286. end
  287. DieWon()
  288. end
  289.  
  290. function eventTextAreaCallback(id,n,event)
  291. if event == "close" then
  292. for i=1,4 do
  293. ui.removeTextArea(i, n)
  294. end
  295. end
  296. end
  297.  
  298. local c={"proifle","p","lang"}
  299. function eventChatCommand(n,cmd)
  300. local c={}
  301. for i in cmd:gmatch('[^%s]+') do
  302. table.insert(c,i)
  303. end
  304. c[1]=c[1]:lower()
  305. if (c[1]=="profile" or c[1]=="p") then
  306. if c[2] then
  307. if data[c[2]] then
  308. openProfile(n,c[2])
  309. end
  310. else
  311. openProfile(n,n)
  312. end
  313. elseif c[1]=="lang" then
  314. text[n]=lang[c[2]] or text[n]
  315. end
  316. end
  317.  
  318. tfm.exec.newGame(maps[math.random(#maps)])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement