Skip to content
Documentation
R_Npcrobbery

r_npcrobbery Exports & Commands

r_npcrobbery server exports, the hooks in the custom files and the admin command with its test mode.

Server exports

IsRobbing

true while that player is robbing a citizen.

if exports.r_npcrobbery:IsRobbing(source) then
    -- robbery in progress
end

ResetCooldown

Ends the robbery cooldown of one player, or of everyone with 'all'. Returns true.

exports.r_npcrobbery:ResetCooldown(source)
exports.r_npcrobbery:ResetCooldown('all')

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, kind, netId)serverBefore a robbery starts. Return false to block it.
OnRobbed(src, class, how, reward)serverAfter the wallet or the jewelry is taken, with the cash and items paid.
OnAlarm(data, src)serverWhen the police get the call (used for lb-tablet).
SuspectDescription(traits)serverThe robber description in the police alert.
CanRob(kind, ped)clientBefore a robbery starts. Blocks dead, cuffed or in-vehicle players by default.
SkillCheck(difficulty)clientThe skill check when R.Robbery.skillCheck is set.
Dispatch(data)clientSends the alert to your dispatch. Add your own under custom.

class is 'rich', 'gang', 'poor' or 'default'. how is 'caught the wallet', 'picked up the wallet' or 'took the jewelry'.

Admin command

/npcrobbery <action> for R.Admin.group (admin and god by default).

ActionWhat it does
statusOne line per robbery going on: player, phase, class and reaction
reset <player id>End that player's robbery and cooldown
reset allEnd every robbery and cooldown
test <reaction> [class]Test mode for you: every citizen reacts with comply, flee, fight, draw or random, no cooldown, every jewelry item drops
test offBack to normal