Kaos Posted August 12, 2016 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? Kaos MTA Server:mtasa://163.172.27.127:22003
kashtesov Posted August 12, 2016 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 MTA DayZ Ultimate: http://vk.com/bsmta [WIP] MTA Wasteland: http://vk.com/mta_wasteland [WIP] MTA PortMaker: http://vk.com/mta_ports
Kaos Posted August 12, 2016 Author 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. Kaos MTA Server:mtasa://163.172.27.127:22003
EstrategiaGTA Posted August 12, 2016 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
kashtesov Posted August 13, 2016 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 MTA DayZ Ultimate: http://vk.com/bsmta [WIP] MTA Wasteland: http://vk.com/mta_wasteland [WIP] MTA PortMaker: http://vk.com/mta_ports
Bonus Posted August 13, 2016 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.
Kaos Posted August 20, 2016 Author Posted August 20, 2016 It was usefull , thank you for all Kaos MTA Server:mtasa://163.172.27.127:22003
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