Baseplate Posted November 12, 2012 Share Posted November 12, 2012 Well here is my code for now, I want it to make someone have a wanted star when he kills someone and it outputs it on Scoreboard at WL Column Script: function wanted( ammo, attacker, weapon, bodypart ) if (attacker) and (attacker ~=source) then setPlayerWantedLevel ( attacker, getPlayerWantedLevel( attacker )+1 ) else local wanted = getPlayerWantedLevel( source ) setTimer(setPlayerWantedLevel, 60, 1, source, wanted) end end addEventHandler ( "onPlayerWasted", getRootElement(), wanted ) function showScoreWanted ( ammo, attacker, weapon, bodypart ) if (attacker) and (attacker ~=source) then local wanted = getPlayerWantedLevel ( attacker ) setElementData(attacker, "WL", tostring(wanted)) end end addEventHandler ( "onPlayerWasted", getRootElement(), showScoreWanted) Link to comment
myonlake Posted November 12, 2012 Share Posted November 12, 2012 (edited) You need to have the column set in the script as well Sorry for the new structure. I just like to do all scripts with my own layout style Server-side exports.scoreboard:scoreboardAddColumn("Wanted level") addEventHandler("onPlayerWasted", root, function(ammo, attacker, weapon, bodypart) if (attacker) and (attacker ~= source) then setPlayerWantedLevel(attacker, getPlayerWantedLevel(attacker)+1) setElementData(attacker, "Wanted level", tostring(getPlayerWantedLevel(attacker))) else setTimer(setPlayerWantedLevel, 60, 1, source, getPlayerWantedLevel(source)) end end ) EDIT: However, why do you use this even if you don't need it necessarily? setTimer(setPlayerWantedLevel, 60, 1, source, getPlayerWantedLevel(source)) It sets the same wanted level as the player has, doesn't make sense to me. Edited November 12, 2012 by Guest Link to comment
Baseplate Posted November 12, 2012 Author Share Posted November 12, 2012 (edited) Thanks for the reply, I already made the Column, I'll test it and i'll be back Edited November 12, 2012 by Guest Link to comment
myonlake Posted November 12, 2012 Share Posted November 12, 2012 Thanks for the reply, I already made the Column, I'll test it and i'll be right back Check my code again by the way. Link to comment
Baseplate Posted November 12, 2012 Author Share Posted November 12, 2012 EDIT: However, why do you use this even if you don't need it necessarily? setTimer(setPlayerWantedLevel, 60, 1, source, getPlayerWantedLevel(source)) It sets the same wanted level as the player has, doesn't make sense to me. That's to save the wanted levels on death Link to comment
myonlake Posted November 12, 2012 Share Posted November 12, 2012 Oh, cool. I didn't know about that issue since haven't been working with wanted levels lately Thanks for the info. 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