roadcarradio.
Access Control
Use these when another script needs the screen out of the way — during a cutscene, in a jail cell, while a minigame is running.isBlocked
Check whether the screen is currently blocked.blockCarRadio
Prevent the screen from being opened. If it is already open, it stays open until the player closes it — this blocks opening, it does not force a close.unblockCarRadio
Lift the block and allow the screen to be opened again.A block set by your script is not cleared automatically. If your script errors out between blocking and unblocking, the player is left without a radio until the resource restarts — always unblock in the same code path that blocks, including your failure paths.
useRoadCarRadio
Whether the player may currently use the radio at all — takes the install status, the driver-only rule and the vehicle damage threshold into account.Rear Camera
IsRearCameraActive
Whether the rear camera is on screen right now. Useful if your own script draws to the screen and should get out of the way.ToggleRearCamera
Turn the rear camera on or off, exactly as the keybind does. Respects every rule the keybind respects — driver only, allowed vehicle types, andneedCarRadioInstalled.
Server API
getCarsCarRadioIsInstalled
Server-side. Returns every licence plate that has a radio installed, straight from the in-memory cache — no database round trip.Only meaningful with
Config.NeedInstall = true. With the install system switched off, no vehicle is ever written to the table and the list stays empty — every vehicle has a radio in that mode.Vehicle Controls
The Actions app checks every request on the server: the vehicle and seat come from the player’s ped, never from the message, and the rights come fromConfig.VehicleControl. The three files below are escrow_ignore, so you can adapt them to your server.
VehicleLock (server)
server/serverAPI/vehiclelock.lua decides how a lock request reaches your key script. The first script in VehicleLock.SYSTEMS that is started is used; scripts without an entry in SETTERS use the game’s own lock.
server/serverAPI/vehiclelock.lua
A setter that throws falls back to the game’s own lock and prints the error to the server console, so a renamed export never leaves the car unlockable. A setter set to
'client' is called on the requesting player’s client instead (see roadcarradio:client:vehicle:lock in client/clientAPI.lua).CarRadioIsLocked (client)
client/clientAPI.lua. The lock state the Actions app shows. If your key script keeps its own state (a state bag, an export), read it here as well.
CarRadioCanSwitchSeat (server)
server/serverAPI/vehicleseats.lua. Called before a player switches seats, after the built-in checks (seat free, only the front passenger slides to the wheel, nobody climbs from the back to the front, speed limit for the driver). Return false to refuse.
server/serverAPI/vehicleseats.lua
Related
Commands
Commands and keybinds the resource registers
Custom Music API
Serve your own music library over HTTP