Jump to content

help fast


MAB

Recommended Posts

How to create a table of locations and randomly when the player joins the game...he get spawned a one of the locations of the table?! i tried this but didn't work

locations = { 
[1] = "-375.14301 2192.22534 42.03526", 
[2] = "-371.94513 2206.79468 42.41978" 
} 
function spawn () 
local x,y,z = math.random (1,2) 
spawnPlayer ( source,x.y,z ) 
addEventHandler ( "onPlayerJoin", getRootElement(), spawn)  

Link to comment

try this

locations = { 
{ posX = -375.14301, posY = 2192.22534, posZ = 42.03526}, 
{ posX = -371.94513, posY = 2206.79468, posZ = 42.41978}, 
} 
function spawn () 
setElementData(source,"random",math.random(1,2)) 
rand = getElementData(source,"random") 
spawnPlayer ( source, locations[rand].posX, locations[rand].posY, locations[rand].posZ ) 
addEventHandler ( "onPlayerJoin", getRootElement(), spawn) 

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