Jump to content

Need help for make level in scoreboard


rbb27

Recommended Posts

Hi. On my server, i use one level system(Zombie Apocalypse by benxamix2) and i wana see the value on the scoreboard

I try modify scoremoney by prascic but the script don't running. The level is in database : "rank"

<< getAccountData(player,"rank") >>

Server Side Script :

addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), 
    function() 
        call(getResourceFromName("scoreboard"),"addScoreboardColumn","Level") 
    end 
) 
  

and client side :

  
local starttick, currenttick 
local player = getLocalPlayer() 
addEventHandler("onClientRender",getRootElement(), 
    function() 
        if not starttick then 
            starttick = getTickCount() 
        end 
        currenttick = getTickCount() 
        if currenttick - starttick >= 1000 then 
     local mylevel = getAccountData(player,"rank") 
            setElementData(player,"Level",mylevel ) 
            starttick =  getTickCount() 
        end 
    end 
) 
function updateMoney() 
    for k, v in ipairs(getElementsByType('player')) do 
         local level = getAccountData(player,"rank")(v) 
        setElementData(v,"Level",level ) 
    end 
end 
setTimer(updateMoney, 1000000, 0) 
  

Can You Help Me for that? Thank, Rbb27

Link to comment

and you need to get player account and after the account data like

local account= getPlayerAccount(player) 
local level= getAccountData(account,"level") 
  

but this functions are only serer side (Account functions)

i think this make the work

call(getResourceFromName("scoreboard"),"addScoreboardColumn","Level")  
  
function level() 
for i,v in pairs(getElementsByType("player")) do 
local account = getPlayerAccount(v) 
if not account or isGuestAccount(account) then 
setElementData(v,"Level","Login!") 
else 
local level = getAccountData(account,"rank") 
setElementData(v,"Level",level) 
end 
end 
end 
setTimer(level,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...