Skip to content
Documentation
Robberies5Shop Robbery

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
end

Hooks

server/sv_custom.lua and client/cl_custom.lua are open. Fill in these functions to tie the script to your server:

FunctionFileWhen
CanRob(src, storeId, kind)serverBefore anything starts. Return false to block it.
OnRobbed(src, storeId, kind, reward)serverAfter a successful robbery, with the cash and items paid.
OnAlarm(data, src)serverWhen the police get the call, with the suspect description (used for lb-tablet).
CanRob(kind, storeId)clientBefore anything starts. Blocks dead, cuffed or in-vehicle players by default.
SkillCheck(difficulty)clientThe register and shelf skill check.
SafeMinigame(params, safeCoords)clientThe 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.

FunctionGetsMust return
SkillCheck(difficulty)The skillCheck list of that register or shelftrue passed, false failed
SafeMinigame(params, safeCoords)params is your R.Safe tabletrue 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)
end

The 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).

ActionWhat it does
statusOne line per robbed store: clerk state, cooldowns and shelves searched
reset <id>Reset one store
reset allReset every store