print("^2[turfwar]^7 leaderboard client loaded") local leaderboard = {} -- Map FiveM blipColor IDs -> RGB (approx). -- We only need the ones you use: 0,2,3,5,7,40. local BLIP_RGB = { [0] = {255, 255, 255}, -- White [2] = { 60, 200, 60}, -- Green [3] = { 70, 120, 255}, -- Blue [5] = {255, 220, 60}, -- Yellow [7] = {190, 90, 255}, -- Purple [40] = { 40, 40, 40}, -- Dark grey / black } local function getGangName(gangId) if Config and Config.GANGS and Config.GANGS[gangId] and Config.GANGS[gangId].name then return Config.GANGS[gangId].name end return ("Gang %s"):format(gangId) end local function getGangRGB(gangId) local blip = 0 if Config and Config.GANGS and Config.GANGS[gangId] and Config.GANGS[gangId].blipColor then blip = tonumber(Config.GANGS[gangId].blipColor) or 0 end return BLIP_RGB[blip] or {255, 255, 255} end local function drawText(x, y, text, r, g, b, a, scale) SetTextFont(4) SetTextScale(scale, scale) SetTextColour(r, g, b, a) SetTextOutline() SetTextWrap(0.0, 1.0) BeginTextCommandDisplayText("STRING") AddTextComponentSubstringPlayerName(text) EndTextCommandDisplayText(x, y) end -- Ask server for current leaderboard on join/resource start CreateThread(function() Wait(1500) TriggerServerEvent("turfwar:requestGangLeaderboard") end) RegisterNetEvent("turfwar:gangLeaderboard", function(rankedGangIds) leaderboard = rankedGangIds or {} -- debug: -- print("^2[turfwar]^7 leaderboard: " .. json.encode(leaderboard)) end) -- Compact HUD render (smaller box, slightly bigger text) CreateThread(function() while true do Wait(0) if not leaderboard or #leaderboard == 0 then goto continue end local maxRows = math.min(#leaderboard, 8) -- fewer rows keeps it compact -- Layout (top-left) local x = 0.018 local y = 0.185 -- Slightly bigger than before (but still realistic) local titleScale = 0.32 local rowScale = 0.28 -- Smaller/tighter panel local rowH = 0.018 local padX = 0.008 local padY = 0.008 local panelW = 0.14 -- ~⅓ smaller than before (was 0.22) local panelH = padY + 0.020 + (maxRows * rowH) + padY -- Background panel (more compact) DrawRect(x + panelW/2, y + panelH/2, panelW, panelH, 0, 0, 0, 105) -- Title drawText(x + padX, y + padY, "Top Ranked Gang", 255, 255, 255, 235, titleScale) -- Rows local startY = y + padY + 0.020 for i = 1, maxRows do local gangId = leaderboard[i] local name = getGangName(gangId) local r,g,b = table.unpack(getGangRGB(gangId)) local rowY = startY + ((i-1) * rowH) -- very faint row highlight DrawRect(x + panelW/2, rowY + 0.009, panelW, rowH, 255, 255, 255, 8) -- rank number (lighter grey / near-white, with outline) drawText(x + padX, rowY, ("%d."):format(i), 235, 235, 235, 235, rowScale) -- gang name (colored) drawText(x + padX + 0.020, rowY, name, r, g, b, 245, rowScale) end ::continue:: end end)