diff --git a/client/main.lua b/client/main.lua index f73851b..4481c32 100644 --- a/client/main.lua +++ b/client/main.lua @@ -77,6 +77,10 @@ CreateThread(function() local adminPed = GetPlayerPed(playerServerID) local label + if v.identifierTag then + label = v.identifierTag + end + if v.permission then label = Config.GroupLabels.ESX[1][v.permission] end @@ -89,6 +93,9 @@ CreateThread(function() label = Config.GroupLabels.QBCore[1][v.qbcore] end + if Config.UseNames then + label = string.format("%s | %s", label, v.name) + end if label then closeAdmins[playerServerID] = { @@ -96,6 +103,7 @@ CreateThread(function() label = label, source = v.source, self = v.source == GetPlayerServerId(PlayerId()), + name = v.name, } end end @@ -112,12 +120,14 @@ CreateThread(function() if v.self then if Config.SeeOwnLabel == true then draw3DText(GetEntityCoords(v.ped) + Config.Offset, v.label, { - size = Config.TextSize + size = Config.TextSize, + color = Config.TextColor }) end else draw3DText(GetEntityCoords(v.ped) + Config.Offset, v.label, { - size = Config.TextSize + size = Config.TextSize, + color = Config.TextColor, }) end end diff --git a/config.lua b/config.lua index 5900170..1e6b086 100644 --- a/config.lua +++ b/config.lua @@ -7,10 +7,20 @@ Config.Framework = Framework.ESX Config.Locale = "en" Config.SeeOwnLabel = true - +Config.UseNames = false Config.TextSize = 0.8 Config.Offset = vector3(0, 0, 1.2) Config.NearCheckWait = 500 +Config.TextColor = { + r = 255, + g = 50, + b = 50, + a = 255, +} + +Config.PlayerLabels = { + ["identifier.fivem:123"] = "Cool admin", +} Config.GroupLabels = { ESX = { @@ -39,4 +49,4 @@ Config.GroupLabels = { mod = "~g~MODERATOR", }, } -} \ No newline at end of file +} diff --git a/server/main.lua b/server/main.lua index 2776291..8d9092d 100644 --- a/server/main.lua +++ b/server/main.lua @@ -19,20 +19,31 @@ AdminPlayers = {} RegisterCommand('tag', function(source, args) if AdminPlayers[source] == nil then - if Config.Framework == Framework.ESX then + --Check for identifier + local identifier = GetPlayerIdentifierByType(source, "fivem") + if identifier then + for ident, tag in pairs(Config.PlayerLabels) do + if ident == identifier then + AdminPlayers[source] = { source = source, identifierTag = tag, name = GetPlayerName(source) or "UNK" } + end + end + end + + if Config.Framework == Framework.ESX and not AdminPlayers[source] then local xPlayer = SharedObject.GetPlayerFromId(source) if xPlayer.getPermissions then - AdminPlayers[source] = { source = source, permission = xPlayer.getPermissions() } + AdminPlayers[source] = { source = source, permission = xPlayer.getPermissions(), name = xPlayer.getName() or "UNK" } end if xPlayer.getGroup then - AdminPlayers[source] = { source = source, group = xPlayer.getGroup() } + AdminPlayers[source] = { source = source, group = xPlayer.getGroup(), name = xPlayer.getName() or "UNK" } end end - if Config.Framework == Framework.QBCORE then + if Config.Framework == Framework.QBCORE and not AdminPlayers[source] then + local qbPlayer = SharedObject.Functions.GetPlayer(source) for k, v in pairs(SharedObject.Config.Server.Permissions) do if IsPlayerAceAllowed(source, "tag." .. v) then - AdminPlayers[source] = { source = source, qbcore = v } + AdminPlayers[source] = { source = source, qbcore = v, name = qbPlayer.name or "UNK" } break end end @@ -56,4 +67,4 @@ AddEventHandler('esx:playerDropped', function(source) AdminPlayers[source] = nil end TriggerClientEvent('relisoft_tag:set_admins', -1, AdminPlayers) -end) \ No newline at end of file +end)