As I read this topic people still struggling. Iโll try to help a bit.
If you want to make Radio an Item that you can buy from shops, you must have a script that triggers! That way you just implement the code in there and vola.
Therefore If you donโt have and or you want a quick way, follow along:
Firstly go into:
rp-radio/client.lua and make sure Its says this { Has = false, }
Then obviously you need an Item so go into your database and make that shit. Make sure its โradioโ or import this into your database. radio.sql
After that download this:
Then go to:
esx_extraitems/client/main.lua { line: 498 }
Add this:
RegisterNetEvent('mumble:onRadio')
AddEventHandler('mumble:onRadio', function()
local playerPed = GetPlayerPed(-1)
TriggerClientEvent('Radio.Set', source, true)
TriggerClientEvent('Radio.Toggle', source)
end)
And:
esx_extraitems/server/main.lua { line: 182 }
Add this:
ESX.RegisterUsableItem('radio', function(source)
local xPlayer = ESX.GetPlayerFromId(source)
TriggerClientEvent('Radio.Set', source, true)
TriggerClientEvent('Radio.Toggle', source)
-- xPlayer.removeInventoryItem('radio', 1)
end)
Keybinds to use radio in game use your rp-radio/config.lua settings. When you are in server use /giveitem yourid radio 1 to activate it use it from your inventory.
Done, thereโs no simpler way to explain this, I know people ainโt no master heads at dev, maybe needs more explanation so I hope I helped you out. Give yourself a tap on the shoulder.