Commands#
None.
Client exports#
| Export | What it does |
|---|---|
EnterCameraMode(cameraId, allowedIds) |
Enters the camera. allowedIds is an optional list the arrow keys are limited to. Returns true when the player is in. |
ExitCameraMode() |
Leaves the camera. |
SwitchCamera(index) |
Switches to the camera at that position in the camera list, if it is in the current cycle. |
AttemptCameraHack(cameraId, propId, allowedIds) |
Enters the camera and waits for the first hack result. Returns true only when the hack was won and the server accepted it. Returns false at once when entering fails. |
AddCamera(cameraData) |
Adds a camera on this client. Returns true, message or false, reason. |
RemoveCamera(cameraId) |
Removes a camera on this client. Returns true, message or false, reason. |
GetAllCameras() |
Returns the camera list. |
GetCameraById(cameraId) |
Returns one camera table or nil. |
GetCameraConfig() |
Returns a copy of the config. Available on the client and the server. |
ShowCameraNotification(message, style) |
Shows a message on the camera screen. style is info, success or error. Does nothing outside camera mode. |
HighlightProp(coords, modelHash, color) |
Outlines the object of that model near coords and returns its entity, or nil. Needs highlighting to be active. |
RemoveHighlight(entity) |
Removes one outline. |
ClearAllHighlights() |
Removes every outline. |
SetHighlightActive(active) |
Turns the outline system on or off. |
Server exports#
| Export | What it does |
|---|---|
IsHacked(cameraId, propId) |
true while the prop is hacked. |
GetHackedBy(cameraId, propId) |
Source of the player who completed the hack, or nil. |
ResetHack(cameraId, propId) |
Makes one prop hackable again. |
ResetAllHacks() |
Makes every prop hackable again. |
RegisterCamera(cameraId, propIds) |
Limits a camera to the listed prop ids. Once registered, only those props can be hacked, even with AllowRuntimeCameras on. |
SetHackAuthorizer(fn) |
Sets fn(source, cameraId, propId), which must return true to let a player start a hack. Pass nil to remove it. |
GetCameraConfig() |
Returns a copy of the config. |
Events#
| Event | Side | What it does |
|---|---|---|
glitch-securityCameras:server:hackCompleted |
Server, local | (source, cameraId, propId). Fired after the server accepts a hack. Use it to pay out or unlock. |
Prop onSuccessEvent and onFailEvent |
Client | Named in the prop config. They receive the prop id. |
Prop hackEvent |
Client | Named in the prop config. Receives (params, callback). |
The resource also uses glitch-securityCameras:setCamera (client to server, reports the camera being viewed) internally. Do not trigger it from other resources.
Callbacks#
These ox_lib callbacks are internal to the hack flow and are listed for reference. Use the exports instead.
| Callback | What it does |
|---|---|
glitch-securityCameras:beginHack |
Opens a hack. Refuses invalid ids, unknown props, a camera the player is not viewing, the cooldown, hacked props and the authorizer. |
glitch-securityCameras:completeHack |
Closes the hack opened by beginHack, once, after Config.MinHackSeconds. |
glitch-securityCameras:failHack |
Clears the open hack after a failure. |
State#
GlobalState['secCam:hacked'] is a table whose keys are cameraId:propId and whose values are true. It updates whenever a prop is hacked, reset or expires, and clears when the resource stops.
Stuck on a step?Ask in the Discord →