Jump to content

Random Spawn Help!


Recommended Posts

Hey guys, im attempt to index field '?' ( a number value ) on the Spawn[mathed].X, can anybody help me out?

  
local Spawned = #Aspawn 
local mathed = math.random(Spawned) 
spawnPlayer(player, ASpawn[mathed].X, ASpawn[mathed].Y, ASpawn[mathed].Z) 
  

Table:

  
ASpawn = { 
        { X = 4853.3422851563, Y = -1423.1859130859, Z = 6.1449999809265 }, 
        { X = 4822.6494140625, Y = -1435.6208496094, Z = 6.1978998184204 }, 
        { X = 4872.5166015625, Y = -1423.2080078125, Z = 6 }, 
        { X = 4869.5439453125, Y = -1434.0322265625, Z = 6 }, 
        { X = 4900.1625976563, Y = -1445.7026367188, Z = 3.2283999919891 }, 
        { X = 4889.5844726563, Y = -1437.6313476563, Z = 6.6807999610901 }, 
        { X = 4868, Y = -1441.8647460938, Z = 9.2 }, 
    } 

EDIT: It worked alone now, somehow..

Link to comment

Try this:

ASpawn = { 
    { ['X'] = 4853.3422851563, ['Y'] = -1423.1859130859, ['Z'] = 6.1449999809265 }, 
    { ['X'] = 4822.6494140625, ['Y'] = -1435.6208496094, ['Z'] = 6.1978998184204 }, 
    { ['X'] = 4872.5166015625, ['Y'] = -1423.2080078125, ['Z'] = 6 }, 
    { ['X'] = 4869.5439453125, ['Y'] = -1434.0322265625, ['Z'] = 6 }, 
    { ['X'] = 4900.1625976563, ['Y'] = -1445.7026367188, ['Z'] = 3.2283999919891 }, 
    { ['X'] = 4889.5844726563, ['Y'] = -1437.6313476563, ['Z'] = 6.6807999610901 }, 
    { ['X'] = 4868, ['Y'] = -1441.8647460938, ['Z'] = 9.2 }, 
} 
  
  
  
function randomlySpawnPlayer ( player ) 
    local data = ASpawn[math.random(#Aspawn)] 
    spawnPlayer(player, data['X'], data['Y'], data['Z'] ) 
end 

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