Jump to content

Scoreboard team color doesnt workkkkkkkk


P[ow]er

Recommended Posts

hello everyone , I joined to the clan which is in the pic , but there's no colour of it and when I use another scoreboard there's colour of it. Why does that happen? Can someone help me , codes are under of the picture , thanks

J3YGzj.png

This is Clientside

  
local sX,sY = guiGetScreenSize()
local g_Me = getLocalPlayer()
local root = getRootElement()
 
 
local players = getElementsByType("player")
scoreboard = {}
local scrolldownby = 2
local lastscrolldown = 0
local scrollupby = 1
local scrollbarWidth = 1
 
local ServerMaxPlayer = 32
 
local rowsCount = math.floor(sY/21) - 2
local start = 3
local fps = 0
local fpstick = nil
local rotateimage= 0
 
local ourTeamName = "nothing"
local donatorsTeamName = "Donators"
 
fonts = {}
fonts["normal"] = {
    dxCreateFont("font/segoeuil.ttf",8),
    dxCreateFont("font/segoeuil.ttf",10),
    dxCreateFont("font/segoeuil.ttf",12),
    dxCreateFont("font/segoeuil.ttf",14),
    dxCreateFont("font/segoeuil.ttf",16),
    dxCreateFont("font/segoeuil.ttf",18),
    dxCreateFont("font/segoeuil.ttf",20),
    dxCreateFont("font/segoeuil.ttf",22),
    dxCreateFont("font/segoeuil.ttf",24),
    dxCreateFont("font/segoeuil.ttf",26),
}
fonts["bold"] = {
    dxCreateFont("font/segoeuib.ttf",8),
    dxCreateFont("font/segoeuib.ttf",10),
    dxCreateFont("font/segoeuib.ttf",12),
    dxCreateFont("font/segoeuib.ttf",14),
    dxCreateFont("font/segoeuib.ttf",16),
    dxCreateFont("font/segoeuib.ttf",18),
    dxCreateFont("font/segoeuib.ttf",20),
    dxCreateFont("font/segoeuib.ttf",22),
    dxCreateFont("font/segoeuib.ttf",24),
    dxCreateFont("font/segoeuib.ttf",26),
}
 
