Guest User

UNO - Transformice Lua

a guest
Sep 4th, 2015
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 16.47 KB | None | 0 0
  1. -- UNO
  2. -- Escrito por Ninguem - Data 04/09/2015
  3.  
  4. -- VARIÁVEIS EDITÁVEIS
  5.  
  6. adm = "Ninguem" -- seu nick
  7. gameName = "UNO!" -- nome do mapa
  8. configTempo = 15000 -- tempo limite entre cada jogada
  9. autoStart = true -- inicia e encerra a partida sozinho sem precisar dar !start e !new
  10.  
  11. mapa = [[<C><P /><Z><S><S P="0,0,0.3,0.2,0,0,0,0" L="800" o="214a25" X="400" c="3" Y="135" T="12" H="40" /><S P="0,0,0.3,0.2,0,0,0,0" L="800" o="214a25" X="400" N="" Y="370" T="12" H="60" /><S P="0,0,0,0.2,0,0,0,0" L="200" o="6a7495" X="900" c="3" N="" Y="200" T="12" H="3000" /><S H="3000" L="200" o="6a7495" X="-100" c="3" N="" Y="200" T="12" P="0,0,0,0.2,0,0,0,0" /><S H="100" L="800" o="6a7495" X="400" c="4" N="" Y="-41" T="12" P="0,0,0,0.2,0,0,0,0" /></S><D><P C="ffd800" Y="60" T="90" P="0,0" X="400" /><P C="ffd800" Y="60" T="90" X="606" P="0,0" /><P C="ffd800" Y="60" T="90" P="0,0" X="812" /><P C="ffd800" Y="60" T="90" X="194" P="0,0" /><P C="ffd800" Y="60" T="90" P="0,0" X="-12" /><P C="317c39" Y="125" T="34" X="0" P="0,0" /><P C="8a311b" Y="135" T="19" X="150" P="0,0" /><P C="8a311b" Y="135" T="19" P="0,0" X="250" /><P C="8a311b" Y="134" T="19" X="350" P="0,0" /><P C="8a311b" Y="134" T="19" P="0,0" X="450" /><P C="8a311b" Y="134" T="19" X="550" P="0,0" /><P C="8a311b" Y="134" T="19" P="0,0" X="650" /><P C="8a311b" Y="135" T="19" P="0,0" X="50" /><P C="8a311b" Y="134" T="19" X="750" P="0,0" /><DS Y="100" X="400" /></D><O /></Z></C>]]
  12.  
  13. -- cores das cartas
  14. -- vermelho, azul, amarelo, verde, preto
  15. corInt = {0xFF3232, 0x5365CC, 0xFFD800, 0x73D33B, 1}
  16. corStr = {"FF3232", "5365CC", "FFD800", "73D33B", "000000"}
  17.  
  18. -- ícones das cartas especiais
  19. rev="&#167;"
  20. skip="&#216;"
  21. d2="+2"
  22. d4="+4"
  23. wild="*"
  24.  
  25. -- baralho com 108 cartas
  26. cartas = { -- {cor,valor}
  27.     {1,"0"},{1,"1"},{1,"1"},{1,"2"},{1,"2"},{1,"3"},{1,"3"},{1,"4"},{1,"4"},{1,"5"},{1,"5"},{1,"6"},{1,"6"},{1,"7"},{1,"7"},{1,"8"},{1,"8"},{1,"9"},{1,"9"},{1,rev},{1,rev},{1,skip},{1,skip},{1,d2},{1,d2},
  28.     {2,"0"},{2,"1"},{2,"1"},{2,"2"},{2,"2"},{2,"3"},{2,"3"},{2,"4"},{2,"4"},{2,"5"},{2,"5"},{2,"6"},{2,"6"},{2,"7"},{2,"7"},{2,"8"},{2,"8"},{2,"9"},{2,"9"},{2,rev},{2,rev},{2,skip},{2,skip},{2,d2},{2,d2},
  29.     {3,"0"},{3,"1"},{3,"1"},{3,"2"},{3,"2"},{3,"3"},{3,"3"},{3,"4"},{3,"4"},{3,"5"},{3,"5"},{3,"6"},{3,"6"},{3,"7"},{3,"7"},{3,"8"},{3,"8"},{3,"9"},{3,"9"},{3,rev},{3,rev},{3,skip},{3,skip},{3,d2},{3,d2},
  30.     {4,"0"},{4,"1"},{4,"1"},{4,"2"},{4,"2"},{4,"3"},{4,"3"},{4,"4"},{4,"4"},{4,"5"},{4,"5"},{4,"6"},{4,"6"},{4,"7"},{4,"7"},{4,"8"},{4,"8"},{4,"9"},{4,"9"},{4,rev},{4,rev},{4,skip},{4,skip},{4,d2},{4,d2},
  31.     {5,wild},{5,wild},{5,wild},{5,wild},{5,d4},{5,d4},{5,d4},{5,d4},
  32. }
  33.  
  34. -- TEXTOS
  35.  
  36. txtDraw = "Jogue um %s ou compre %d cartas."
  37. txtSit = "Vá até uma cadeira e aperte espaço para pegar seu lugar!"
  38. txtGameOver = "%s venceu o jogo!"
  39. txtPass = "Passar a vez"
  40. txtWarn = "Volte para sua cadeira!"
  41. txtChoose = "Escolha uma cor"
  42. txtRed = "VERMELHO"
  43. txtBlue = "AZUL"
  44. txtYellow = "AMARELO"
  45. txtGreen = "VERDE"
  46.  
  47. -- VARIÁVEIS DE JOGO
  48.  
  49. comandos = {"ban", "kick", "new", "start"}
  50. baralho = {}
  51. pilha = {}
  52. jogador = {}
  53. nome = {}
  54. timerTxt = {}
  55. modo = "inicio"
  56. duelo = false
  57. atual = nil
  58. vez = false
  59. sel = true
  60. draw = false
  61. acumulo = 0
  62. acumulo4 = 0
  63. fluxo = 1
  64. tempoJogada = os.time() + 15000
  65. tempo = os.time()+1000
  66.  
  67. -- FUNÇÕES AUXILIARES -- podem funcionar em outros scripts
  68.  
  69. function split(t,s) -- retorna uma table com a string dividida
  70.     local a={}
  71.     for i,v in string.gmatch(t,string.format("[^%s]+",s or "%s")) do
  72.         table.insert(a,i)
  73.     end
  74.     return a
  75. end
  76.  
  77. function arrumaNick(p) -- retorna o nick com o formato padrão (inicial maiúscula e restante minúsculo)
  78.     return p:sub(1,1):upper() .. p:sub(2):lower()
  79. end
  80.  
  81. function embaralhar(b) -- embaralha uma table recebida
  82.     local novo = {}
  83.     local rand = {}
  84.     for i=1, #b do
  85.         rand[i] = i
  86.     end
  87.     for i=1, #b do
  88.         local r = math.random(#rand)
  89.         table.insert(novo, b[rand[r]])
  90.         table.remove(rand, r)
  91.     end
  92.     return novo
  93. end
  94.  
  95. function efeitoExplosao(id, x, y, vezes, vel) -- faz uma mini explosão de partículas
  96.     for i=1, vezes do
  97.         tfm.exec.displayParticle(id, x, y, math.random(-vel,vel)/10, math.random(-vel,vel)/10, 0, 0)
  98.     end
  99. end
  100.  
  101. function apagaText() -- procura textos pra apagar, requer uma table global timerTxt, preenchida com {id=idDaTextArea, p=JogadorAlvo, time=TempoDeDuracao}
  102.     local apagar={}
  103.     for i,v in pairs(timerTxt) do
  104.         if v.time<os.time() then
  105.             table.insert(apagar,i)
  106.             ui.removeTextArea(v.id, v.p)
  107.         end
  108.     end
  109.     for i=1,#apagar do
  110.         timerTxt[apagar[i]]=nil
  111.     end
  112. end
  113.  
  114. function timerText(i, t, pp) -- auxilia no preenchimento da tabela timerTxt
  115.     table.insert(timerTxt, {id=i, time=os.time()+t, p=pp})
  116. end
  117.  
  118. -- FUNÇÕES DO SCRIPT
  119.  
  120. function novoJogo()
  121.     for i=1, 50 do
  122.         ui.removeTextArea(i)
  123.     end
  124.     for i=1, 8 do
  125.         if jogador[i] then
  126.             nome[jogador[i].nome] = nil
  127.             jogador[i] = nil
  128.         end
  129.     end
  130.     ui.removeTextArea(100)
  131.     modo = "inicio"
  132.     tfm.exec.newGame(mapa)
  133. end
  134.  
  135. function desenhaCarta(i, c, p, x, y)
  136.     ui.addTextArea(i, "\n<p align='center'><font size='23px' color='#ffffff'>"..c[2], p, x, y, 40, 60, corInt[c[1]], 0xffffff, 1,false)
  137. end
  138.  
  139. function desenhaBaralho(p)
  140.     ui.addTextArea(11, "", p, 330, 200, 40, 60, 1, 0xffffff, 1,false)
  141.     ui.addTextArea(12, "<p align='center'><font size='12px' color='#FFD800'>UNO", p, 333, 223, 34, 16, 0xFF3232, 0xFF3232, 1,false)
  142. end
  143.  
  144. function atualizaScore(n, p)
  145.     ui.addTextArea(n, "<p align='center'>"..jogador[n].nome.."<b>\n<font size='18px'><j>"..(#jogador[n].mao~=1 and #jogador[n].mao or "UNO!"), p, (n-1)*100-50, 115, 200, 60, 0, 0, 0, false)
  146. end
  147.  
  148. function atualizaMao(p)
  149.     for i=20, 50 do
  150.         ui.removeTextArea(i, p)
  151.     end
  152.     for i, v in pairs(jogador[nome[p]].mao) do
  153.         desenhaCarta(i+20, v, p, 400-(#jogador[nome[p]].mao*25)+50*(i-1), 330)
  154.     end
  155. end
  156.  
  157. function atualizaFluxo(p)
  158.     defFluxo = {
  159.         "&gt; &gt; &gt; &gt; &gt; &gt; &gt; &gt; &gt; &gt; &gt; &gt; &gt; &gt; &gt; &gt; &gt; &gt; &gt; &gt; &gt; &gt; &gt; &gt; &gt; &gt; &gt; &gt; &gt; &gt; &gt; &gt;",
  160.         "&lt; &lt; &lt; &lt; &lt; &lt; &lt; &lt; &lt; &lt; &lt; &lt; &lt; &lt; &lt; &lt; &lt; &lt; &lt; &lt; &lt; &lt; &lt; &lt; &lt; &lt; &lt; &lt; &lt; &lt; &lt; &lt;"
  161.     }
  162.     ui.addTextArea(14, string.format("<p align='center'><font size='20px' color='#214A25'><b>%s", defFluxo[fluxo]), p, 0, 160, 800, 120, 0, 0, 0, false)
  163. end
  164.  
  165. function atualizaPonteiro(p)
  166.     ui.addTextArea(13, "", p, 100*(vez-1), 30, 100, 120, -1, 0xffffff, 1, false)
  167. end
  168.  
  169. function atualizaTimer()
  170.     tempoJogada = os.time() + configTempo
  171. end
  172.  
  173. function criaJogador(p, n)
  174.     jogador[n] = {nome=p, mao={}, timer=os.time()+2000}
  175.     atualizaScore(n)
  176.     ui.removeTextArea(0, p)
  177.     nome[p] = n
  178. end
  179.  
  180. function removeJogadorUI(p, n)
  181.     ui.removeTextArea(n)
  182.     jogador[n] = nil
  183.     nome[p] = nil
  184. end
  185.  
  186. function removeJogador(p, n)
  187.     if n == vez then
  188.         autoPlay()
  189.     end
  190.     for i=1, #jogador[n].mao do
  191.         table.insert(pilha, table.remove(jogador[n].mao))
  192.     end
  193.     removeJogadorUI(p, n)
  194. end
  195.  
  196. function ordenar(b)
  197.     table.sort(b, function(a, b)
  198.         p = {["0"]=0,["1"]=1,["2"]=2,["3"]=3,["4"]=4,["5"]=5,["6"]=6,["7"]=7,["8"]=8,["9"]=9,[rev]=10,[skip]=11,[d2]=12,[wild]=13,[d4]=14,}
  199.         if a[1] ~= b[1] then
  200.             return a[1] < b[1]
  201.         else
  202.             return p[a[2]] < p[b[2]]
  203.         end
  204.     end)
  205. end
  206.  
  207. function comprarCartas(p, qtd)
  208.     ui.addTextArea(70+nome[p], "<p align='center'><font size='20px'><bv><b>+"..qtd, nil, (nome[p]-1)*100, 145, 100, 60, 0, 0, 0, false)
  209.     timerText(70+nome[p], 2000)
  210.     for i=1, qtd do
  211.         if #baralho == 0 then
  212.             baralho = embaralhar(pilha)
  213.             pilha = {}
  214.         end
  215.         table.insert(jogador[nome[p]].mao, table.remove(baralho))
  216.     end
  217.     ordenar(jogador[nome[p]].mao)
  218.     atualizaMao(p)
  219.     atualizaScore(nome[p])
  220. end
  221.  
  222. function pegaAnterior()
  223.     local n = vez
  224.     repeat
  225.         n = fluxo == 1 and (n == 1 and 8 or n - 1) or (n == 8 and 1 or n + 1)
  226.     until jogador[n]
  227.     return n
  228. end
  229.  
  230. function pegaProximo()
  231.     local n = vez
  232.     repeat
  233.         n = fluxo == 1 and (n == 8 and 1 or n + 1) or (n == 1 and 8 or n - 1)
  234.     until jogador[n]
  235.     return n
  236. end
  237.  
  238. function passarVez()
  239.     vez = pegaProximo()
  240.     draw = false
  241.     atualizaPonteiro()
  242.     atualizaTimer()
  243.     ui.removeTextArea(15)
  244.     ui.removeTextArea(16)
  245.     ui.removeTextArea(17)
  246. end
  247.  
  248. function estaNoLugar(p)
  249.     local x = tfm.get.room.playerList[p].x
  250.     return nome[p] and x > (nome[p]-1)*100+20 and x < (nome[p]-1)*100+80
  251. end
  252.  
  253. function usaDraw4()
  254.     acumulo4 = acumulo4 + 4
  255.     ui.addTextArea(16, string.format("<p align='center'>"..txtDraw, d4, acumulo4), jogador[vez].nome, 250, 290, 300, 20, 1, 1, 0.4, true)
  256. end
  257.  
  258. function autoPlay()
  259.     local p = jogador[vez].nome
  260.     n = acumulo > 0 and acumulo or acumulo4 > 0 and acumulo4 or 1
  261.     acumulo = 0
  262.     acumulo4 = 0
  263.     if not draw then
  264.         comprarCartas(p, n)
  265.     end
  266.     passarVez()
  267.     if atual[1] == 5 then
  268.         mudaCor()
  269.         sel = true
  270.         if atual[2] == d4 then
  271.             usaDraw4()
  272.         end
  273.     end
  274. end
  275.  
  276. function mudaCor(n)
  277.     atual[1] = n or math.random(1,4)
  278.     desenhaCarta(10, atual, nil, 420, 200)
  279.     local b = {21, 23, 24, 22}
  280.     efeitoExplosao(b[atual[1]], 445, 230, 30, 20)
  281. end
  282.  
  283. function usaSkip()
  284.     efeitoExplosao(35, pegaProximo()*100-50, 100, 50, 10)
  285.     passarVez()
  286. end
  287.  
  288. function usaReverse()
  289.     fluxo = fluxo == 1 and 2 or 1
  290.     atualizaFluxo()
  291.     for i=20, 780, 10 do
  292.         tfm.exec.displayParticle(3, i, 177, 0, 0, 0, 0)
  293.     end
  294. end
  295.  
  296. -- EVENTOS
  297.  
  298. function eventNewGame()
  299.     tempo = os.time()+1000
  300.     tfm.exec.setUIMapName(gameName)
  301.     ui.addTextArea(0, "<font size='25px'><p align='center'>"..txtSit, nil, 0, 180, 800, 200, 0, 0, 0, false)
  302.     for i, v in pairs(tfm.get.room.playerList) do
  303.         tfm.exec.bindKeyboard(i, 32, true, true)
  304.         system.bindMouse(i, true)
  305.     end
  306. end
  307.  
  308. function eventTextAreaCallback(id, p, cmd)
  309.     if id == 15 and nome[p] == vez then
  310.         mudaCor(tonumber(cmd))
  311.         passarVez()
  312.         sel = true
  313.         if atual[2] == d4 then
  314.             acumulo4 = acumulo4 + 4
  315.             ui.addTextArea(16, string.format("<p align='center'>"..txtDraw, d4, acumulo4), jogador[vez].nome, 250, 290, 300, 20, 1, 1, 0.4, true)
  316.         end
  317.     end
  318. end
  319.  
  320. function eventMouse(p, x, y)
  321.     if modo == "start" then
  322.         local xx =  tfm.get.room.playerList[p].x
  323.         if jogador[nome[p]] and y > 325 and y < 400 and estaNoLugar(p) then
  324.             local carta = math.ceil((x+5 - (400 - (#jogador[nome[p]].mao*25)))/50)
  325.             local mao = jogador[nome[p]].mao
  326.             if vez == nome[p] and sel then
  327.                 if mao[carta] and (acumulo == 0 or mao[carta][2] == d2) and (acumulo4 == 0 or mao[carta][2] == d4) and (mao[carta][1] == atual[1] or mao[carta][2] == atual[2] or mao[carta][2] == wild or mao[carta][2] == d4) then
  328.                     if atual[2] == d4 or atual[2] == wild then
  329.                         atual[1] = 5
  330.                     end
  331.                     table.insert(pilha, atual)
  332.                     atual = table.remove(mao, carta)
  333.                     atualizaMao(p)
  334.                     desenhaCarta(10, atual, nil, 420, 200)
  335.                     atualizaScore(nome[p])
  336.                     if #jogador[nome[p]].mao == 0 then
  337.                         ui.addTextArea(13, "", nil, 5, 5, 790, 400, 1, 1, 0.5, false)
  338.                         ui.addTextArea(14, string.format("<p align='center'><font size='60px' color='#ffffff'>"..txtGameOver, p), nil, 0, 170, 800, 400, 0, 0, 0, false)
  339.                         tfm.exec.setPlayerScore(p, 1, true)
  340.                         modo = "fim"
  341.                     else
  342.                         if atual[2] == wild or atual[2] == d4 then
  343.                             sel = false
  344.                             draw = true
  345.                             ui.addTextArea(15, string.format("<p align='center'>%s\n<a href='event:1'><font color='#FF3232'>%s</font></a> - <a href='event:2'><font color='#5365CC'>%s</font></a> - <a href='event:3'><font color='#FFD800'>%s</font></a> - <a href='event:4'><font color='#73D33B'>%s</font></a>", txtChoose, txtRed, txtBlue, txtYellow, txtGreen), p, 250, 290, 300, 30, 1, 1, 0.7, true)
  346.                         else
  347.                             if atual[2] == skip then
  348.                                 usaSkip()
  349.                             elseif atual[2] == rev then
  350.                                 if duelo then
  351.                                     usaSkip()
  352.                                 else
  353.                                     usaReverse()
  354.                                 end
  355.                             elseif atual[2] == d2 then
  356.                                 acumulo = acumulo + 2
  357.                                 ui.addTextArea(16, string.format("<p align='center'>"..txtDraw, d2, acumulo), jogador[pegaProximo()].nome, 250, 290, 300, 20, 1, 1, 0.4, true)
  358.                             end
  359.                             passarVez()
  360.                         end
  361.                     end
  362.                     for i=1, 10 do
  363.                         tfm.exec.displayParticle(3, 445, 230, math.random(-20,20)/10, math.random(-20,20)/10, 0, 0)
  364.                     end
  365.                 end
  366.             elseif os.time() > jogador[nome[p]].timer and mao[carta] then
  367.                 desenhaCarta(nome[p]+200, mao[carta], nil, (nome[p]-1)*100+30, 30)
  368.                 timerText(200+nome[p], 1000)
  369.                 jogador[nome[p]].timer = os.time()+2000
  370.             end
  371.         elseif x > 325 and x < 375 and y > 195 and y < 245 and not draw and vez == nome[p] and sel then
  372.             if acumulo > 0 or acumulo4 > 0 then
  373.                 comprarCartas(p, acumulo > 0 and acumulo or acumulo4)
  374.                 acumulo = 0
  375.                 acumulo4 = 0
  376.                 passarVez()
  377.             else
  378.                 comprarCartas(p, 1)
  379.                 ui.addTextArea(16, "<p align='center'><a href='event:skip'>"..txtPass, p, 250, 290, 300, 20, 1, 1, 0.7, true)
  380.                 draw = true
  381.             end
  382.         end
  383.     end
  384. end
  385.  
  386. function eventChatCommand(p, cmd)
  387.     local arg = split(cmd, " ")
  388.     if p == adm then
  389.         if arg[1] == "start" and modo == "inicio" then
  390.             local r = {}
  391.             modo = "start"
  392.             sel = true
  393.             fluxo = 1
  394.             draw = false
  395.             atual = nil
  396.             atualizaTimer()
  397.             baralho = embaralhar(cartas)
  398.             pilha = {}
  399.             ui.removeTextArea(0)
  400.             for i, v in pairs(jogador) do
  401.                 comprarCartas(v.nome, 7)
  402.                 table.insert(r, i)
  403.             end
  404.             duelo = #r == 2
  405.             repeat
  406.                 table.insert(pilha, atual)
  407.                 atual = table.remove(baralho)
  408.             until atual[2] ~= d4 and atual[2] ~= wild and atual[2] ~= d2 and atual[2] ~= skip and atual[2] ~= rev
  409.             desenhaCarta(10, atual, nil, 420, 200)
  410.             desenhaBaralho()
  411.             vez = r[math.random(#r)]
  412.             atualizaPonteiro()
  413.             atualizaFluxo()
  414.         elseif arg[1] == "new" then
  415.             novoJogo()
  416.         elseif arg[1] == "skip" then
  417.             autoPlay()
  418.         elseif arg[1] == "ban" and arg[2] and nome[arrumaNick(arg[2])] then
  419.             eventPlayerLeft(arrumaNick(arg[2]))
  420.         end
  421.     end
  422. end
  423.  
  424. function eventKeyboard(p, t, d, x, y)
  425.     if modo == "inicio" and os.time() > tempo and not nome[p] then
  426.         if x > 20 and x < 80 and not jogador[1] then
  427.             criaJogador(p, 1)
  428.         elseif x > 120 and x < 180 and not jogador[2] then
  429.             criaJogador(p, 2)
  430.         elseif x > 220 and x < 280 and not jogador[3] then
  431.             criaJogador(p, 3)
  432.         elseif x > 320 and x < 380 and not jogador[4] then
  433.             criaJogador(p, 4)
  434.         elseif x > 420 and x < 480 and not jogador[5] then
  435.             criaJogador(p, 5)
  436.         elseif x > 520 and x < 580 and not jogador[6] then
  437.             criaJogador(p, 6)
  438.         elseif x > 620 and x < 680 and not jogador[7] then
  439.             criaJogador(p, 7)
  440.         elseif x > 720 and x < 780 and not jogador[8] then
  441.             criaJogador(p, 8)
  442.         end
  443.     end
  444. end
  445.  
  446. function eventLoop()
  447.     for i, v in pairs(jogador) do
  448.         if not estaNoLugar(v.nome) then
  449.             ui.addTextArea(100, "<font size='50px' color='#ffffff'><p align='center'>"..txtWarn, v.nome, 5, 325, 790, 80, 0xff0000, 0xff0000, 1, true)
  450.         else
  451.             ui.removeTextArea(100, v.nome)
  452.         end
  453.     end
  454.     if modo == "fim" then
  455.         local b = {0, 1, 2, 4, 9, 11, 13}
  456.         local x, y, id = math.random(800), math.random(400), b[math.random(#b)]
  457.         for i=1, 40 do
  458.             tfm.exec.displayParticle(id, x, y, math.random(-20,20)/10, math.random(-20,20)/10, 0, 0)
  459.         end
  460.         if os.time() > tempoJogada and autoStart then
  461.             atualizaTimer()
  462.             eventChatCommand(adm, "new")
  463.         end
  464.     end
  465.     if modo == "start" then
  466.         if os.time() > tempoJogada then
  467.             autoPlay()
  468.         elseif tempoJogada - os.time() < 10000 then
  469.             ui.addTextArea(17, "<p align='center'><font size='25px' color='#214A25'>"..math.ceil((tempoJogada - os.time())/1000), nil, 350, 210, 90, 100, 0, 0, 0, false)
  470.         else
  471.             ui.removeTextArea(17)
  472.         end
  473.     elseif modo == "inicio" then
  474.         if os.time() > tempoJogada and autoStart then
  475.             atualizaTimer()
  476.             eventChatCommand(adm, "start")
  477.         end
  478.     end
  479.     apagaText()
  480. end
  481.  
  482. function eventNewPlayer(p)
  483.     if modo == "inicio" then
  484.         ui.addTextArea(0, "<font size='25px'><p align='center'>"..txtSit, p, 0, 180, 800, 200, 0, 0, 0, false)
  485.         tfm.exec.bindKeyboard(p, 32, true, true)
  486.         system.bindMouse(p, true)
  487.     elseif modo == "start" then
  488.         desenhaCarta(10, atual, p, 420, 200)
  489.         desenhaBaralho(p)
  490.         atualizaPonteiro(p)
  491.         atualizaFluxo(p)
  492.     end
  493.     for i, v in pairs(jogador) do
  494.         atualizaScore(i, p)
  495.     end
  496.     tfm.exec.respawnPlayer(p)
  497.     tfm.exec.setUIMapName(gameName)
  498. end
  499.  
  500. function eventPlayerLeft(p)
  501.     if modo == "inicio" then
  502.         if nome[p] then
  503.             removeJogadorUI(p, nome[p])
  504.         end
  505.     elseif modo == "start" then
  506.         if nome[p] and jogador[nome[p]] then
  507.             removeJogador(p, nome[p])
  508.         end
  509.     end
  510. end
  511.  
  512. function eventPlayerDied(p)
  513.     tfm.exec.respawnPlayer(p)
  514. end
  515.  
  516. -- INICIO
  517.  
  518. tfm.exec.disableAutoScore(true)
  519. tfm.exec.disableAutoShaman(true)
  520. tfm.exec.disableAutoNewGame(true)
  521. tfm.exec.disableAfkDeath(true)
  522. for i, v in pairs(comandos) do
  523.     system.disableChatCommandDisplay(v, true)
  524. end
  525. for i, v in pairs(tfm.get.room.playerList) do
  526.     tfm.exec.setPlayerScore(i, 0, false)
  527. end
  528. tfm.exec.newGame(mapa)
Advertisement
Add Comment
Please, Sign In to add comment