From 79b37580603a86607e1e495724d624154106fd53 Mon Sep 17 00:00:00 2001 From: Isigar Date: Thu, 19 Dec 2024 00:31:55 +0100 Subject: [PATCH 1/3] Add name parameter --- client/main.lua | 4 ++++ config.lua | 4 ++-- server/main.lua | 9 +++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/client/main.lua b/client/main.lua index f73851b..fbcbe48 100644 --- a/client/main.lua +++ b/client/main.lua @@ -89,6 +89,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 +99,7 @@ CreateThread(function() label = label, source = v.source, self = v.source == GetPlayerServerId(PlayerId()), + name = v.name, } end end diff --git a/config.lua b/config.lua index 5900170..832297c 100644 --- a/config.lua +++ b/config.lua @@ -7,7 +7,7 @@ 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 @@ -39,4 +39,4 @@ Config.GroupLabels = { mod = "~g~MODERATOR", }, } -} \ No newline at end of file +} diff --git a/server/main.lua b/server/main.lua index 2776291..b62151f 100644 --- a/server/main.lua +++ b/server/main.lua @@ -22,17 +22,18 @@ RegisterCommand('tag', function(source, args) if Config.Framework == Framework.ESX 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 + 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 +57,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) From 9506803ef1909a3c106bc3868e9725c9090ac5c3 Mon Sep 17 00:00:00 2001 From: Isigar Date: Thu, 19 Dec 2024 05:15:25 +0100 Subject: [PATCH 2/3] Add color parameter --- client/main.lua | 6 ++++-- config.lua | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/client/main.lua b/client/main.lua index fbcbe48..a519107 100644 --- a/client/main.lua +++ b/client/main.lua @@ -116,12 +116,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 832297c..7b15d24 100644 --- a/config.lua +++ b/config.lua @@ -11,6 +11,12 @@ 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.GroupLabels = { ESX = { From d937286bf95fda4b0117452890d77a1f3a96bfa0 Mon Sep 17 00:00:00 2001 From: Isigar Date: Thu, 19 Dec 2024 06:34:37 +0100 Subject: [PATCH 3/3] Add identifier option --- client/main.lua | 4 ++++ config.lua | 4 ++++ server/main.lua | 14 ++++++++++++-- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/client/main.lua b/client/main.lua index a519107..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 diff --git a/config.lua b/config.lua index 7b15d24..1e6b086 100644 --- a/config.lua +++ b/config.lua @@ -18,6 +18,10 @@ Config.TextColor = { a = 255, } +Config.PlayerLabels = { + ["identifier.fivem:123"] = "Cool admin", +} + Config.GroupLabels = { ESX = { -- group system that used to work on numbers only diff --git a/server/main.lua b/server/main.lua index b62151f..8d9092d 100644 --- a/server/main.lua +++ b/server/main.lua @@ -19,7 +19,17 @@ 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(), name = xPlayer.getName() or "UNK" } @@ -29,7 +39,7 @@ RegisterCommand('tag', function(source, args) 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