Nikolay_888 Posted July 27, 2015 Posted July 27, 2015 Hello. I want to script respawn player in the same place, where he wasted. I scripted this: function playerWasted () setTimer (function (source) local x,y,z = getElementPosition(source) spawnPlayer(source, x, y, z) end, 10000, 1, source) end addEventHandler ("onPlayerWasted", root, playerWasted) But this script doesn't work well in some situations. For example, if the player wasted in the blown up moving car or helicopter, getElementPosition returns coordinates, that was in the moment of blow, notwithstanding function run after timer 10 sec. So if the player wasted in flying helicopter, he will respawn in the sky. What to do to getElementPosition work well in these situations. Thank you.
GTX Posted July 27, 2015 Posted July 27, 2015 If you want to spawn player on ground, use: getGroundPosition -- OR processLineOfSight
Nikolay_888 Posted July 27, 2015 Author Posted July 27, 2015 Thank you, GTX. I didn't know about this functions.
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