novo Posted December 10, 2011 Share Posted December 10, 2011 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 Link to comment
CapY Posted December 10, 2011 Share Posted December 10, 2011 " getSpawnPostion" Is not the function. EDIT: But getElementPosition Is. Use that instead. Link to comment
novo Posted December 10, 2011 Author Share Posted December 10, 2011 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. Link to comment
novo Posted December 10, 2011 Author Share Posted December 10, 2011 So, it must be: local x,y,z = getElementPosition() or ? PD: I'm noob at lua.. Link to comment
CapY Posted December 10, 2011 Share Posted December 10, 2011 Try it and you will know. Link to comment
novo Posted December 10, 2011 Author Share Posted December 10, 2011 It's not working 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
CapY Posted December 10, 2011 Share Posted December 10, 2011 TEST THE CODE, and you will see what happens. novo said: It's not working You can't just say "It's not working", give us some debug output. Link to comment
BinSlayer1 Posted December 10, 2011 Share Posted December 10, 2011 Code's too messy. Please rephrase what you want the script to do EXACTLY Link to comment
Evil-Cod3r Posted December 10, 2011 Share Posted December 10, 2011 addEvent("onClientTrainingModeEnter", true) addEventHandler("onClientTrainingModeEnter", root, function() local x,y,z = getElementPosition( source ) spawnPlayer (source, x, y, z) end ) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now