Kaos Posted August 12, 2016 Share Posted August 12, 2016 Hello Guys i´ve got some questions about how to create a gamemode, i just dunno how can í create 3 spawns like on a play server but without freeroam resource and different locations. Can you help me with examples? Link to comment
kashtesov Posted August 12, 2016 Share Posted August 12, 2016 local positions = { -- {x,y,z[,rot]}, } function randomSpawn(player) local postab = positions[math.random(1,#positions)] local x,y,z,rot = postab[1],postab[2],postab[3],postab[4] or 0 spawnPlayer(player,x,y,z,rot) end call random spawn from join, wasted events Link to comment
Kaos Posted August 12, 2016 Author Share Posted August 12, 2016 local positions = { -- {x,y,z[,rot]}, } function randomSpawn(player) local postab = positions[math.random(1,#positions)] local x,y,z,rot = postab[1],postab[2],postab[3],postab[4] or 0 spawnPlayer(player,x,y,z,rot) end call random spawn from join, wasted events Thank you. Link to comment
EstrategiaGTA Posted August 12, 2016 Share Posted August 12, 2016 ... You could also use: unpack (table) Instead of: table[1], table[2] --... local positions = { -- {x,y,z[,rot]}, } function randomSpawn(player) local postab = positions[math.random(1,#positions)] local x,y,z,rot = unpack (postab, 1, 3) local rot = postab[4] or 0 spawnPlayer(player,x,y,z,rot) end Link to comment
kashtesov Posted August 13, 2016 Share Posted August 13, 2016 ... local positions = { -- {x,y,z[,rot]}, } function randomSpawn(player) local postab = positions[math.random(1,#positions)] local x,y,z,rot = unpack (postab, 1, 3) local rot = postab[4] or 0 spawnPlayer(player,x,y,z,rot) end You right i hope both variants will be useful for topic author Link to comment
Bonus Posted August 13, 2016 Share Posted August 13, 2016 The unpack version is slower than the first solution. So better use the first solution, not the one with unpack. Don't forget to use fadeCamera and setCameraTarget. Link to comment
Kaos Posted August 20, 2016 Author Share Posted August 20, 2016 It was usefull , thank you for all 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