Script
Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.

Script Jogo da Velha

Ir para baixo

Script Jogo da Velha Empty Script Jogo da Velha

Mensagem por Admin Ter Fev 14, 2023 10:16 pm

---Criado por: Ricfonseca
---Tópico base: http://atelier801.com/topic?f=698799&t=898775
---É favor de não aditar nada abaixo
mapas={"@7081310","@7081332","@7081349","@7081503","@7082883","@7083124"}
tfm.exec.disableAutoShaman(true)
tfm.exec.disableAutoNewGame(true)
tfm.exec.disableAfkDeath(true)
tfm.exec.disableMortCommand(true)
tfm.exec.newGame(mapas[math.random(#mapas)],false)
tfm.exec.setGameTime(10, true)
p1=false
p2=false
win=false
turntime=0
time=0
xm=0
turn=0
s1=0
s2=-1
s3=-2
s4=-3
s5=-4
s6=-5
s7=-6
s8=-7
s9=-8
p1n=""
p2n=""
function eventNewPlayer(p)
system.bindMouse(p, true)
tfm.exec.respawnPlayer(p)
if p1 == false then
ui.addTextArea(3, "<p align='center'><a href='event:p1'><font size='13'><b>Clique para jogar", p, 25, 160, 198, 21, 1, 0x0086F0, 0.6, true)
else
ui.addTextArea(3, "<p align='center'><font size='13'><b>"..p1n.."", p, 25, 160, 198, 21, 1, 0x0086F0, 0.6, true) end
if p2 == false then
ui.addTextArea(4, "<p align='center'><a href='event:p2'><font size='13'><b>Clique para jogar", p, 577, 160, 198, 21, 1, 0x0086F0, 0.6, true)
else
ui.addTextArea(4, "<p align='center'><font size='13'><b>"..p2n.."", p, 577, 160, 198, 21, 1, 0x0086F0, 0.6, true) end end
table.foreach(tfm.get.room.playerList,eventNewPlayer)
function eventreset()
time=time+1
if time > 11 then
win=false
time=0
xm=0
ui.removeTextArea(0, n)
ui.removeTextArea(-1, n)
ui.removeTextArea(-2, n)
ui.removeTextArea(-3, n)
ui.removeTextArea(-4, n)
ui.removeTextArea(-5, n)
ui.removeTextArea(-6, n)
ui.removeTextArea(-7, n)
ui.removeTextArea(-8, n)
ui.removeTextArea(-9, n)
s1=0
s2=-1
s3=-2
s4=-3
s5=-4
s6=-5
s7=-6
s8=-7
s9=-8 end end
function eventLoop(elapsed, remaining)
if s1 == s2 then
if s2 == s3 then
if s1 == 1 then
ui.addTextArea(0, "<p align='center'><font size='15'><b><j></p><p align='center'><font size='40'> </p><p align='center'><font size='20'>"..p1n.."</p><p align='center'><font size='30'>Venceu!", p, 253, 50, 293, 293, 1, 0x0086F0, 0.6, true)
elseif s1 == 2 then
ui.addTextArea(0, "<p align='center'><font size='15'><b><j></p><p align='center'><font size='40'> </p><p align='center'><font size='20'>"..p2n.."</p><p align='center'><font size='30'>Venceu!", p, 253, 50, 293, 293, 1, 0x0086F0, 0.6, true) end
win=true
eventreset() end end
if s4 == s5 then
if s5 == s6 then
if s4 == 1 then
ui.addTextArea(0, "<p align='center'><font size='15'><b><j></p><p align='center'><font size='40'> </p><p align='center'><font size='20'>"..p1n.."</p><p align='center'><font size='30'>Venceu!", p, 253, 50, 293, 293, 1, 0x0086F0, 0.6, true)
elseif s4 == 2 then
ui.addTextArea(0, "<p align='center'><font size='15'><b><j></p><p align='center'><font size='40'> </p><p align='center'><font size='20'>"..p2n.."</p><p align='center'><font size='30'>Venceu!", p, 253, 50, 293, 293, 1, 0x0086F0, 0.6, true) end
win=true
eventreset() end end
if s7 == s8 then
if s8 == s9 then
if s7 == 1 then
ui.addTextArea(0, "<p align='center'><font size='15'><b><j></p><p align='center'><font size='40'> </p><p align='center'><font size='20'>"..p1n.."</p><p align='center'><font size='30'>Venceu!", p, 253, 50, 293, 293, 1, 0x0086F0, 0.6, true)
elseif s7 == 2 then
ui.addTextArea(0, "<p align='center'><font size='15'><b><j></p><p align='center'><font size='40'> </p><p align='center'><font size='20'>"..p2n.."</p><p align='center'><font size='30'>Venceu!", p, 253, 50, 293, 293, 1, 0x0086F0, 0.6, true) end
win=true
eventreset() end end
if s1 == s4 then
if s4 == s7 then
if s1 == 1 then
ui.addTextArea(0, "<p align='center'><font size='15'><b><j></p><p align='center'><font size='40'> </p><p align='center'><font size='20'>"..p1n.."</p><p align='center'><font size='30'>Venceu!", p, 253, 50, 293, 293, 1, 0x0086F0, 0.6, true)
elseif s1 == 2 then
ui.addTextArea(0, "<p align='center'><font size='15'><b><j></p><p align='center'><font size='40'> </p><p align='center'><font size='20'>"..p2n.."</p><p align='center'><font size='30'>Venceu!", p, 253, 50, 293, 293, 1, 0x0086F0, 0.6, true) end
win=true
eventreset() end end
if s2 == s5 then
if s5 == s8 then
if s2 == 1 then
ui.addTextArea(0, "<p align='center'><font size='15'><b><j></p><p align='center'><font size='40'> </p><p align='center'><font size='20'>"..p1n.."</p><p align='center'><font size='30'>Venceu!", p, 253, 50, 293, 293, 1, 0x0086F0, 0.6, true)
elseif s2 == 2 then
ui.addTextArea(0, "<p align='center'><font size='15'><b><j></p><p align='center'><font size='40'> </p><p align='center'><font size='20'>"..p2n.."</p><p align='center'><font size='30'>Venceu!", p, 253, 50, 293, 293, 1, 0x0086F0, 0.6, true) end
win=true
eventreset() end end
if s3 == s6 then
if s6 == s9 then
if s3 == 1 then
ui.addTextArea(0, "<p align='center'><font size='15'><b><j></p><p align='center'><font size='40'> </p><p align='center'><font size='20'>"..p1n.."</p><p align='center'><font size='30'>Venceu!", p, 253, 50, 293, 293, 1, 0x0086F0, 0.6, true)
elseif s3 == 2 then
ui.addTextArea(0, "<p align='center'><font size='15'><b><j></p><p align='center'><font size='40'> </p><p align='center'><font size='20'>"..p2n.."</p><p align='center'><font size='30'>Venceu!", p, 253, 50, 293, 293, 1, 0x0086F0, 0.6, true) end
win=true
eventreset() end end
if s1 == s5 then
if s5 == s9 then
if s1 == 1 then
ui.addTextArea(0, "<p align='center'><font size='15'><b><j></p><p align='center'><font size='40'> </p><p align='center'><font size='20'>"..p1n.."</p><p align='center'><font size='30'>Venceu!", p, 253, 50, 293, 293, 1, 0x0086F0, 0.6, true)
elseif s1 == 2 then
ui.addTextArea(0, "<p align='center'><font size='15'><b><j></p><p align='center'><font size='40'> </p><p align='center'><font size='20'>"..p2n.."</p><p align='center'><font size='30'>Venceu!", p, 253, 50, 293, 293, 1, 0x0086F0, 0.6, true) end
win=true
eventreset() end end
if s3 == s5 then
if s5 == s7 then
if s3 == 1 then
ui.addTextArea(0, "<p align='center'><font size='15'><b><j></p><p align='center'><font size='40'> </p><p align='center'><font size='20'>"..p1n.."</p><p align='center'><font size='30'>Venceu!", p, 253, 50, 293, 293, 1, 0x0086F0, 0.6, true)
elseif s3 == 2 then
ui.addTextArea(0, "<p align='center'><font size='15'><b><j></p><p align='center'><font size='40'> </p><p align='center'><font size='20'>"..p2n.."</p><p align='center'><font size='30'>Venceu!", p, 253, 50, 293, 293, 1, 0x0086F0, 0.6, true) end
win=true
eventreset() end end
if xm == 9 then
if win == false then
ui.addTextArea(0, "<p align='center'><font size='15'><b><j></p><p align='center'><font size='30'> </p><p align='center'><font size='25'> </p><p align='center'><font size='30'> </p><p align='center'><font size='30'>Deu Velha!", p, 253, 50, 293, 293, 1, 0x0086F0, 0.6, true)
eventreset() end end
ui.setMapName("Jogo da Velha")
ui.addTextArea(1, "<p align='center'><font size='13'><b><j>Jogador 1 (X)", p, 5, 131, 238, 21, 1, 0x0086F0, 0, true)
ui.addTextArea(2, "<p align='center'><font size='13'><b><j>Jogador 2 (O)", p, 557, 131, 238, 21, 1, 0x0086F0, 0, true)
if turn == 1 then
tfm.exec.addShamanObject(0, 121, 103, 0, 0, 0, false)
elseif turn == 2 then
tfm.exec.addShamanObject(0, 679, 103, 0, 0, 0, false) end
turntime=turntime+1 end
function eventPlayerLeft(p)
if p == p1n then
p1=false
ui.addTextArea(3, "<p align='center'><a href='event:p1'><font size='13'><b>Clique para jogar", n, 25, 160, 198, 21, 1, 0x0086F0, 0.6, true)
ui.addTextArea(3, "<p align='center'><font size='13'><b>Aguardando adversário", p2n, 25, 160, 198, 21, 1, 0x0086F0, 0, true)
elseif p == p2n then
p2=false
ui.addTextArea(4, "<p align='center'><a href='event:p2'><font size='13'><b>Clique para jogar", n, 577, 160, 198, 21, 1, 0x0086F0, 0.6, true)
ui.addTextArea(4, "<p align='center'><font size='13'><b>Aguardando adversário", p1n, 577, 160, 198, 21, 1, 0x0086F0, 0, true) end end
function eventTextAreaCallback(id, p, cmd)
if cmd == "p1" then
p1=true
p1n=p
ui.addTextArea(3, "<p align='center'><font size='13'><b>"..p.."", n, 25, 160, 198, 21, 1, 0x0086F0, 0.6, true)
if p2 == false then
ui.addTextArea(4, "<p align='center'><font size='13'><b>Aguardando adversário", p, 577, 160, 198, 21, 1, 0x0086F0, 0, true)
else
time=11
turn=math.random(1,2)
eventreset() end
elseif cmd == "p2" then
p2=true
p2n=p
if p1 == false then
ui.addTextArea(3, "<p align='center'><font size='13'><b>Aguardando adversário", p, 25, 160, 198, 21, 1, 0x0086F0, 0, true)
else
time=11
turn=math.random(1,2)
eventreset() end
ui.addTextArea(4, "<p align='center'><font size='13'><b>"..p.."", n, 577, 160, 198, 21, 1, 0x0086F0, 0.6, true) end end
function eventMouse(p, x, y)
if p == p1n and turn == 1 and turntime > 1 then
if x > 254 and x < 339 and y > 50 and y < 139 then
s1=1
ui.addTextArea(-1, "<p align='center'><font size='70'><b>X", n, 254, 50, 85, 89, 1, 0x0086F0, 0, true)
endturn1() end
if x > 335 and x < 425 and y > 50 and y < 139 then
s2=1
ui.addTextArea(-2, "<p align='center'><font size='70'><b>X", n, 355, 50, 90, 89, 1, 0x0086F0, 0, true)
endturn1() end
if x > 462 and x < 547 and y > 50 and y < 139 then
s3=1
ui.addTextArea(-3, "<p align='center'><font size='70'><b>X", n, 462, 50, 85, 89, 1, 0x0086F0, 0, true)
endturn1() end
if x > 254 and x < 339 and y > 156 and y < 245 then
s4=1
ui.addTextArea(-4, "<p align='center'><font size='70'><b>X", n, 254, 156, 85, 89, 1, 0x0086F0, 0, true)
endturn1() end
if x > 335 and x < 425 and y > 156 and y < 245 then
s5=1
ui.addTextArea(-5, "<p align='center'><font size='70'><b>X", n, 355, 156, 90, 89, 1, 0x0086F0, 0, true)
endturn1() end
if x > 462 and x < 547 and y > 156 and y < 245 then
s6=1
ui.addTextArea(-6, "<p align='center'><font size='70'><b>X", n, 462, 156, 85, 89, 1, 0x0086F0, 0, true)
endturn1() end
if x > 254 and x < 339 and y > 260 and y < 344 then
s7=1
ui.addTextArea(-7, "<p align='center'><font size='70'><b>X", n, 254, 260, 85, 84, 1, 0x0086F0, 0, true)
endturn1() end
if x > 335 and x < 425 and y > 260 and y < 344 then
s8=1
ui.addTextArea(-8, "<p align='center'><font size='70'><b>X", n, 355, 260, 90, 84, 1, 0x0086F0, 0, true)
endturn1() end
if x > 462 and x < 547 and y > 260 and y < 344 then
s9=1
ui.addTextArea(-9, "<p align='center'><font size='70'><b>X", n, 462, 260, 85, 84, 1, 0x0086F0, 0, true)
endturn1() end end
if p == p2n and turn == 2 and turntime > 1 then
if x > 254 and x < 339 and y > 50 and y < 139 then
s1=2
ui.addTextArea(-1, "<p align='center'><font size='70'><b>O", n, 254, 50, 85, 89, 1, 0x0086F0, 0, true)
endturn2() end
if x > 335 and x < 425 and y > 50 and y < 139 then
s2=2
ui.addTextArea(-2, "<p align='center'><font size='70'><b>O", n, 355, 50, 90, 89, 1, 0x0086F0, 0, true)
endturn2() end
if x > 462 and x < 547 and y > 50 and y < 139 then
s3=2
ui.addTextArea(-3, "<p align='center'><font size='70'><b>O", n, 462, 50, 85, 89, 1, 0x0086F0, 0, true)
endturn2() end
if x > 254 and x < 339 and y > 156 and y < 245 then
s4=2
ui.addTextArea(-4, "<p align='center'><font size='70'><b>O", n, 254, 156, 85, 89, 1, 0x0086F0, 0, true)
endturn2() end
if x > 335 and x < 425 and y > 156 and y < 245 then
s5=2
ui.addTextArea(-5, "<p align='center'><font size='70'><b>O", n, 355, 156, 90, 89, 1, 0x0086F0, 0, true)
endturn2() end
if x > 462 and x < 547 and y > 156 and y < 245 then
s6=2
ui.addTextArea(-6, "<p align='center'><font size='70'><b>O", n, 462, 156, 85, 89, 1, 0x0086F0, 0, true)
endturn2() end
if x > 254 and x < 339 and y > 260 and y < 344 then
s7=2
ui.addTextArea(-7, "<p align='center'><font size='70'><b>O", n, 254, 260, 85, 84, 1, 0x0086F0, 0, true)
endturn2() end
if x > 335 and x < 425 and y > 260 and y < 344 then
s8=2
ui.addTextArea(-8, "<p align='center'><font size='70'><b>O", n, 355, 260, 90, 84, 1, 0x0086F0, 0, true)
endturn2() end
if x > 462 and x < 547 and y > 260 and y < 344 then
s9=2
ui.addTextArea(-9, "<p align='center'><font size='70'><b>O", n, 462, 260, 85, 84, 1, 0x0086F0, 0, true)
endturn2() end end end
function endturn1()
xm=xm+1
turn=2
turntime=0 end
function endturn2()
xm=xm+1
turn=1
turntime=0 end

Admin
Admin

Mensagens : 24
Data de inscrição : 10/07/2017

https://tfmbry.directorioforuns.com

Ir para o topo Ir para baixo

Ir para o topo

- Tópicos semelhantes

 
Permissões neste sub-fórum
Não podes responder a tópicos