Jump to content

ratio


Recommended Posts

Posted

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) 

Actual Nick: [XGN]BorderLine

Actual Clan: XLatino

Actual Status: Staff, Mod Level 1

(BOSS)Yakuza - [vS]Yakuza - [sXE]Yakuza - [uG]Yakuza - [FTLS]Racing - [XGN]Borderline

Posted

You forgot to end the second function Yakuza.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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

Actual Nick: [XGN]BorderLine

Actual Clan: XLatino

Actual Status: Staff, Mod Level 1

(BOSS)Yakuza - [vS]Yakuza - [sXE]Yakuza - [uG]Yakuza - [FTLS]Racing - [XGN]Borderline

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

My in-game name: Jaysds1

Retired CMG Scripter

World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode

Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/

 

sE5Qm.png

TiV3C.png

img.php?id=0&text=Lua%20Scripter

Posted

Sorry, my bad, I didn't see the end :oops:

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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