Jump to content

Refreshing Class on Custom Scoreboard


Recommended Posts

Posted

I made a custom scoreboard, and I have set element data's but I am trying to refresh it on my scoreboard, because if player changes class then it should change on scoreboard -

I get no errors -

Client Side

function refresh() 
data = getElementData(getLocalPlayer(), "Class") 
end 
setTimer ( refresh, 51, 0 ) 
  
dxDrawText(data, classx, y+i*20.5) 
  

It's frozen as the previous class and doesnt change

Posted
addEventHandler("onClientRender", getRootElement(), function() 
    dxDrawText(getElementData(getLocalPlayer(), "Class"), classx, y+i*20.5); 
end); 

much better! :)

Posted
I dont need client renders,

I wanted to know if that was the right way to refresh the element data, I have my renders already.

You didn't got me, instead of refreshing the data by a timer you can just replace data variable with "getElementData(getLocalPlayer(), "Class")" in your event.

onClientRender event is already like a timer that update enywhere from 25-100 (depends of how many fps you have) times a second.

Posted

Nevermind I found out that my problem was I was using setAccountData, and doing getElementData, but how can I make getElementData permanent like save it, so player still has it after reconnect?

Posted

all what you need is :

-- Function  
getElementData() 
setElementData() 
getAccountData() 
setAccountData() 
  
-- Events 
onPlayerQuit 
onPlayerLogin 

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