1- -- relisoft.cz
2- -- Some-RP.cz
3- -- forum.some-rp.cz
1+ -- store.rcore.cz
42
5- ESX = nil
63local currentAdminPlayers = {}
74local visibleAdmins = {}
8-
9- Citizen .CreateThread (function ()
10- while ESX == nil do
11- TriggerEvent (' esx:getSharedObject' , function (obj ) ESX = obj end )
12- Citizen .Wait (0 )
13- end
14- end )
5+ local closeAdmins = {}
156
167RegisterNetEvent (' relisoft_tag:set_admins' )
178AddEventHandler (' relisoft_tag:set_admins' , function (admins )
@@ -23,9 +14,8 @@ AddEventHandler('relisoft_tag:set_admins', function(admins)
2314 end
2415end )
2516
26- RegisterNetEvent (' esx:playerLoaded' )
27- AddEventHandler (' esx:playerLoaded' , function ()
28- ESX .TriggerServerCallback (' relisoft_tag:getAdminsPlayers' , function (admins )
17+ CreateThread (function ()
18+ callCallback (' getAdminsPlayers' , function (admins )
2919 currentAdminPlayers = admins
3020 end )
3121end )
@@ -36,7 +26,7 @@ function draw3DText(pos, text, options)
3626 local scaleOption = options .size or 0.8
3727
3828 local camCoords = GetGameplayCamCoords ()
39- local dist = # (vector3 ( camCoords . x , camCoords . y , camCoords . z ) - vector3 ( pos . x , pos . y , pos . z ) )
29+ local dist = # (camCoords - pos )
4030 local scale = (scaleOption / dist ) * 2
4131 local fov = (1 / GetGameplayCamFov ()) * 100
4232 local scaleMultiplier = scale * fov
5747
5848Citizen .CreateThread (function ()
5949 while true do
60- Citizen . Wait (Config .NearCheckWait )
50+ Wait (Config .NearCheckWait )
6151 local ped = PlayerPedId ()
6252 local pedCoords = GetEntityCoords (ped )
6353 for k , v in pairs (currentAdminPlayers ) do
@@ -67,7 +57,7 @@ Citizen.CreateThread(function()
6757 local adminCoords = GetEntityCoords (adminPed )
6858
6959 local distance = # (adminCoords - pedCoords )
70- if distance < ( Config . SeeDistance ) then
60+ if distance < 40 then
7161 visibleAdmins [v .source ] = v
7262 else
7363 visibleAdmins [v .source ] = nil
@@ -78,47 +68,62 @@ Citizen.CreateThread(function()
7868end )
7969
8070CreateThread (function ()
81- local wtt = 500
8271 while true do
83- Wait (wtt )
84- if next (visibleAdmins ) ~= nil then
85- for k , v in pairs (visibleAdmins ) do
86- local playerServerID = GetPlayerFromServerId (v .source )
87- if playerServerID ~= - 1 then
88- local adminPed = GetPlayerPed (playerServerID )
89- local adminCoords = GetEntityCoords (adminPed )
90- local x , y , z = table.unpack (adminCoords )
91- z = z + Config .ZOffset
72+ Wait (500 )
73+ closeAdmins = {}
74+ for k , v in pairs (visibleAdmins ) do
75+ local playerServerID = GetPlayerFromServerId (v .source )
76+ if playerServerID ~= - 1 then
77+ local adminPed = GetPlayerPed (playerServerID )
78+ local label
79+
80+ if v .permission then
81+ label = Config .GroupLabels .ESX [1 ][v .permission ]
82+ end
83+
84+ if v .group then
85+ label = Config .GroupLabels .ESX [2 ][v .group ]
86+ end
87+
88+ if v .qbcore then
89+ label = Config .GroupLabels .QBCore [1 ][v .qbcore ]
90+ end
9291
93- local label
94- if GetPlayerName (PlayerPedId ()) == ' Kouba' then
95- label = " CoOnwer"
96- end
97- if Config .TagByPermission then
98- label = Config .PermissionLabels [v .permission ]
99- else
100- label = Config .GroupLabels [v .group ]
101- end
10292
103- if label then
104- if v .source == GetPlayerServerId (PlayerId ()) then
105- if Config .SeeOwnLabel == true then
106- draw3DText (vector3 (x , y , z ), label , {
107- size = Config .TextSize
108- })
109- wtt = 0
110- end
111- else
112- draw3DText (vector3 (x , y , z ), label , {
93+ if label then
94+ closeAdmins [playerServerID ] = {
95+ ped = adminPed ,
96+ label = label ,
97+ source = v .source ,
98+ self = v .source == GetPlayerServerId (PlayerId ()),
99+ }
100+ end
101+ end
102+ end
103+ end
104+ end )
105+
106+ CreateThread (function ()
107+ while true do
108+ Wait (0 )
109+ if next (closeAdmins ) ~= nil then
110+ for k , v in pairs (closeAdmins ) do
111+ if v .label then
112+ if v .self then
113+ if Config .SeeOwnLabel == true then
114+ draw3DText (GetEntityCoords (v .ped ) + Config .Offset , v .label , {
113115 size = Config .TextSize
114116 })
115- wtt = 0
116117 end
118+ else
119+ draw3DText (GetEntityCoords (v .ped ) + Config .Offset , v .label , {
120+ size = Config .TextSize
121+ })
117122 end
118123 end
119124 end
120125 else
121- wtt = 1000
126+ Wait ( 1000 )
122127 end
123128 end
124129end )
0 commit comments