Jump to content

getElementPosition after onPlayerWasted


Recommended Posts

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

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