so guys, how are you? I’m creating my first script. It’s a simple script to use weapons, but I’m creating a command to take it out of the weapons wheel and back to being an item again. My biggest problem is when spawning the item, when I execute the command, the weapon disappears from my hand, but it doesn’t go back to my inventory, my weapons use names in the database. example: “WEAPON_PISTOL” or “WEAPON_CARBINERIFLE”. Can someone help me?
My code:
RegisterNetEvent(‘hg_weapon:teste’)
AddEventHandler(‘hg_weapon:teste’, function(arma)
local playerPed = PlayerPedId()
local hash = GetHashKey(arma)
local isso = GetSelectedPedWeapon(playerPed)
TriggerServerEvent(‘hg_weapon:addPlayerItem’, hash, 1)
RemoveWeaponFromPed(playerPed, isso)
end)