Jump to content

[How] Scoreboard


ViRuZGamiing

Recommended Posts

Posted

Hi,

Here's an Example of what I want;

background.png

1st Row = Name

2nd Row = Playtime

3th Row = Gang/Group your in

Last Row not needed

How can I create this?

"If debugging is the process of removing software bugs, then programming must be the process of putting them in."

Posted

You should use these functions;

bindKey 
onClientRender 
dxDrawRectangle / dxDrawImage 
dxDrawText 
getPlayerName 
getElementData 
getPlayerTeam 

logo-small.png?v=3 tiny-sapdfr.png

 

If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]

Posted

A friend of me wrote this Client side but he said he can't make the server side bcuz he's busy with school.

local screenx, screeny = guiGetScreenSize() 
 
local scoreboardtop = 1
local currentcount = 1
local playercount = 0
ScoreboardLabel = {}
ScoreboardImagel = {}
ScoreboardImagelSelect = {}
PlLabel = {}
ScoreboardImagel[1] = guiCreateStaticImage(screenx/2-700/2,screeny/2-500/2,2^((math.log10(700))/(math.log10(2))),2^((math.log10(500))/(math.log10(2))),"images/scoreboard/background.png",false)
ScoreboardImagel[2] = guiCreateStaticImage(630,390,16,16,"images/scoreboard/arrowdown.png",false,ScoreboardImagel[1])
ScoreboardImagel[3] = guiCreateStaticImage(630,170,16,16,"images/scoreboard/arrowup.png",false,ScoreboardImagel[1])
ScoreboardImagel[4] = guiCreateStaticImage(screenx/2-700/2-140,screeny/2-165/2,180,180,"images/scoreboard/info.png",false)
ScoreboardLabel[1] = guiCreateLabel(60,437,54,25,"0/300",false,ScoreboardImagel[1])
ScoreboardLabel[2] = guiCreateLabel(30,5,130,35,"Scorp",false,ScoreboardImagel[4])
ScoreboardLabel[3] = guiCreateLabel(10,45,170,20,"Nebenjob: ",false,ScoreboardImagel[4])
ScoreboardLabel[4] = guiCreateLabel(10,60,150,20,"Telefon: ",false,ScoreboardImagel[4])
ScoreboardLabel[5] = guiCreateLabel(10,75,150,20,"Rang: ",false,ScoreboardImagel[4])
ScoreboardLabel[6] = guiCreateLabel(10,90,150,20,"Morde: ",false,ScoreboardImagel[4])
ScoreboardLabel[7] = guiCreateLabel(10,105,150,20,"Tode: ",false,ScoreboardImagel[4])
ScoreboardLabel[8] = guiCreateLabel(10,120,150,20,"Frei: ",false,ScoreboardImagel[4])
ScoreboardLabel[9] = guiCreateLabel(100,437,530,20,"",false,ScoreboardImagel[1])
ScoreboardLabel[10] = guiCreateLabel(10,135,150,20,"Frei: ",false,ScoreboardImagel[4])
ScoreboardLabel[11] = guiCreateLabel(10,150,150,20,"Frei: ",false,ScoreboardImagel[4])
local fontS = guiCreateFont("images/scoreboard/BEBASNEUE.otf",12)
scoreFonttimer = setTimer(
    function()
        if not fontS then
            fontS = guiCreateFont("images/scoreboard/BEBASNEUE.otf",12)
            if fontS then
                guiSetFont(ScoreboardLabel[1],fontS)
                guiSetFont(ScoreboardLabel[9],fontS)
            end
        else
            guiSetFont(ScoreboardLabel[1],fontS)
            guiSetFont(ScoreboardLabel[9],fontS)
            killTimer(scoreFonttimer)
        end
    end
,100,-1)
guiSetFont(ScoreboardLabel[2],"default-bold-small")
guiLabelSetHorizontalAlign(ScoreboardLabel[2],"center")
guiSetFont(ScoreboardLabel[3],"default-bold-small")
guiSetFont(ScoreboardLabel[4],"default-bold-small")
guiSetFont(ScoreboardLabel[5],"default-bold-small")
guiSetFont(ScoreboardLabel[6],"default-bold-small")
guiSetFont(ScoreboardLabel[7],"default-bold-small")
guiSetFont(ScoreboardLabel[8],"default-bold-small")
--guiSetFont(ScoreboardLabel[9],"default-bold-small")
guiSetFont(ScoreboardLabel[10],"default-bold-small")
guiSetFont(ScoreboardLabel[11],"default-bold-small")
guiSetAlpha(ScoreboardImagel[1],0.9)
guiSetAlpha(ScoreboardImagel[4],0.9)
guiSetVisible(ScoreboardImagel[1],false)
guiSetVisible(ScoreboardImagel[4],false)
 
