Jump to content

Wanted Level column


Baseplate

Recommended Posts

Samer, I wouldn't listen to him, as far as I can see from his/her post's is... he's trying to get his post count higher, nothing more.

And now, back in topic:

You are creating a column in the scoreboard, but about the setElementData, thePlayer has to be a valid element, is this your full script?

Link to comment
call(getResourceFromName("dxscoreboard"), "addScoreboardColumn", "wanted level") 
  
addEventHandler("onPlayerWasted",root, 
function (_,killer) 
     if killer == source then return end 
     setElementData ( killer, "wanted level", 3 ) 
end) 

Should give the killer 3 wanted stars.

Link to comment

If you want to show the wanted score in the scoreboard you should use

call(getResourceFromName("dxscoreboard"),"addScoreboardColumn","Wanted Level",root,70) 
  
function check() 
    for w in ipairs(getElementsByType('player')) do 
        local wanted = getPlayerWantedLevel(w) 
        setElementData(w,"Wanted Level",wanted ) 
    end 
setTimer(check, 10000, 0) 

This will check every player wanted level and show it in that colum.

Link to comment

Nop, that won't work Axel, the 'for' loop is wrong.

call(getResourceFromName("dxscoreboard"), "addScoreboardColumn", "wanted level") 
  
function check() 
    for index, player in ipairs(getElementsByType("player")) do 
        local wanted = getPlayerWantedLevel(player) 
        setElementData(player,"Wanted level", tostring(wanted)) 
    end 
setTimer(check, 10000, 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...