bindKey("mouse_wheel_down", "down", function()
    if rowsCount > #scoreboard then
    return
    end
  local time = getTickCount()
  if time - lastscrolldown < 60 then
    scrolldownby = math.min(scrolldownby + 3, 16)
  else
    if time - lastscrolldown < 120 then
      scrolldownby = math.min(scrolldownby + 2, 16)
    end
    scrolldownby = 1
  end
  lastscrolldown = time
  local rCount = math.min(#scoreboard, rowsCount - 1)
  start = math.min(#scoreboard - rCount, start + scrolldownby)
end
)
 
bindKey("mouse_wheel_up", "down", function()
    if rowsCount > #scoreboard then
    return
    end
  local time = getTickCount()
  if time - lastscrolldown < 100 then
    scrollupby = math.min(scrollupby + 2, 16)
  else
    scrollupby = 1
  end
  lastscrolldown = time
  start = math.max(1, start - scrollupby)
end
)
 
 
local uptadePlayers = function()
    scoreboard = {}
    table.insert(scoreboard,{})
    players = getElementsByType("player")
    local teams = getElementsByType("team")
    local teamID = {}
    for id,team in ipairs(teams) do
      teamID[getTeamName(team)] = id
    end
    local playersOrderedByTeams = {}
    for i = 1, #teams + 1 do
      playersOrderedByTeams[i] = {}
    end
    for id,player in ipairs(players) do
        local pTeam = getPlayerTeam(player)
        if pTeam then
            pTeam = teamID[getTeamName(pTeam)] + 1
        else
            pTeam = 1
        end
        table.insert(playersOrderedByTeams[pTeam], player)
    end                                            
    for tID,playersInTeam in ipairs(playersOrderedByTeams) do
        if tID-1 >= 1 then
            if #getPlayersInTeam(teams[tID - 1]) >= 1 then
                table.insert(scoreboard, {"team", teams[tID-1]})
            end
        end
        for id,player in ipairs(playersInTeam) do
            table.insert(scoreboard, {"player", player,getPlayerName(player)})
        end                                    
    end
end
uptadePlayers()
 
local TextFadeUp = true
local TextStartTime = nil
local TextTimer = nil
 
setTimer(function()
    TextTimer =
        setTimer(function()
            TextTimer = nil
            TextFadeUp = false
            TextStartTime = getTickCount()
        end, 2600, 1)
    TextFadeUp = true
    TextStartTime = getTickCount()
end,4000,0)
 
local isDrawing = false;
local isFading = false;
local fadeState = true; -- true = in | false = out
local fadeStart = 0;
 
local nameState, nameTick = true, 0;
 
local drawScoreboard = function()
    if(not isDrawing) then return; end
   
    uptadePlayers()
    showCursor(getKeyState("mouse2"))
    local rCount = math.min(#scoreboard-1, rowsCount -1)
    start = math.min(#scoreboard - rCount, start)
    local c = 0
    local cx, cy = 0,0
    local a = 255;
    local ap = 100;
    if isCursorShowing() then
        cx, cy = getCursorPosition()
        cx = cx * sX
        cy = cy * sY
    end
 
   
    local ax, ay = sX / 2 - 320, sY / 2 - rCount * 20 / 2+25
    local x, y = ax, ay;
 
    if(isFading) then
        local elapsed = (getTickCount() - fadeStart) / (fadeState and 0 or 0); --snelheid
 
            if(not fadeState) then
                isDrawing = false;
            end
            end
 
   
            dxDrawRectangle(x, y-2, 35, rCount * 20+2, tocolor(0, 0, 0, (140/100) * ap))
            dxDrawRectangle(x, y-2, 640, rCount * 20+2, tocolor(0, 0, 0, (160/100) * ap))
   
 
    rotateimage = rotateimage +2
    dxDrawRectangle(x, y - 47, 640, 30, tocolor(0,0,0, a))
   
    local nr, ng, nb
    local elapsed = getTickCount() - nameTick;
    local progress = elapsed / 2500;
    if(nameState) then
    nr, ng, nb = interpolateBetween(0, 128, 255, 0, 128, 255, progress, "Linear");
    else
        nr, ng, nb = interpolateBetween(0, 128, 255, 0, 128, 255, progress, "Linear");
    end
   
    if(progress >= 1) then
        nameState = not nameState;
        nameTick = getTickCount();
    end
   
 
    dxDrawText("GTA.Ru | DM | 24/7", x + 10, y - 70, x + 640, y, tocolor(255, 255, 255, 255), 1, fonts["normal"][5], "left", "center",false,false,false,true)
    --dxDrawText(#getElementsByType("player") .. " / #ffffff"..ServerMaxPlayer, x + 10, y - 65, x + 630, y, tocolor(255, 255, 255, a), 1,fonts["normal"][5], "right", "center",false,false,false,true)
    dxDrawText(#getElementsByType("player").." / "..ServerMaxPlayer, x + 10, y - 65, x + 630, y, tocolor(255, 255, 255, 255), 1,fonts["normal"][5], "right", "center",false,false,false,true)
   
    dxDrawRectangle(x, y-17, 640, 15, tocolor(60,60,60,140))
    dxDrawText("ID", x+14.5 , y-20, x + 640, y, tocolor(220,220,220, 255), 1,fonts["normal"][2], "left", "center")
    dxDrawText("Name", x +45, y-20, x + 640, y, tocolor(220,220,220, 255), 1, fonts["normal"][2], "left", "center")
    dxDrawText("Money", x +280, y-20, x + 640, y, tocolor(220,220,220, 255), 1, fonts["normal"][2], "left", "center")
    dxDrawText("Exp", x +370, y-20, x + 640, y, tocolor(220,220,220, 255), 1, fonts["normal"][2], "left", "center")
    dxDrawText("Rank", x +430, y-20, x + 640, y, tocolor(220,220,220, 255), 1, fonts["normal"][2], "left", "center")
    dxDrawText("State", x +488, y-20, x + 640, y, tocolor(220,220,220, 255), 1, fonts["normal"][2], "left", "center")
    dxDrawText("Country", x +195, y-20, x + 640, y, tocolor(220,220,220, 255), 1, fonts["normal"][2], "left", "center")
    dxDrawText("FPS", x +555, y-20, x + 640, y, tocolor(220,220,220, 255), 1, fonts["normal"][2], "left", "center")
    dxDrawText("Ping", x +600, y-20, x + 640, y, tocolor(220,220,220, 255), 1, fonts["normal"][2], "left", "center")
   
    for id,element in ipairs(scoreboard) do
        if start < id and id <= start + rCount then
        c = c + 1  
            if element[1] == "player" and isElement(element[2]) then
                if isCursorShowing() and x <= cx and cx < x + 640 and y + (c - 1) * 20 <= cy and cy < y + (c) * 20 then
                    dxDrawRectangle(x + 35, y-1 + (c - 1) * 20, 605, 20, tocolor(255, 255, 255, 50))
                end
               
               
               
               
                local r, g, b = 255, 255, 255
           
               
               
               
               
                local RainbowColorNameHex = getElementData(element[2],"donatorRainbowColorNameHEX") or ""
                if not getElementData(element[2], "AFK") then
                    dxDrawText(RainbowColorNameHex..element[3], x + 40, y-5 + (c - 1) * 20, x + 200, y + (c) * 20, tocolor(r, g, b, a), 1, "default-bold", "left", "center", false, false, false, true)
                else
                    dxDrawText(RainbowColorNameHex..element[3], x + 68, y-5 + (c - 1) * 20, x + 200, y + (c) * 20, tocolor(r, g, b, a), 1, "default-bold", "left", "center", false, false, false, true)
                    dxDrawText("#ff0000AFK", x + 40, y-5 + (c - 1) * 20, x + 200, y + (c) * 20, tocolor(r, g, b, a), 1, "default-bold", "left", "center", false, false, false, true)
                    end
                --ID
                dxDrawText(getElementData(element[2],"ID") or "?", x, y-5 + (c - 1) * 20, x + 35, y + (c) * 20, tocolor(255,255,255, a), 1, "default-bold", "center", "center")
                --Country
                    country = getElementData(element[2],"country") or "?"  
                    dxDrawText(string.upper(country) or "?", x+215, y-5 + (c - 1) * 20, x + 200, y + (c) * 20, tocolor(255,255,255, a), 1, "default-bold", "left", "center")
                    if country and fileExists("flags/"..country..".png") then
                    dxDrawImage(x+195, y-5 + (c - 1) * 20+4,16,16,"flags/"..country..".png",0,0,0,tocolor(255,255,255,a))
                    end
                --Money
                    local money
                    if getElementData(element[2],"Cash") then
                    money = getElementData(element[2],"Cash")
                    else
                        money = "Guest"
                    end
                    dxDrawText(money, x+275, y-5 + (c - 1) * 20, x+275+45, y + (c) * 20, tocolor(255,255,255, a), 1, "default-bold", "center", "center")
                --Points
                   
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...