Jump to content

[Solved] Rank Numbers To Images


HunT

Recommended Posts

Hi all :fadein:

i want edit the scoreboard rank numbers with images but IDK how.i need only the easy example.

Type (idk) : getAccountData ranknumber 1 = rank1.png

getAccountData ranknumber 2 = rank2.png

i have this for scoreboard rank numbers

  
exports.scoreboard:addScoreboardColumn('Rank') 
  
function scoreLevel () 
local account = getPlayerAccount(source) 
local level = getAccountData(account, "rank") 
    if rank== false then 
        setElementData ( source, "Rank", "0" ) --Show the image for guest players  
    else 
        setElementData ( source, "Rank", level ) --Show the images rank 
    end 
addEventHandler ( "onPlayerSpawn", getRootElement(), scoreLevel ) 

Tnx For Help :|

Edited by Guest
Link to comment
  • Replies 57
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  
exports.scoreboard:addScoreboardColumn('Rank') 
  
function scoreLevel ( thePlayer ) 
local level = getAccountData( thePlayer, "rank") 
    if rank== false then 
        setElementData ( source, "rank", "0" ) --Show the image for guest players  
    else 
        setElementData ( source, "rank", level ) --Show the images rank 
    end 
addEventHandler ( "onPlayerSpawn", getRootElement(), scoreLevel ) 
  
function showTheRank() 
local level = getElementData ( thePlayer , "rank" ) 
dxDrawText( ".. level ..",sx*(0.3568),sy*(0.8074),sx*(0.2203),sy*(0.130), tocolor ( 192,192,192,255 ), 1.15, "default-bold","left","top", false, false ,true ) 
end 
bindKey ("F2", "down", showTheRank)  

NOT TESTED!

EDIT: If you want to use images use

guiCreateStaticImage 
  
EXAMPLE 
guiCreateStaticImage( x, y, width , heigh, "name.png", false ) -- it hasn't any parents .. 
  
guiCreateStaticImage( x, y, width , heigh, "name.png", myGuiWindow ) -- It will be shown only if "myGuiWindow" is visibile  

Link to comment
  
exports.scoreboard:addScoreboardColumn('Rank') 
  
function scoreLevel ( thePlayer ) 
local level = getAccountData( thePlayer, "rank") 
    if rank== false then 
        setElementData ( source, "rank", "0" ) --Show the image for guest players  
    else 
        setElementData ( source, "rank", level ) --Show the images rank 
    end 
addEventHandler ( "onPlayerSpawn", getRootElement(), scoreLevel ) 
  
function showTheRank() 
local level = getElementData ( thePlayer , "rank" ) 
dxDrawText( ".. level ..",sx*(0.3568),sy*(0.8074),sx*(0.2203),sy*(0.130), tocolor ( 192,192,192,255 ), 1.15, "default-bold","left","top", false, false ,true ) 
end 
bindKey ("F2", "down", showTheRank)  

NOT TESTED!

EDIT: If you want to use images use

guiCreateStaticImage 
  
EXAMPLE 
guiCreateStaticImage( x, y, width , heigh, "name.png", false ) -- it hasn't any parents .. 
  
guiCreateStaticImage( x, y, width , heigh, "name.png", myGuiWindow ) -- It will be shown only if "myGuiWindow" is visibile  

Relax no need the test :mrgreen: Tnx Anyway

--------------------------------------------------------------------------

bandi94 @

Yep i have the script for png's country but is totaly different :| why call the png's in admin resource.

Sure i need the table Type:

local levels =

