FrazzIe / rp-radio

An in-game radio which makes use of the mumble-voip radio API for FiveM
MIT License
41 stars 62 forks source link

ITEM rp-radio #11

Closed SienkoV2 closed 2 years ago

SienkoV2 commented 4 years ago

Hi ! I want create item with you rp-radio did you have an tips for create this ^^ ?

Mellorx2 commented 2 years ago

Just use this code. Add this in the server.lua:

ESX.RegisterUsableItem('radio', function(source)

    local xPlayer = ESX.GetPlayerFromId(source)
      xPlayer.removeInventoryItem('radio', 1)
       TriggerClientEvent('Radio.Set', source, true)
    TriggerClientEvent('Radio.Toggle', source)

end)