Trying to add item to players on spawn, but to only give it them once… Not sure if that makes sense but is it possible?
Was thinking of a
xPlayer.addInventoryItem('itemname', 1)
just don’t think this would work…
also need it to be able to detect if the player already has the item and if so don’t add it again.
(again not sure if im making sense here)
local xPlayer = ESX.GetPlayerFromId(_source)
also trying to make the Id show via jsfour-idcard
ESX.RegisterUsableItem('idcard', function(source)
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
end)
but keep getting an error for global value ‘Game’