{ 1 = "level1.png",

2= "level2.png"

etc. . .

+

setElementData(source, "Rank", ":folder with images"..levels..".png")

Link to comment
  
Sure i need the table Type: 
  
local levels =  
{ 1 = "level1.png", 
 2= "level2.png" 
etc. . . 
  
+ 
  
setElementData(source, "Rank", ":folder with images".. levels ..".png") 

 

Actually , the levels are saved as numbers not as level1 and level2 and etc

So you can simply write

 

local levels = 
{ 1 = "1.png" 
2 = "2.png" 
... 
99 = "99.png" } 
  
setElementData(source, "rank", "images\".. levels ..".png")  
  
  
 

And don't forget that the element is "rank" not "Rank"

Good Luck :)

Link to comment

i Made this but no work (show the msg :| . . . ":Panel\\Rank in scoreboard and no the image )

exports.scoreboard:addScoreboardColumn('Rank',getRootElement(),3,30,'Rank') 
  
levels = {  
    ["Rank/level1.png"] = 1, 
    ["Rank/level2.png"] = 2, 
    ["Rank/level3.png"] = 3 
}  
  
function scoreRank() 
        local account = getPlayerAccount(source) 
        livello  =  getAccountData(account, "rank") 
        if livello == false then 
    for i,v in pairs(levels) do 
             if livello  ==  i then 
                    end 
             end 
    end 
        setElementData(source, "Rank", ":Panel\\Rank\\"..livello..".png") 
    end 
addEventHandler('onPlayerSpawn',Root,scoreRank) 

Help Please :evil:

Link to comment
exports.scoreboard:addScoreboardColumn('Rank',getRootElement(),3,30,'Rank') 
  
levels = {  
    ["Rank/1.png"] = 1, 
    ["Rank/2.png"] = 2, 
    ["Rank/3.png"] = 3 
}  
  
function scoreRank() 
        local account = getPlayerAccount(source) 
        livello  =  getAccountData(account, "rank") 
        if livello == false then 
    for i,v in pairs(levels) do 
             if livello  ==  i then 
                    end 
             end 
    end 
        setElementData(source, "Rank", ":Panel\\Rank\\".. livello ..".png") 
    end 
addEventHandler('onPlayerSpawn',Root,scoreRank) 

And rename the 3 files into 1 , 2 , and 3

The level is saved as "number" not as "level"

Link to comment
  
exports.scoreboard:addScoreboardColumn('Rank') 
  
function scoreLevel () 
    local account = getPlayerAccount(source) 
    local level = getAccountData(account, "rank") 
    local nameimage = "level" 
    if rank== false then 
        setElementData(source, "Rank", "level0.png") --Show the image for guest players 
    else 
        setElementData(source, "Rank", tostring(nameimage .. level .. ".png" )) --Show the images rank 
                                        -- If you doesnt have image in your resource \/ 
                                        -- Try use ":Panel\\Rank\\"..nameimage..level..".png" 
    end 
end 
addEventHandler("onPlayerSpawn", getRootElement(), scoreLevel) 
  

Not tested.

Link to comment

Tnx now show the text level0.png and else level1.png but no the images,only text :|

errors nothing in debugscript 3

Anyway i have the "Rank" folder for images. (30x30)

and i test with

setElementData(source, "Rank", tostring(":Panel\\Rank\\"..nameimage .. level .. ".png" )) 

and

setElementData(source, "Rank", tostring(nameimage .. level .. ".png" )) 

Maybe no call the image (idk)

Link to comment
what just happened?

I've got bad experience with him. A year ago his clan (?) has copied names of my clan (I don't know why did they do it). They were advertising their server where nobody played everyday. In this thread, he's going to copy one of unique features of my server (oh yeah, he's so pro that he can't do it himself).

Orange u are crazy?

in this days i play in Cod MW3 and i have this idea.

i want add the images rank from mw3 in my server

what copy sorry? . . . facepalm

Oh yeah, I've got rank icons from mw2. Don't you remember when you were copying every idea?

Link to comment
what just happened?

I've got bad experience with him. A year ago his clan (?) has copied names of my clan (I don't know why did they do it). They were advertising their server where nobody played everyday. In this thread, he's going to copy one of unique features of my server (oh yeah, he's so pro that he can't do it himself).

Orange u are crazy?

in this days i play in Cod MW3 and i have this idea.

i want add the images rank from mw3 in my server

what copy sorry? . . . facepalm

Oh yeah, I've got rank icons from mw2. Don't you remember when you were copying every idea?

No Comment.

Listen i have 20 years ago and i no want spend the time with the kids.

1.i never enter in u server

2.my name is hunterix ever

3.maybe the kinds banned in my server enter in u server . ..idk :|

4. i have 20 years (again)

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