Jump to content

onPlayerQuit


WhoAmI

Recommended Posts

Posted

Hello there, I have problem

I have such a code

  
addEventHandler ( "onPlayerQuit", root, function () 
    if getElementData ( source, "imie" ) then 
        uid = tonumber ( getElementData ( source, "uid" ) ) 
        local x,y,z = getElementPosition ( source ) 
        local cash = getPlayerMoney ( source ) 
        local skin = getElementModel ( source ) 
        local hp = getElementHealth ( source ) 
        outputDebugString ( skin .. hp ) 
        dbExec ( db, "UPDATE Postacie SET portfel = '?', x = ?, y = ?, z = ?, skin = '?', hp = '?' WHERE uid = '?'", tonumber(cash), x, y, z, tonumber(skin), hp, uid ) 
    end 
end) 
  

And the 'skin' and 'hp' output '0' and it saves so in database. When I spawn again I'm dead. Is it problem in my code or it is only bug of this event?

Posted

The health and model functions shouls return the correct values, even on quit. Make sure that no other scripts are changing them.

Also, does it return the position and the money correctly?

Posted

Yea, It does. Everything works fine instead of this two. I'm pretty sure that other scripts don't change those values. I'm not amateur scripter and I'm really confused about this.

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