CallumD Posted November 15, 2009 Share Posted November 15, 2009 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. Link to comment
50p Posted November 15, 2009 Share Posted November 15, 2009 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. Link to comment
Wojak Posted November 15, 2009 Share Posted November 15, 2009 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 ) Link to comment
CallumD Posted November 15, 2009 Author Share Posted November 15, 2009 Thanks, Wojak. That worked. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now