r_shoprobbery Exports & Commands
r_shoprobbery server exports, the hooks in the custom files and the admin command.
Server exports
A store's id is its id in shared/config_stores.lua, for example 'innocence'.
ResetStore
Ends every cooldown of one store and puts the clerk back behind the counter, or every store with
'all'. Returns true when it worked.
exports.r_shoprobbery:ResetStore('all')IsBeingRobbed
true while the store has been hit in the last R.Limits.activeWindow minutes.
if exports.r_shoprobbery:IsBeingRobbed('innocence') then
-- robbery in progress
endHooks
server/sv_custom.lua and client/cl_custom.lua are open. Fill in these functions to tie the
script to your server:
| Function | File | When |
|---|---|---|
CanRob(src, storeId, kind) | server | Before anything starts. Return false to block it. |
OnRobbed(src, storeId, kind, reward) | server | After a successful robbery, with the cash and items paid. |
OnAlarm(data, src) | server | When the police get the call, with the suspect description (used for lb-tablet). |
CanRob(kind, storeId) | client | Before anything starts. Blocks dead, cuffed or in-vehicle players by default. |
SkillCheck(difficulty) | client | The register and shelf skill check. |
SafeMinigame(params, safeCoords) | client | The safe. Swap in your own minigame. |
kind is 'holdup', 'register', 'safe' or 'shelf'.
Custom minigame
Both minigames are plain functions in client/cl_custom.lua. Swap the body for your own minigame
and return the result. Nothing else needs to change.
| Function | Gets | Must return |
|---|---|---|
SkillCheck(difficulty) | The skillCheck list of that register or shelf | true passed, false failed |
SafeMinigame(params, safeCoords) | params is your R.Safe table | true passed, false failed, false, 'cancel' when the player backs out |
Example with ps-ui's circle game, one circle per entry in the list:
function SkillCheck(difficulty)
local p = promise.new()
exports['ps-ui']:Circle(function(success)
p:resolve(success)
end, #difficulty, 10)
return Citizen.Await(p)
endThe function has to wait for the minigame and then return. A minigame that answers through a callback needs the promise shown above.
Admin command
/shoprobbery <action> for R.Admin.group (admin and god by default).
| Action | What it does |
|---|---|
status | One line per robbed store: clerk state, cooldowns and shelves searched |
reset <id> | Reset one store |
reset all | Reset every store |