Jump to content

ratio


Recommended Posts

Hi everyone.

I have a little problem.

I want show the rank on scoreboard.

but dont show. Idk what happen . Debugscript dont show errors.!

thanks dor your time.. here its my code :)

addEventHandler("onResourceStart", 
    getResourceRootElement(getThisResource()), 
    function() 
        exports.Scoreboard:addScoreboardColumn("Rank",getRootElement(),4,0.04) 
    end) 
     
addEventHandler ("onPlayerSpawn",getRootElement(), function()  
local serial = getPlayerSerial(source) 
local DDAttempts = executeSQLSelect ( "DDDM", "DDAttempts","serial = '" .. serial .. "'") 
local DDWins = executeSQLSelect ( "DDDM", "DDWins","serial = '" .. serial .. "'") 
rank = (tonumber(DDWins)/tonumber(DDAttempts))*100 
setElementData( source, "Rank", tonumber(rank[1]["rank"]))end) 

Link to comment
try this:
addEventHandler("onResourceStart",resourceRoot,function() 
        call(getResourceFromame("Scoreboard"),"addScoreboardColumn","Rank",root,4,0,04) 
end) 

the colum is created all right.. but dont show the rank

@solid another end?

Link to comment
You forgot to end the second function Yakuza.

he added the end at the end of the function

@Yukazi

What's this

tonumber(rank[1]["rank"]) 

???

you didn't made a table...

try this:

addEventHandler("onResourceStart",resourceRoot,function() 
    exports.Scoreboard:addScoreboardColumn("Rank",root,4,0,04) 
end) 
    
addEventHandler ("onPlayerSpawn",root,function() 
    local serial = getPlayerSerial(source) 
    local DDAttempts = executeSQLSelect ( "DDDM", "DDAttempts","serial = '"..serial.."'") 
    local DDWins = executeSQLSelect ( "DDDM", "DDWins","serial = '"..serial.."'") 
    rank = (tonumber(DDWins)/tonumber(DDAttempts))*100 
    setElementData( source, "Rank",rank) 
end) 

Edited by Guest
Link to comment

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