Jump to content

Question elementdata


Bean666

Recommended Posts

uhm just a question

will this set the player's ElementData to "tough" when he clicks the button "button"?

function toughperk( ) 
if (source == localPlayer) then 
setElementData(localPlayer,"tough", true) 
end 
end 
addEventHandler ( "onClientGUIClick", button, toughperk ) 

Link to comment

nvm it works fine when i used:

function quitPlayer () 
    local account = getPlayerAccount (source) 
    local data = getElementData(source, "toughperk") 
    if data == true then 
    setAccountData (account, "toughperk", true ) 
end 
end 
addEventHandler ( "onPlayerQuit", getRootElement(), quitPlayer ) 
  
addEventHandler ( 'onPlayerLogin', getRootElement ( ), 
    function ( _, theCurrentAccount) 
    local ifaccountperk = getAccountData(theCurrentAccount, "toughperk") 
    if ifaccountperk == true then 
    setElementData(source,"toughperk", true) 
    setAccountData (account, "toughperk", false ) 
    else 
    setElementData(source,"toughperk", false) 
end 
end 
) 

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