API
Exports
AddVirtualRadio(vector3 coords, string uniqid)
uniqid
must be same for each client or radio won't be syncedAdd openable boombox on certain coords:
void
IsRadioClose()
- Check if player has radio closed:boolean
IsRadioOnShoulder()
- Check if player has radio on his shoulder:boolean
DeleteShoulderRadio()
- Delete radio on player's shoulder and give it back to his inventory:void
Events
AddEventHandler("xradio:menuOpened", function(type) end)
- Called when opening menuTriggerEvent("xradio:openRadio")
Open radio UI on groundTriggerEvent("xradio:radioOnShoulder")
- Equip radio to shoulderTriggerEvent("xradio:deleteRadioOnGround")
- Remove radio from groundTriggerEvent("xradio:openShoulderUi")
- Open radio UI on shoulderTriggerEvent("xradio:hideShoulderRadio")
Remove radio from player's shoulderTriggerEvent("xradio:putRadioBackGround")
- Put radio back on the ground
Example
Menu = exports.MenuAPI
AddEventHandler("xradio:menuOpened", function(type)
if type == "ground" then
local menu = Menu:CreateMenu("identifier")
menu.SetMenuTitle("Radio")
menu.SetProperties(Config.MenuProperties)
menu.AddItem(1, "open radio", function()
menu.Close()
TriggerEvent("xradio:openRadio")
end)
menu.AddItem(2, "pick radio", function()
menu.Close()
TriggerEvent("xradio:deleteRadioOnGround")
end)
if Config.radioOnShoulder then
menu.AddItem(3, "Radio on shoulder", function()
menu.Close()
TriggerEvent("xradio:radioOnShoulder")
end)
end
menu.Open()
end
if type == "shoulder" then
local menu = Menu:CreateMenu("identifier")
menu.SetMenuTitle("Radio")
menu.SetProperties(Config.MenuProperties)
menu.AddItem(1, "open radio", function()
menu.Close()
TriggerEvent("xradio:openShoulderUi")
end)
menu.AddItem(2, "hide radio", function()
menu.Close()
TriggerEvent("xradio:hideShoulderRadio")
end)
menu.AddItem(3, "Put back radio on ground", function()
menu.Close()
TriggerEvent("xradio:putRadioBackGround")
end)
menu.Open()
end
end)
Last updated
Was this helpful?