Jump to content

Help with a code


novo

Recommended Posts

Hi all.

I want get with local x,y,z the position of where the player spawns on map start.

The server-side function is:

addEvent("onClientTrainingModeEnter", true) 
addEventHandler("onClientTrainingModeEnter", root,  
function() 
local x,y,z = getSpawnPostion() 
    spawnPlayer (source, x, y, z) 
end 
) 

Here is the client-side function:

function enterTraining() 
if not isChatBoxInputActive() and not isConsoleActive() then 
    unbindKey("enter", "down", enterTraining) 
    removeEventHandler("onClientRender", root, drawTrainingText ) 
    if #checkPoints > 1 then table.remove(checkPoints, #checkPoints) end 
    triggerServerEvent("onClientTrainingModeEnter", me, checkPoints[#checkPoints]) 
end 
end 

I want get the spawn position with this:

local x,y,z = getSpawnPostion()

But i don't know wich is the correct syntax to get it. I don't know if it's getSpawnPostion().

Please help me :S

Link to comment

It's not working xD

EDIT:

addEvent("onClientTrainingModeEnter", true) 
addEventHandler("onClientTrainingModeEnter", root,  
function() 
local vehicles = getElementsByType ( "vehicle" ) 
for vehicleKey, vehicleValue in ipairs(vehicles) do 
local x, y = getVehicleTurretPosition ( vehicleValue ) 
    spawnPlayer (source, x, y, z) 
end 
end 
) 
  
  

I think that's the correct syntax to get it.

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