Minimum version: R06.18.00
This event was introduced in SCNP25 R06.18.00. Earlier versions will silently ignore it.
Registers an event name that the radio will call on every PTT state change. The handler can play its own animation and signal back that it has handled it; if it doesn't respond, the radio falls back to the built-in animation (which may itself have been customised via setDefaultAnim, setAimingAnim, or setVehicleAnim).
This is the right hook for animation scripts that want to drive the player rig themselves rather than just swapping the clip.
| Name | Type | Description |
|---|---|---|
eventToCall |
string | The name of the event the radio should fire on PTT state changes. Pass null to clear any existing handler. |
Register a handler:
Lua
TriggerEvent("radioExternal:setAnimHandler", "myFramework:radioAnim")
C#
BaseScript.TriggerEvent("radioExternal:setAnimHandler", "myFramework:radioAnim");
The radio fires your handler with two arguments:
| Position | Type | Description |
|---|---|---|
| 1 | string | The PTT state. One of ptt, ptt_aim, ptt_veh, or ptt_clear (see below). |
| 2 | function | A callback. Call it (with any argument) to tell the radio you handled the animation and the built-in fallback should not run. |
| State | Meaning |
|---|---|
ptt |
PTT pressed while on foot, not aiming. |
ptt_aim |
PTT pressed while aiming a weapon. |
ptt_veh |
PTT pressed while in a vehicle. |
ptt_clear |
PTT released. The callback's response is ignored — the radio always treats this as handled, since clearing an animation is safe to do twice. |
Lua handler example
RegisterNetEvent("myFramework:radioAnim")
AddEventHandler("myFramework:radioAnim", function(state, handled)
if state == "ptt" or state == "ptt_aim" or state == "ptt_veh" then
playMyOwnAnim(state)
handled(true) -- suppress the radio's default animation
elseif state == "ptt_clear" then
clearMyOwnAnim()
end
end)
ptt_clear state's callback response is ignored; the radio always advances to the cleared state regardless.