Advertisement
Guest User

Qloqee

a guest
Oct 31st, 2014
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.84 KB | None | 0 0
  1. maps={"@5504979","@5519105","@5460000","@5511019","@5509230","@5506625","@5511057"}
  2. t={}
  3. ban={}
  4. text=""
  5. tradu={}
  6. local estrella = "★"
  7. nametext="\n<b><p align='Center'><font size='18'><bv>%s"
  8. trans={
  9. es={stats="<font size='12'>\n\n\n<b>Lenguaje:%s\nFirst:%d\nRondas jugadas:%d";
  10. close="Cerrar";
  11. help="<r>¿Como jugar?</r><b>Cheesebooom es un divertido juego en el cual el bojetivo es llevar el queso al hoyo sobreviviendo de los poderes de tus rivales.</b><br><r>¿que comandos existen, para que sirve cada un?<br></r><j>!help</j>Abre la ayuda <br><j>!shop</j> abre la tienda<br><j>!stats</j>abre tu perfil<j><br>!stats nameplayer</j>abre el perfil del raton que pongas.\n\nMinijuego creado por:<b>Alenaxoxdxd</b>  <b>, qloqee</b> y <b>Tiwdamerenda</b>";
  12. ban="<v><b><p align='Center'><font size='20'>%s has sido baneado<b><font size='15'>\n<r><a href='event:closeban'>[Cerrar]";
  13. shoptext="<font size='12'>Coins:<b>%d</b>\n<a href='event:sp'>Super chispa<j>(10)</j></a>"};
  14. br={stats="<font size='12'>\n\n\n<b>Linguagem:%s\nFirst:%d\nRodadas jogadas:%d";
  15. close="Fechar";
  16. help="<r>Como jogar?</r><b>O objetivo de Cheeseboom é levar o queijo a toca sobrevivendo dos poderes de outros jogadores.</b><br><r>Lista de comandos:<br></r><j>!help</j>Abre a ajuda.<br><j>!shop</j>Abre a loja.<br><j>!stats</j>abre seu perfil.<j><br>!stats jogador</j>abre o perfil do jogador que você colocou.\n\nMinigame criado por:<b>Alenaxoxdxd</b>,<b>qloqee</b> e <b>Tiwdamerenda</b>";
  17. ban="<v><b><p align='Center'><font size='20'>%s foi banido<b><font size='15'>\n<r><a href='event:closeban'>[Fechar]";
  18. shoptext="<font size='12'>Coins:<b>%d</b>\n<a href='event:sp'>Super espirito<j>(10)</j></a>"}
  19. }
  20. shop_items={
  21. sp=10;
  22. }
  23. col=0
  24. timed=1
  25. mapcrew={"Yarley"};
  26. admins={"Tiwdamerenda","Alenaxoxdxd","Qloqee"}
  27.  
  28. function main()
  29. tfm.exec.disableAutoShaman(true)
  30. tfm.exec.disableAutoNewGame(true)
  31. tfm.exec.disableAutoScore(true)
  32. end
  33.  
  34. function process(player)
  35. for i=1,#admins do
  36. if player==admins[i] then
  37. return true
  38. end
  39. end
  40. end
  41.  
  42. function isAdm(player)
  43. return process(player)==true
  44. end
  45.  
  46. function tablerandom(table)
  47.         return table[math.random(#table)]
  48. end
  49.  
  50. function eventNewPlayer(p)
  51. tfm.exec.bindKeyboard(p,32,true,true)
  52. if not t[p] then
  53. t[p]={time=os.time(),first=0,rondas=0,coins=0,sp=0}
  54. tradu[p]="es"
  55. end
  56. if ban[p]==nil then
  57. ban[p]=false
  58. end
  59. lang=tradu[p]
  60. ui.addTextArea(1,"<p align='Center'>¡Bienvenido a <b>Cheeseboom.!<br>ve a la <j>ayuda</j> para mas informacion escribiendo <j>!help</j>",p,(800-260)/2,88,260,80,0x324650,0x324650,1)
  61. ui.addTextArea(2,"<R><p align='Center'><b><a href='event:close'>"..trans[lang].close.."</a>",p,(800-260)/2,182,260,23,0x324650,0x324650,1)
  62. ui.addTextArea(12,"<p align='Center'><R><b>"..t[p].coins,p,6,372,22,20,0x324650,0x324650,1)
  63.  end
  64.  
  65. for p in pairs(tfm.get.room.playerList) do
  66. eventNewPlayer(p)
  67. end
  68.  
  69. function buy(player,item)
  70. if shop_items[item] then
  71. if t[player].coins>=shop_items[item] then
  72. t[player].coins=t[player].coins-shop_items[item]
  73. lang=tradu[player]
  74. t[player][item]=t[player][item]+1
  75. ui.updateTextArea(12,"<p align='Center'><r><b>"..t[player].coins,player)
  76. ui.updateTextArea(20,trans[lang].shoptext:format(t[player].coins),player)
  77. end
  78. end
  79. end
  80.  
  81. function rank(player)
  82. oi={}
  83. text="<p align='Center'>"
  84. for n in pairs(tfm.get.room.playerList) do
  85.         table.insert(oi,{t[n].first,n})
  86. end
  87. table.sort(oi,function(v1,v2) return v1[1] > v2[1] end)
  88. for i=1,#oi do
  89. if i==1 then
  90. text=text.."\n<b>"..i.." "..oi[i][2].." "..oi[i][1].."</b>"
  91. else
  92. text=text.."\n"..i.." "..oi[i][2].." "..oi[i][1]
  93. end
  94. end
  95. ui.addTextArea(0, "<font size='20'><J>"..estrella..""..player.."</font>", nil, 260, 100, 300, 200, 0x191919, 0x191919, 0.6, true)
  96. ui.addTextArea(2, "<font size='20'><p align='center'>Ranking</font>", nil, 260, 70, 300, 30, 0x191919, 0x191919, 1.1, true)
  97. ui.addTextArea(1,"<p align='center'><a href='event:close'><b>X</b></a></p>", nil, 530, 100, 30, 16, 0x191919, 0x191919, 1.1, true)
  98. end
  99.  
  100. function changetrans(player,lang)
  101.         if trans[lang] then
  102.                 tradu[player]=lang
  103.         end
  104. end
  105.  
  106. function eventKeyboard(p,k,d,x,y)
  107. local isDead=tfm.get.room.playerList[p].isDead
  108. if k==32 and t[p].time < os.time()-3000 and not isDead and t[p].sp<=0 then
  109. tfm.exec.addShamanObject(24,x,y)
  110. t[p].time=os.time()
  111. elseif t[p].sp>0 and not isDead and t[p].time<os.time()-2000 then
  112. for i=1,3 do
  113. tfm.exec.addShamanObject(24,x,y+i)
  114. end
  115. t[p].time=os.time()
  116. t[p].sp=t[p].sp-1
  117.         end
  118. end
  119.  
  120. function eventLoop()
  121. timed=timed-0.5
  122. ui.addTextArea(35,"<font size='13'><b><p align='Center'><N>Time:<v>"..math.floor(timed).."<bl>|<R><a href='event:help'>?</a><bl>|<N><a href='event:rank'>Ranking</a>",nil,(800-180)/2,20,180,20,1,1,0)
  123. if timed<=0 then
  124. tfm.exec.newGame(tablerandom(maps))
  125. end
  126. end
  127.  
  128. function capitalize(word)
  129.   if word:sub(1,1)=="+" then
  130.     return "+"..string.upper(word:sub(2,2))..string.lower(word:sub(3))
  131.   else
  132.         return string.upper(word:sub(1,1))..string.lower(word:sub(2))
  133.   end
  134. end
  135.  
  136. function eventNewGame()
  137. timed=120
  138. tfm.exec.setUIMapName("\n")
  139. for a in pairs(tfm.get.room.playerList)do
  140.  t[a].rondas=t[a].rondas+1
  141.  end;
  142. col=0
  143. for n,p in pairs(tfm.get.room.playerList) do
  144. if ban[n] then
  145. tfm.exec.killPlayer(n)
  146. end
  147. end
  148.  end;
  149.  
  150. function eventTextAreaCallback(id,p,cb)
  151. buy(p,cb)
  152. if cb=="close" then
  153. ui.removeTextArea(1,p)
  154. ui.removeTextArea(2,p)
  155. ui.removeTextArea(-2,p)
  156. elseif cb=="closeh" then
  157. ui.removeTextArea(3,p)
  158. ui.removeTextArea(4,p)
  159. elseif cb=="closep" then
  160. ui.removeTextArea(-1,p)
  161. ui.removeTextArea(7,p)
  162. ui.removeTextArea(8,p)
  163. elseif cb=="closeshop" then
  164. ui.removeTextArea(20,p)
  165. ui.removeTextArea(21,p)
  166. elseif cb=="closeban" then
  167. ui.removeTextArea(30,p)
  168. elseif cb=="help" then
  169. help(p)
  170. elseif cb=="rank" then
  171. rank(p)
  172. end
  173. end
  174.  
  175. function bann(p)
  176. for name in pairs(tfm.get.room.playerList) do
  177. if name==p and isAdm(name)==false then
  178. tfm.exec.killPlayer(name)
  179. for budega,te in pairs(admins) do
  180. lang=tradu[te]
  181. if tfm.get.room.playerList[te] then
  182. ui.addTextArea(30,(trans[lang].ban):format(p),te,154,27,500,60,1,1,1);
  183. end
  184. end
  185. ban[p]=true
  186. end
  187. end
  188. end
  189.  
  190. function unban(p)
  191. for name in pairs(tfm.get.room.playerList) do
  192. if name==p then
  193. if ban[p] then
  194. tfm.exec.respawnPlayer(name)
  195. ban[p]=false
  196. end
  197. end
  198. end
  199. end
  200.  
  201. function help(p)
  202. lang=tradu[p]
  203. ui.addTextArea(3,trans[lang].help,p,227,64,325,225,0x324650,0x324650,1)
  204. ui.addTextArea(4,"<b><R><p align='Center'><a href='event:closeh'>X</a>",p,202,45,25,23,0x324650,0x324650,1)
  205. end
  206.  
  207. function eventPlayerLeft(p)
  208. eventPlayerDied(p)
  209. end
  210.  
  211. function eventChatCommand(p,c)
  212. local arg={}
  213. for d in c:gmatch("%S+")do
  214.  table.insert(arg,d:lower())
  215. end;
  216. if arg[1]=="ban" and isAdm(p) then
  217. arg[2]=capitalize(arg[2])
  218. bann(arg[2])
  219. elseif arg[1]=="unban" and isAdm(p) then
  220. arg[2]=capitalize(arg[2])
  221. unban(arg[2])
  222. elseif arg[1]=="new" and isAdm(p) then
  223. tfm.exec.newGame(maps[math.random(#maps)])
  224. elseif arg[1]=="lang" then
  225. changetrans(p,arg[2])
  226. elseif arg[1]=="shop" then
  227. lang=tradu[p]
  228. ui.addTextArea(20,(trans[lang].shoptext):format(t[p].coins),p,200,80,450,230,0x324650,0x324650,1)
  229. ui.addTextArea(21,"<font size='12'><b><R><p align='Center'><a href='event:closeshop'>"..trans[lang].close.."</a>",p,200,320,450,23,0x324650,0x324650,1)
  230. elseif arg[1]=="stats" then
  231. if arg[2] then
  232. arg[2]=capitalize(arg[2])
  233. if t[arg[2]]~=nil and tfm.get.room.playerList[arg[2]]~=nil then
  234. lang=tradu[p]
  235. bandeira=("<b><i>"..tradu[arg[2]]):upper()
  236. ui.addTextArea(-1,(trans[lang].stats):format(bandeira,t[arg[2]].first,t[arg[2]].rondas),p,260,100,300,200,0x191919,0x191919,1.1,true)
  237. ui.addTextArea(7,(nametext):format(arg[2]),p,260,100,300,70,0x191919,0x191919,0.0,true)
  238. ui.addTextArea(8,"<b><r><i><p align='Center'><a href='event:closep'>"..trans[lang].close.."</a>",p,530,100,30,16,0x191919,0x191919,1.1,true)
  239. end
  240. end
  241. if not arg[2] then
  242. lang=tradu[p]
  243. bandeira=("<b><i>"..lang):upper()
  244. ui.addTextArea(-1,trans[lang].stats:format(bandeira,t[p].first,t[p].rondas),p,260,100,300,200,0x191919,0x191919,1.1,true)
  245. ui.addTextArea(7,nametext:format(p),p,260,100,300,70,0x191919,0x191919,0.0,true)
  246. ui.addTextArea(8,"<b><r><i><p align='Center'><a href='event:closep'><B>X</B></a>",p,530,100,30,16,0x191919,0x191919,1.1,true)
  247. end
  248. end
  249.  end
  250.  
  251. function eventPlayerDied(p)
  252. local i=0
  253. for n,player in pairs(tfm.get.room.playerList) do
  254. if not player.isDead then
  255. i=i+1
  256. end
  257. end
  258. if i==0 then
  259. tfm.exec.newGame(tablerandom(maps))
  260. elseif i==1 and timed>=2 then
  261. timed=math.floor(timed/2)
  262. end
  263. end
  264.  
  265. function eventPlayerWon(p)
  266. col=col+1
  267. ui.updateTextArea(12,"<p align='Center'><R><b>"..t[p].coins,p)
  268. eventPlayerDied(p)
  269. if col==1 then
  270. t[p].first=t[p].first+1
  271. t[p].coins=t[p].coins+10
  272. else
  273. t[p].coins=t[p].coins+5
  274. end
  275. ui.updateTextArea(12,"<p align='Center'><R><b>"..t[p].coins,p)
  276. end
  277.  
  278. for n,comands in pairs({"Ban","Unban","Stats","Shop","Lang","New"}) do
  279. system.disableChatCommandDisplay(comands,true)
  280. system.disableChatCommandDisplay(comands:lower(),true)
  281. end
  282.  
  283. main();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement