Can we make a item that when we have it something work?

Can we make a item that when we have it something work in lua? Like a gps that when we have it we have mini map

Yes, don’t is a problem , create the RegisterServerCallback and the Trigger.
If you are looking for a gps that only works with the map, you have this [ESX] GPS item (hidden / shown)

Thank you bro, sorry i have a question

**ESX = nil

TriggerEvent(‘esx:getSharedObject’, function(obj)
ESX = obj
end)

AddEventHandler(‘esx:onAddInventoryItem’, function(source, item, count)
if item.name == ‘gps’ then
TriggerClientEvent(‘esx_gps:addGPS’, source)
end
end)

AddEventHandler(‘esx:onRemoveInventoryItem’, function(source, item, count)
if item.name == ‘gps’ and item.count < 1 then
TriggerClientEvent(‘esx_gps:removeGPS’, source)
end
end)**

you maded “item” on function(source, ““item””, count) so when you maded this how you can get that name with item.name or get that count with item.count

This is my main problem

Thank you again

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.