CheiN Posted August 16, 2012 Share Posted August 16, 2012 function Ranks() local Rank = exports.race:getPlayerRank(source) exports.scoreboard:scoreboardAddColumn( "score" ) if Rank == 1 then zcore = getElementData(source,"score") or 0 setElementData(source,"score",zcore+5) elseif Rank == 2 then zcore = getElementData(source,"score") or 0 setElementData(source,"score",zcore+3) elseif Rank == 3 then zcore = getElementData(source,"score") or 0 setElementData(source,"score",zcore+2) else return end end addEventHandler("onPlayerWasted", getRootElement(), Ranks) im good??? Link to comment
Castillo Posted August 16, 2012 Share Posted August 16, 2012 exports.scoreboard:scoreboardAddColumn ( "score" ) local scores = { 5, 3, 2 } function Ranks ( ) local rank = exports.race:getPlayerRank ( source ) local score = scores [ rank ] if ( score ) then local zcore = tonumber ( getElementData ( source, "score" ) ) or 0 setElementData ( source, "score", ( zcore + score ) ) end end addEventHandler ( "onPlayerWasted", getRootElement(), Ranks ) Link to comment
CheiN Posted August 16, 2012 Author Share Posted August 16, 2012 Where is the 2cond rank 3 rank and 1rst rank? Link to comment
Jaysds1 Posted August 16, 2012 Share Posted August 16, 2012 well, since it returns those numbers, the numbers go towards the table, so the ranks get the number from the table(scores) then gives the player the score Link to comment
CheiN Posted August 16, 2012 Author Share Posted August 16, 2012 Wait wait wait then the ranks will be 2 3 and 5??? I dont understood Link to comment
Castillo Posted August 16, 2012 Share Posted August 16, 2012 local scores = { 5, 3, 2 } It's like this: 1 = 5 2 = 3 3 = 2 You understand what I mean? the script will get the score from the 'rank' index from that table. Link to comment
CheiN Posted August 16, 2012 Author Share Posted August 16, 2012 Ahhhhhhh thx for explain it ^^ i didnt knew it THX solidSnake 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