local playerBlips = {} local function removePlayerBlip(serverId) local blip = playerBlips[serverId] if blip and DoesBlipExist(blip) then RemoveBlip(blip) end playerBlips[serverId] = nil end local function ensureBlip(entry) local serverId = tonumber(entry.serverId) if not serverId or serverId == GetPlayerServerId(PlayerId()) then return end local blip = playerBlips[serverId] if not blip or not DoesBlipExist(blip) then blip = AddBlipForCoord(entry.x + 0.0, entry.y + 0.0, entry.z + 0.0) SetBlipSprite(blip, 1) SetBlipColour(blip, 3) SetBlipScale(blip, 0.82) SetBlipDisplay(blip, 2) SetBlipAsShortRange(blip, false) ShowHeadingIndicatorOnBlip(blip, true) playerBlips[serverId] = blip end SetBlipCoords(blip, entry.x + 0.0, entry.y + 0.0, entry.z + 0.0) SetBlipRotation(blip, math.floor(tonumber(entry.heading) or 0.0)) BeginTextCommandSetBlipName('STRING') AddTextComponentString(('%s [%s]'):format(entry.name or 'Spieler', serverId)) EndTextCommandSetBlipName(blip) end RegisterNetEvent('devx_players:client:sync', function(entries) local seen = {} for _, entry in ipairs(entries or {}) do local serverId = tonumber(entry.serverId) if serverId and serverId ~= GetPlayerServerId(PlayerId()) then seen[serverId] = true ensureBlip(entry) end end for serverId in pairs(playerBlips) do if not seen[serverId] then removePlayerBlip(serverId) end end end) AddEventHandler('onResourceStop', function(resourceName) if resourceName ~= GetCurrentResourceName() then return end for serverId in pairs(playerBlips) do removePlayerBlip(serverId) end end)