Jump to content

Function ?


GanJaRuleZ

Recommended Posts

Ok hai , i don't know how to do it , does there are any functions to get an account data ( client-side ) , cuz i don't find any ..

I want to make this script client-side one

  
addEventHandler("onPlayerLogin",root, 
function () 
    local localPlayerName = getPlayerName(getLocalPlayer()) 
    local raceWins = getAccountData(account,"Race Wins") 
    local raceLoses = getAccountData(account,"Race Loses") 
    local ratio = getAccountData(account, "Ratio") 
    if localPlayerName then 
        guiSetText ( label1, tostring(localPlayerName)) 
    else 
        guiSetText ( label1, Can't get name ) 
    if raceWins then 
        guiSetText ( label2, tostring(raceWins)) 
    else 
        guiSetText ( label2, 0)     
    if raceLoses then 
        guiSetText ( label3, tostring(raceLoses)) 
    else 
        guiSetText ( label3, tostring(ratio)) 
    if ratio then 
        guiSetText ( label3, 0) 
    else 
        guiSetText ( label3, -) 
end) 
  
 

Thanks

Link to comment

What about triggering client event with those datas ? Something like:

--SERVER SIDE 
addEventHandler( 'onPlayerLogin', root, function( _, acc ) 
  local raceWins = getAccountData( acc, 'Race Wins' ) 
  local raceLoses = getAccountData( acc, 'Race Loses' ) 
  local ratio = getAccountData( acc, 'Ratio' ) 
  triggerClientEvent( source, 'sendAccountData', root, raceWins, raceLoses, ratio ) 
end ) 
  
--CLIENT SIDE 
addEvent( 'sendAccountData', true ) 
addEventHandler( 'sendAccountData', root, function( wins, loses, ratio ) 
  --assuming your GUI window is open at that moment 
  guiSetText( label2, wins ) 
  guiSetText( label3, loses ) 
  guiSetText( label4, ratio ) --better create another one label, uh? 
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...