Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -89,13 +93,17 @@ 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] = {
ped = adminPed,
label = label,
source = v.source,
self = v.source == GetPlayerServerId(PlayerId()),
name = v.name,
}
end
end
Expand All @@ -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
Expand Down
14 changes: 12 additions & 2 deletions config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -39,4 +49,4 @@ Config.GroupLabels = {
mod = "~g~MODERATOR",
},
}
}
}
23 changes: 17 additions & 6 deletions server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -56,4 +67,4 @@ AddEventHandler('esx:playerDropped', function(source)
AdminPlayers[source] = nil
end
TriggerClientEvent('relisoft_tag:set_admins', -1, AdminPlayers)
end)
end)