• Get money from players who disconnect
    6 replies, posted
I need to get the amount of money a player have when he leave the server. This is how I tried to do it: hook.Add( "PlayerPlayerDisconnected", "Disconnect", function( ply )     local money = ply:getDarkRPVar("money")     print( money ) end ) I don't really know how to do it or if it's even possible.
PlayerPlayerDisconnected is not a real hook, you know that? its PlayDisconnected
My bad :/
also you shouldntg call the hook "Disconnect". Im sure this name is already used by gmod somewhere. Use something more descriptive for your own feature. Like "GetMoneyAmount"
Thanks for the tip ^^
It should work with GM/PlayerDisconnected because the player object is still valid at the time the hook gets called but I don't know about getDarkRPVar. If it does not work, you can still use sql.Query to get the player's wallet/money from the database.
getDarkRPVar does work ^^
Sorry, you need to Log In to post a reply to this thread.