Jump to content

Wanted Level column


Baseplate

Recommended Posts

Posted
call(getResourceFromName("dxscoreboard"), "addScoreboardColumn", "wanted level") 
setElementData ( thePlayer, "wanted level", 3 ) 

is this code is right to show Wanted Level column in dxscoreboard??

Posted

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?

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

Posted

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.

Posted

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) 

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