TheIceman1 Posted February 25, 2013 Share Posted February 25, 2013 Why this dont show me my arrests on scoreboard? exports [ 'scoreboard' ]:addScoreboardColumn ( 'Arrests' ) addEventHandler("onPlayeDamage",root, function (attacker, weapon) local weap = getWeaponNameFromID(3) local skin = getElementModel ( attacker ) local team = getTeamFromName( getPlayerTeam ( attacker ) ) local wl = getPlayerWantedLevel ( source ) if (skin == 280 ) and ( team == "Police" ) and ( wl > 0 ) and ( weap == 3 ) then addPlayerArrests(attacker) end end) function addPlayerArrests(attacker) local account = getPlayerAccount(attacker) if isGuestAccount(account) then return end local arrests = getAccountData(account,"Arrests") if not arrests then setAccountData(account,"Arrests",0) end setAccountData(account,"Arrests",tonumber(arrests)+1) end addEventHandler("onPlayerLogin",root, function () local account = getPlayerAccount(source) if isGuestAccount(account) then return end local arrests = getAccountData(account,"Arrests") if arrests then setElementData(source,"Arrests",tostring(arrests)) else setElementData(source,"Arrests",0) end end) Link to comment
csiguusz Posted February 25, 2013 Share Posted February 25, 2013 Do this: setElementData( somePlayer, "Arrests", "what you type will be showed in the Arrests column next to the given player's name" ) Link to comment
TheIceman1 Posted February 25, 2013 Author Share Posted February 25, 2013 Do this: setElementData( somePlayer, "Arrests", "what you type will be showed in the Arrests column next to the given player's name" ) Where to put it? Link to comment
Jaysds1 Posted February 25, 2013 Share Posted February 25, 2013 try this: exports [ 'scoreboard' ]:addScoreboardColumn ( 'Arrests' ) addEventHandler("onPlayeDamage",root,function (attacker, weapon) -- local weap = getWeaponNameFromId(weapon) --this would return the name not the id local skin = getElementModel ( attacker ) local team = getTeamFromName( getPlayerTeam ( attacker ) ) local wl = getPlayerWantedLevel ( source ) if (skin == 280 ) and ( team == "Police" ) and ( wl > 0 ) and ( weapon == 3 ) then addPlayerArrests(attacker) end end) function addPlayerArrests(attacker) local account = getPlayerAccount(attacker) if isGuestAccount(account) then return end local arrests = getAccountData(account,"Arrests") or 0 setAccountData(account,"Arrests",tonumber(arrests)+1) setElementData(attacker,"Arrests",tonumber(arrests)+1) end addEventHandler("onPlayerLogin",root,function(_,account) --get the players account if isGuestAccount(account) then return end local arrests = getAccountData(account,"Arrests") or 0 --if there's no arrests data then return 0 setElementData(source,"Arrests",tostring(arrests)) end) EDITTED!!! 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