Big Smoker Posted August 3, 2019 Share 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) Link to comment
Other Languages Moderators androksi Posted August 3, 2019 Other Languages Moderators Share 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 ) Link to comment
Big Smoker Posted August 4, 2019 Author Share Posted August 4, 2019 nao deu certo ainda ta repetindo o mesma linha da cordenada, queria que fosse em sequencia Link to comment
Other Languages Moderators Lord Henry Posted August 4, 2019 Other Languages Moderators Share 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. Link to comment
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