Jump to content

Help with a code


novo

Recommended Posts

Posted

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

Posted

CapY, i want know what should i type on the side of it.

I know that it is not working, i want to know the correct syntax to add.

Posted

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.

Posted

TEST THE CODE, and you will see what happens.

It's not working xD

You can't just say "It's not working", give us some debug output.

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

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