Hi,
I’ve created a few commands which run a server event to show the ID to the player (ID, drivers, weapons) which is working fine - code shown below:
RegisterCommand('solar_seeid', function()
TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()))
end)
RegisterCommand('solar_seedrivers', function()
TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()), 'driver')
end)
RegisterCommand('solar_seeweapons', function()
TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()), 'weapon')
end)
However, I’m struggling to find a way to create a server event for “showing another player” the ID - I have the code needed to do it as shown below but I’m struggling to find a way around it, I’ve tried creating a ServerEvent / Function to run it as a command but none have worked.
local player, distance = ESX.Game.GetClosestPlayer()
if distance ~= -1 and distance <= 3.0 then
TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(player))
else
ESX.ShowNotification('No players nearby')
end
Any ideas?
Appreciate it.
Thanks.