Jump to content

Score in the scoreboard.


Recommended Posts

Hello,

I'm looking for a script which add a 'Score' column in the scoreboard which show the score of the player (when he wins a race, he become points and they are visible in the scoreboard). + the scores are saved with the account.

I can't find this resources anywhere, can someone help me please? :)

Thank's

Link to comment

try. I didn't test it so it's not 100% that will work...

exports [ 'scoreboard' ]:addScoreboardColumn ( "Points" ) 
  
function onRaceFinish( rank ) 
local acc = getPlayerAccount( source ) 
local ptzData = getAccountData( acc, "Points" ) 
    if rank == 1 then 
        if ptzData then 
        setAccountData( acc, "Points", ptzData + 1 ) 
        else 
        setAccountData( acc, "Points", 1 ) 
        end 
    end 
end 
addEventHandler("onPlayerFinish", getRootElement(), onRaceFinish) 
  
function refreshData() 
 for k, v in ipairs (getElementsByType("player")) do 
 local data = getAccountData(getPlayerAccount( v ), "Points" ) 
  if data then 
  setElementData( v, "Points", data ) 
  end 
 end 
end 
setTimer( refreshData, 1000, 0 ) 

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