Jump to content

|Question| How to create a Gamemode


Kaos

Recommended Posts

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
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
...

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
...
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 :roll:

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...