Jump to content

¿Im good? III


CheiN

Recommended Posts

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

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

Posted

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

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

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