Big Smoker Posted August 3, 2019 Posted August 3, 2019 Boa Noite, Precisava de uma ajuda. Tenho uma função que ela manda coodenadas aleatorios quando jogador vai respwanar so que como é aleario ele repete aquela linha, queria fazer com que ela faz com linha exemplo, 1,2,3,4,5 ai depois do 5 volta para o 1 Tabela client.Lua spawnPositionslv = { {2926,681,1000}, {1876,633,1000}, {1193,1125,1000}, {1927,2028,1000}, {2682,2299,1000}, {1887,2654,1000}, {918,2491,1000} } local lvs = math.random(#spawnPositionslv) local x,y,z = spawnPositionslv[lvs][1],spawnPositionslv[lvs][2],spawnPositionslv[lvs][3] spawnPlayer (player, x,y,z+0.5, math.random(0,360), 0, 0, 0)
androksi Posted August 3, 2019 Posted August 3, 2019 local spawns = { {2926, 681, 1000}, {1876, 633, 1000}, {1193, 1125, 1000}, {1927, 2028, 1000}, {2682, 2299, 1000}, {1887, 2654, 1000}, {918, 2491, 1000} } local current = 0 function spawn(p) current = math.min(current + 1, #spawns) local x, y, z = spawns[current][1], spawns[current][2], spawns[current][3] fadeCamera(p, true) spawnPlayer(p, x, y, z, 360, 0, 0, 0) if current == #spawns then current = 0 end end addEventHandler('onPlayerWasted', root, function() setTimer(spawn, 2000, 1, source) end ) Hello, world. Tutorial sobre interação de BOTs do Discord com o seu servidor - Visitar (Brazilian Portuguese) Tutorial sobre tabelas - Visitar (Brazilian Portuguese) Tutorial sobre banco de dados - Visitar (Brazilian Portuguese)
Big Smoker Posted August 4, 2019 Author Posted August 4, 2019 nao deu certo ainda ta repetindo o mesma linha da cordenada, queria que fosse em sequencia
Moderators Lord Henry Posted August 4, 2019 Moderators Posted August 4, 2019 (edited) local spawns = { {2926, 681, 1000}, {1876, 633, 1000}, {1193, 1125, 1000}, {1927, 2028, 1000}, {2682, 2299, 1000}, {1887, 2654, 1000}, {918, 2491, 1000} } local current = 0 function spawn(p) if (current < #spawns) then current = current + 1 else current = 1 end local x, y, z = spawns[current][1], spawns[current][2], spawns[current][3] fadeCamera (p, true) spawnPlayer (p, x, y, z) end addEventHandler ("onPlayerWasted", root, function() setTimer(spawn, 2000, 1, source) end) Edited August 4, 2019 by Lord Henry Correção de indentação. Eu te ajudei ou achou meu comentário útil? Não esqueça de deixar um Thanks! Minhas contribuições para a comunidade: LordHenry - MTA Wiki Profile Inscreva-se no meu canal do YouTube: Lord Henry - Entertainment Discord Oficial do MTA: https://mtasa.com/discord Blacklist e Whitelist de Scripters: Planilha Por favor, não me envie mensagens privadas solicitando suporte. Crie um tópico no fórum em vez disso.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now