Brenower

Bar Halloween

Feb 2nd, 2014
496
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.80 KB | None | 0 0
  1. -- Halloween 2013
  2. -- Créditos:Brenower
  3. -- Tables
  4. data={};
  5. mg={
  6.     ["jackpot"]=0;
  7.     ["gjack"]=25;
  8.     ["s"]=0;
  9.     ["ss"]=0;
  10.     ["ddoce"]=1;
  11.     players={};
  12. };
  13. -- Functions
  14. function jackpot()
  15.     if mg.jackpot >= mg.gjack then
  16.         local random = mg.players[math.random(#mg.players)]
  17.         data[random].doces=data[random].doces+mg.jackpot;
  18.         ui.addTextArea(8,"<ROSE><B>[•] [Halloween] "..random.." GANHOU O JACKPOT! ("..mg.jackpot.." DOCES)",NIL,3,380,800,20,1,1,0.5,true)
  19.         mg.jackpot=0;
  20.         mg.gjack=mg.gjack+132+mg.gjack;
  21.         ui.addTextArea(1,"<J><font size='14'>"..mg.jackpot,NIL,455,53,NIL,NIL,0,0,0,true)
  22.     end
  23. end
  24.  
  25. function gastar(maq,p,m1,m2,x,custo)
  26.     if data[p].doces >= custo then
  27.         ui.addTextArea(2,"<ROSE><font size='18'><B>|",p,x,224,NIL,NIL,0,0,0,true)
  28.         ui.addTextArea(3,"<ROSE><font size='18'><B>-",p,x+30,224,NIL,NIL,0,0,0,true)
  29.         ui.addTextArea(4,"<ROSE><font size='18'><B>|",p,x+30+30,224,NIL,NIL,0,0,0,true)
  30.         data[p].x=x;
  31.         data[p].doces=data[p].doces-custo;
  32.         mg.jackpot=mg.jackpot+custo*mg.ddoce;
  33.     end
  34.     data[p].c1=math.random(m1,m2);
  35.     data[p].c2=math.random(m1,m2);
  36.     data[p].c3=math.random(m1,m2);
  37.     data[p].gir=true;
  38.     data[p].time=os.time();
  39.     ui.addTextArea(1,"<J><font size='14'>"..mg.jackpot,NIL,455,53,NIL,NIL,0,0,0,true)
  40.     ui.addTextArea(0,"<R>Doces : <J>"..data[p].doces,p,670,380,NIL,NIL,1,1,0.7,true)
  41. end
  42.  
  43. function iguais(p)
  44.     if data[p].c1 == data[p].c2 and data[p].c2 == data[p].c3 then
  45.         data[p].doces=data[p].doces+data[p].c1*mg.ddoce;
  46.         ui.addTextArea(0,"<R>Doces : <J>"..data[p].doces,p,670,380,NIL,NIL,1,1,0.7,true)
  47.     end
  48. end
  49.  
  50. function giveData(p)
  51.     if not data[p] then
  52.         nD={
  53.             ["doces"]=200;
  54.             ["time"]=0;
  55.             ["gir"]=false;
  56.             ["girs"]=0;
  57.             ["x"]=0;
  58.             ["c1"]=0;
  59.             ["c2"]=0;
  60.             ["c3"]=0;
  61.         };
  62.         data[p]=nD;
  63.     end
  64. end
  65.  
  66. function darDoces(qnt)
  67.     for i in pairs(tfm.get.room.playerList) do
  68.         data[i].doces=data[i].doces+qnt;
  69.     end
  70. end
  71. -- Novo jogador entra na sala
  72. function eventNewPlayer(p)
  73.     giveData(p)
  74.     ui.addTextArea(0,"<R>Doces : <J>"..data[p].doces,p,670,380,NIL,NIL,1,1,0.7,true)
  75.     ui.addTextArea(1,"<J><font size='14'>"..mg.jackpot,NIL,455,53,NIL,NIL,0,0,0,true)
  76.     ui.addTextArea(5,"<font size='18'><a href='event:maq1'>»</a>",NIL,28,307,15,40,0,0,0,true)
  77.     ui.addTextArea(6,"<font size='18'><a href='event:maq2'>»</a>",NIL,208,307,15,40,0,0,0,true)
  78.     ui.addTextArea(7,"<font size='18'><a href='event:maq3'>»</a>",NIL,368,307,15,40,0,0,0,true)
  79.     tfm.exec.respawnPlayer(p)
  80.     table.insert(mg.players,p)
  81. end
  82. -- Inicio do script
  83. tfm.exec.disableAutoNewGame(true)
  84. tfm.exec.disableAutoShaman(true)
  85. tfm.exec.disableAfkDeath(true)
  86. tfm.exec.newGame(3881622)
  87. tfm.exec.setUIMapName("Bar Halloween")
  88. ui.addTextArea(9,"<T>Duplo doce : <R>desativada",NIL,20,27,NIL,NIL,1,1,0.5,true)
  89. for i in pairs(tfm.get.room.playerList) do
  90.     eventNewPlayer(i)
  91. end
  92. -- Callbacks
  93. function eventTextAreaCallback(id,p,link)
  94.     if data[p].gir == false then
  95.         if link == [[maq1]] then
  96.             gastar(1,p,1,5,68,1)
  97.         elseif link == [[maq2]] then
  98.             gastar(2,p,5,10,247,2)
  99.         elseif link == [[maq3]] then
  100.             gastar(3,p,10,15,406,3)
  101.         end
  102.     end
  103. end
  104. -- Loop
  105. function eventLoop()
  106.     mg.s=mg.s+0.5;
  107.     if mg.s == 180 then
  108.         darDoces(10)
  109.     elseif mg.s == 300 then
  110.         darDoces(10)
  111.         mg.ddoce=2;
  112.         ui.addTextArea(9,"<T>Duplo doce : <VP>ativado",NIL,20,27,NIL,NIL,1,1,0.5,true)
  113.     elseif mg.s == 420 then
  114.         darDoces(50)
  115.         mg.ddoce=1;
  116.         ui.addTextArea(9,"<T>Duplo doce : <R>desativada",NIL,20,27,NIL,NIL,1,1,0.5,true)
  117.     end
  118.     mg.s=0;
  119.     jackpot()
  120.     for i in pairs(tfm.get.room.playerList) do
  121.         if data[i].gir == true then
  122.             if data[i].girs ~= 6 then
  123.                 if data[i].time == 0 then
  124.                     ui.addTextArea(2,"<ROSE><font size='18'><B>-",i,data[i].x,224,NIL,NIL,0,0,0,true)
  125.                     ui.addTextArea(3,"<ROSE><font size='18'><B>|",i,data[i].x+30,224,NIL,NIL,0,0,0,true)
  126.                     ui.addTextArea(4,"<ROSE><font size='18'><B>-",i,data[i].x+30+30,224,NIL,NIL,0,0,0,true)
  127.                     data[i].time=1;
  128.                 else
  129.                     ui.addTextArea(2,"<ROSE><font size='18'><B>|",i,data[i].x,224,NIL,NIL,0,0,0,true)
  130.                     ui.addTextArea(3,"<ROSE><font size='18'><B>-",i,data[i].x+30,224,NIL,NIL,0,0,0,true)
  131.                     ui.addTextArea(4,"<ROSE><font size='18'><B>|",i,data[i].x+30+30,224,NIL,NIL,0,0,0,true)
  132.                     data[i].time=0;
  133.                     data[i].girs=data[i].girs+1;
  134.                 end
  135.             else
  136.                 iguais(i)
  137.                 data[i].girs=0;
  138.                 data[i].gir=false;
  139.                 ui.addTextArea(2,"<VP><font size='18'>"..data[i].c1,i,data[i].x-3,224,NIL,NIL,0,0,0,true)
  140.                 ui.addTextArea(3,"<VP><font size='18'>"..data[i].c2,i,data[i].x+24,224,NIL,NIL,0,0,0,true)
  141.                 ui.addTextArea(4,"<VP><font size='18'>"..data[i].c3,i,data[i].x+25+27,224,NIL,NIL,0,0,0,true)
  142.             end
  143.         end
  144.     end
  145. end
  146. -- Jogador sai da sala
  147. function eventPlayerLeft(p)
  148.     for i,v in ipairs(mg.players) do
  149.         if v == p then
  150.             table.remove(mg.players,i)
  151.         end
  152.     end
  153. end
  154. -- Jogador entra na toca
  155. function eventPlayerWon(p)
  156.     tfm.exec.respawnPlayer(p)
  157. end
Advertisement
Add Comment
Please, Sign In to add comment