Area801

Script UNO Transformice

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