Jump to content

[HELP] How to getElementData onPlayerQuit


BanNsS1

Recommended Posts

How can i getElementData onPlayerQuit?

On player spawn the server updates the database and set "online" = 1 to the player who spawn.

I would like that on player quit the server updates the database and set online to 0.

To do it i've to get the character DATABASE ID which sets as a ElementData. When i try to getElementData(thePlayer, "databaseid") in the event onPlayerQuit it returns false.

How can i do?

Link to comment

Look, if i declare these functions (with the events):

  
function onPlayerSpawn() 
setElementData(source, "databaseid", charSelected) -- charSelected is declared when you select the character you want to use from your character list. 
end 
  
function onPlayerQuit() 
outputChatBox(getElementData(source, "databaseid")) 
end 

When a player quits, the outputChatBox shows "false".

EDIT: I tested it again and it works. Excuse me. Thanks so much!

Edited by Guest
Link to comment
Guest Guest4401
Lol... have you read my post? I tried it but the var "id" returns false!

Yes I had read your post, where you were using thePlayer instead of source which is wrong.

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