-.Paradox.- Posted July 22, 2013 Posted July 22, 2013 Hello all,i made this but don't want to work, here is the code: exports.scoreboard:addScoreboardColumn('Rank') addEventHandler("onPlayerSpawn",root, function() local account = getPlayerAccount(source) local kills = getAccountData(account,"kills") if (kills >= 0) and (kills <= 4) then setElementData(source,"Rank","ranks/1.png") elseif (kills >= 5) and (kills <= 99) then setElementData(source,"Rank","ranks/2.png") elseif (kills >= 100) and (kills <= 249) then setElementData(source,"Rank","ranks/3.png") elseif (kills >= 250) and (kills <= 499) then setElementData(source,"Rank","ranks/4.png") elseif (kills >= 500) and (kills <= 999) then setElementData(source,"Rank","ranks/5.png") elseif (kills >= 1000) and (kills <= 1499) then setElementData(source,"Rank","ranks/6.png") elseif (kills >= 1500) and (kills <= 1999) then setElementData(source,"Rank","ranks/7.png") elseif (kills >= 2000) and (kills <= 2999) then setElementData(source,"Rank","ranks/8.png") elseif (kills >= 3000) and (kills <= 3999) then setElementData(source,"Rank","ranks/9.png") end end ) addEventHandler("onPlayerSpawn",root, function () local account = getPlayerAccount(source) if isGuestAccount(account) then return end local Rank = getAccountData(account,"Rank") if Rank then setElementData(source,"Rank", Rank) end end ) and add to score board line Rank = getElementData(source,"Rank") if Rank then setElementData(source,"Rank",":Script/Ranks/"..Rank..".png") end end Thanks....i hope somebody help
Alen141 Posted July 22, 2013 Posted July 22, 2013 use call(getResourceFromName("scoreboard"), "addScoreboardColumn", "Rank") instead of exports.scoreboard:addScoreboardColumn('Rank')
iMr.3a[Z]eF Posted July 22, 2013 Posted July 22, 2013 use call(getResourceFromName("scoreboard"), "addScoreboardColumn", "Rank") instead of exports.scoreboard:addScoreboardColumn('Rank') As he said, try this. call(getResourceFromName("scoreboard"), "addScoreboardColumn", "Rank") addEventHandler("onPlayerSpawn",root, function() local account = getPlayerAccount(source) local kills = getAccountData(account,"kills") if (kills >= 0) and (kills <= 4) then setElementData(source,"Rank","ranks/1.png") elseif (kills >= 5) and (kills <= 99) then setElementData(source,"Rank","ranks/2.png") elseif (kills >= 100) and (kills <= 249) then setElementData(source,"Rank","ranks/3.png") elseif (kills >= 250) and (kills <= 499) then setElementData(source,"Rank","ranks/4.png") elseif (kills >= 500) and (kills <= 999) then setElementData(source,"Rank","ranks/5.png") elseif (kills >= 1000) and (kills <= 1499) then setElementData(source,"Rank","ranks/6.png") elseif (kills >= 1500) and (kills <= 1999) then setElementData(source,"Rank","ranks/7.png") elseif (kills >= 2000) and (kills <= 2999) then setElementData(source,"Rank","ranks/8.png") elseif (kills >= 3000) and (kills <= 3999) then setElementData(source,"Rank","ranks/9.png") end end ) addEventHandler("onPlayerSpawn",root, function () local account = getPlayerAccount(source) if isGuestAccount(account) then return end local Rank = getAccountData(account,"Rank") if Rank then setElementData(source,"Rank", Rank) end end ) If it doesn't work, what is debug says?.
DNL291 Posted July 22, 2013 Posted July 22, 2013 call(getResourceFromName("scoreboard"), "addScoreboardColumn", "Rank") And exports.scoreboard:addScoreboardColumn('Rank') Will not make any difference.
iMr.3a[Z]eF Posted July 22, 2013 Posted July 22, 2013 But the 1st one is make the code easier for beginner scripter.
DNL291 Posted July 22, 2013 Posted July 22, 2013 But the 1st one is make the code easier for beginner scripter. I did not mean it. Both will do the same thing and it's not the problem.
DNL291 Posted July 22, 2013 Posted July 22, 2013 (edited) @StevyDK: Try this: exports.scoreboard:addScoreboardColumn('Rank') addEventHandler("onPlayerLogin", root, function(_, account) local kills = getAccountData(account, "kills") if kills then if (kills >= 0) and (kills <= 4) then setElementData(source,"Rank","ranks/1.png") elseif (kills >= 5) and (kills <= 99) then setElementData(source,"Rank","ranks/2.png") elseif (kills >= 100) and (kills <= 249) then setElementData(source,"Rank","ranks/3.png") elseif (kills >= 250) and (kills <= 499) then setElementData(source,"Rank","ranks/4.png") elseif (kills >= 500) and (kills <= 999) then setElementData(source,"Rank","ranks/5.png") elseif (kills >= 1000) and (kills <= 1499) then setElementData(source,"Rank","ranks/6.png") elseif (kills >= 1500) and (kills <= 1999) then setElementData(source,"Rank","ranks/7.png") elseif (kills >= 2000) and (kills <= 2999) then setElementData(source,"Rank","ranks/8.png") elseif (kills >= 3000) and (kills <= 3999) then setElementData(source,"Rank","ranks/9.png") end end end) Edited July 22, 2013 by Guest
TAPL Posted July 22, 2013 Posted July 22, 2013 @DNL291, You forget the bracket after the 'end' at line 27.
-.Paradox.- Posted July 23, 2013 Author Posted July 23, 2013 Gonna try....thanks all for youre help but i want add column to scoreboard for it elseif column.name == "Rank" then column.width = 20 dxDrawImage( topX+theX, y+s(1), 16, 11, content, 0, 0, 0, cWhite, drawOverGUI )
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