[help] rcore_spray remover

someone can help me convert this to command instead of usableitem
pls:)

This is an easy one…

Would you like to check if the player have the item ?

If not then the code should look like that :

RegisterCommand(‘commandname’,function(source)
local xPlayer = ESX.GetPlayerFromId(source)

TriggerClientEvent('rcore_spray:removeClosestSpray',xPlayer.source)

end)

if you want to check the item then do

RegisterCommand(‘commandname’,function(source)

local xPlayer = ESX.GetPlayerFromId(source)
local xItem = xPlayer.getInventoryItem('spray_remover')

if xItem.count > 0 then

    --xPlayer.removeInventoryItem('spray_remover',1) --you could unmark also the code if you want to remove the item

    TriggerClientEvent('rcore_spray:removeClosestSpray',xPlayer.source)

end

end)

I hope i helped you to solve your problem (‘The commands is server sided if you dont know’)

its look like this now if i delete 12-31 its remove the item and do the animation but dont delete the spray not in the game and not in the database.
and if i keep it and use its seems like this: Screenshot-8 hosted at ImgBB — ImgBB

Maybe can i see what the triggerclientevent is doing ? Is it triggering anything back?

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