for i = 1,16 do
    PlLabel[i] = {}
    ScoreboardImagelSelect[i] = guiCreateStaticImage(43,160+16*(i-1),607,16,"images/scoreboard/select.jpg",false,ScoreboardImagel[1])
    guiSetAlpha(ScoreboardImagelSelect[i],0.4)
    PlLabel[i][1] = guiCreateLabel(60,160+16*(i-1),150,30,"",false,ScoreboardImagel[1])
    PlLabel[i][2] = guiCreateLabel(240,160+16*(i-1),96,30,"",false,ScoreboardImagel[1])
    PlLabel[i][3] = guiCreateLabel(360,160+16*(i-1),200,30,"",false,ScoreboardImagel[1])
    PlLabel[i][4] = guiCreateLabel(490,160+16*(i-1),150,30,"",false,ScoreboardImagel[1])
    setElementData(PlLabel[i][1],"Name","none")
    guiSetFont(PlLabel[i][1],"default-bold-small")
    guiSetFont(PlLabel[i][2],"default-bold-small")
    guiSetFont(PlLabel[i][3],"default-bold-small")
    guiSetFont(PlLabel[i][4],"default-bold-small")
end
 
function showScoreboard()
    setElementData(getLocalPlayer(),"Clicked",true)
    showCursor(true,false)
   
    for i = 1,16 do
        guiSetText(PlLabel[i][1],"")
        guiSetText(PlLabel[i][2],"")
        guiSetText(PlLabel[i][3],"")
        guiSetText(PlLabel[i][4],"")
        guiLabelSetColor(PlLabel[i][1],255,255,255)
        guiLabelSetColor(PlLabel[i][2],255,255,255)
        guiLabelSetColor(PlLabel[i][3],255,255,255)
        guiLabelSetColor(PlLabel[i][4],255,255,255)
    end
    toggleControl("next_weapon",false)
    toggleControl("previous_weapon",false)
    playercount = #getElementsByType( "player" )
    guiSetVisible(ScoreboardImagel[1],true)
    local fill = nil
    local pldl = nil
    local fill = 0
    local pldl = 0
    local userConnecting = {}
    local userRacing = {}
    local userDeathmatch = {}
    local userInFraktion = {}
    userInFraktion[0] = {}
    userInFraktion[1] = {}
    userInFraktion[2] = {}
    userInFraktion[3] = {}
    userInFraktion[4] = {}
    userInFraktion[5] = {}
    userInFraktion[6] = {}
    userInFraktion[7] = {}
    userInFraktion[8] = {}
    userInFraktion[9] = {}
    userInFraktion[10] = {}
    userInFraktion[11] = {}
    userInFraktion[12] = {}
    userInFraktion[13] = {}
    for k, v in ipairs ( getElementsByType("player") ) do
        if getElementData(v,"raceState") then
            table.insert(userRacing,v)
        elseif getElementData(v,"deathmatchState") then
            table.insert(userDeathmatch,v)
        elseif not getElementData(v,"loggedin") then
            table.insert(userConnecting,v)
        else
            table.insert(userInFraktion[tonumber(getElementData(v,"Fraktion"))],v)
        end
    end
    if #userRacing > 0 and #userDeathmatch > 0 then
        if currentcount+1 <= #getElementsByType( "player" )+2+2-15 then
            guiSetVisible(ScoreboardImagel[2],true)
        else
            guiSetVisible(ScoreboardImagel[2],false)
        end
 
    elseif #userRacing > 0 or #userDeathmatch > 0 then
        if currentcount+1 <= #getElementsByType( "player" )+2-15 then
            guiSetVisible(ScoreboardImagel[2],true)
        else
            guiSetVisible(ScoreboardImagel[2],false)
        end
 
    else
        if currentcount+1 <= #getElementsByType( "player" )-15 then
            guiSetVisible(ScoreboardImagel[2],true)
        else
            guiSetVisible(ScoreboardImagel[2],false)
        end
    end
    if currentcount-1 >= 1 then
        guiSetVisible(ScoreboardImagel[3],true)
    else
        guiSetVisible(ScoreboardImagel[3],false)
    end
   
    for num, player in ipairs ( userConnecting ) do
        if not getElementData(player,"loggedin") then
           
            pldl = pldl + 1
                if fill < 16 then
                    if pldl >= currentcount then
                        fill = fill + 1
                        fillPlayerlist (player,fill,255,255,255,"verbinden")
                    end
                else
                    break
                end
           
        end
    end
    for num, player in ipairs ( userInFraktion[0] ) do
        if tonumber(getElementData(player,"Fraktion")) == 0 then
           
            pldl = pldl + 1
                if fill < 16 then
                    if pldl >= currentcount then
                        fill = fill + 1
                        fillPlayerlist (player,fill,255,255,255,"none")
                    end
                else
                    break
                end
           
        end
    end
    for num, player in ipairs ( userInFraktion[1] ) do
        if tonumber(getElementData(player,"Fraktion")) == 1 then
           
            pldl = pldl + 1
                if fill < 16 then
                    if pldl >= currentcount then
                        fill = fill + 1
                        fillPlayerlist (player,fill,0,255,0,"none")
                    end
                else
                    break
                end
           
        end
    end
    for num, player in ipairs ( userInFraktion[2] ) do
        if tonumber(getElementData(player,"Fraktion")) == 2 then
 
            pldl = pldl + 1
                if fill < 16 then
                    if pldl >= currentcount then
                        fill = fill + 1
                        fillPlayerlist (player,fill,200,255,0,"none")
                    end
                else
                    break
                end
           
        end
    end
    for num, player in ipairs ( userInFraktion[7] ) do
        if tonumber(getElementData(player,"Fraktion")) == 7 and tonumber(getElementData(player,"GWN")) == 0 then
           
            pldl = pldl + 1
                if fill < 16 then
                    if pldl >= currentcount then
                        fill = fill + 1
                        fillPlayerlist (player,fill,0,140,0,"GWD")
                    end
                else
                    break
                end
           
        end
    end
    for num, player in ipairs ( userInFraktion[7] ) do
        if tonumber(getElementData(player,"Fraktion")) == 7 and tonumber(getElementData(player,"GWN")) >= 1 then
           
            pldl = pldl + 1
                if fill < 16 then
                    if pldl >= currentcount then
                        fill = fill + 1
                        fillPlayerlist (player,fill,0,140,0,"None")
                    end
                else
                    break
                end
           
        end
    end
    for num, player in ipairs ( userInFraktion[10] ) do
        if tonumber(getElementData(player,"Fraktion")) == 10 then
 
            pldl = pldl + 1
                if fill < 16 then
                    if pldl >= currentcount then
                        fill = fill + 1
                        fillPlayerlist (player,fill,255,0,0,"none")
                    end
                else
                   

"If debugging is the process of removing software bugs, then programming must be the process of putting them in."

Posted

So, he wrote a 775 lines client side script which also includes server side events, but never wrote the server side? this sounds like you stole this code.

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

He said he made it himself and the server side is full of buggs and he doesn't want to give otherwise i've posted the server side here someone could help debug.

"If debugging is the process of removing software bugs, then programming must be the process of putting them in."

Posted

Bcuz I'm a noob and can't read 50% of the client so I can't write a Server side

"If debugging is the process of removing software bugs, then programming must be the process of putting them in."

Posted
Bcuz I'm a noob and can't read 50% of the client so I can't write a Server side

Everyone started somewhere, so I would say; give it a go? :) Just go and start to read the wiki and try out some things, if you have any errors we could help you.

logo-small.png?v=3 tiny-sapdfr.png

 

If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]

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