Jump to content

Custom scoreboard column


CallumD

Recommended Posts

Posted

I am trying to add a column on scoreboard to show all players' wanted level. I have managed to add the column (called "wanted") but I don't get how to keep the column up-to-date with the latest wanted levels of every player. I get how to setElementData but I don't get how to trigger it. There is no event for when you become wanted.

Posted

Make one yourself then (addEvent).

Scoreboard updates the column by itself. All you need to do is add new column (you've already done this) and setElementData with the same key as the column name.

Posted

i know this is not perfect, but it should work

function getwanted()
setTimer(dely, 100, 1)
local players = getElementsByType ( "player" ) 
for theKey,thePlayer in ipairs(players) do 
local level = getPlayerWantedLevel ( thePlayer )
setElementData ( thePlayer, "wanted", level )
end
end
function dely()
getwanted()
end
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), getwanted )

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