Minimum version: R06.15.11
This event was introduced in SCNP25 R06.15.11. Earlier versions will silently ignore it.
Registers an event name that the radio will call before loading any non-default codeplug. The handler decides whether the user is allowed to switch to that codeplug.
This is how a framework restricts which players are allowed to use which agency — for example, blocking civilians from loading the lspd codeplug.
| Name | Type | Description |
|---|---|---|
eventToCall |
string | The name of the event the radio should fire when a codeplug-change is requested. Pass null to clear any existing handler. |
Register a handler:
Lua
TriggerEvent("radioExternal:SetPermissionsHandler", "myFramework:checkRadioAgency")
C#
BaseScript.TriggerEvent("radioExternal:SetPermissionsHandler", "myFramework:checkRadioAgency");
When setCodeplug is invoked with any agency other than default, the radio fires your handler with two arguments:
| Position | Type | Description |
|---|---|---|
| 1 | string | The requested agencyID. |
| 2 | function | An approval callback. Call it (with any argument) to allow the codeplug to load. Don't call it to silently deny. |
Lua handler example
RegisterNetEvent("myFramework:checkRadioAgency")
AddEventHandler("myFramework:checkRadioAgency", function(agencyID, approve)
if playerIsAllowed(agencyID) then
approve(true)
end
-- not calling approve() denies the change
end)
C# handler example
[EventHandler("myFramework:checkRadioAgency")]
private void CheckRadioAgency(string agencyID, dynamic approve)
{
if (PlayerIsAllowed(agencyID))
{
approve(true);
}
// not calling approve denies the change
}
default.