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
endResetCooldown
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:
| Function | File | When |
|---|---|---|
CanRob(src, kind, netId) | server | Before a robbery starts. Return false to block it. |
OnRobbed(src, class, how, reward) | server | After the wallet or the jewelry is taken, with the cash and items paid. |
OnAlarm(data, src) | server | When the police get the call (used for lb-tablet). |
SuspectDescription(traits) | server | The robber description in the police alert. |
CanRob(kind, ped) | client | Before a robbery starts. Blocks dead, cuffed or in-vehicle players by default. |
SkillCheck(difficulty) | client | The skill check when R.Robbery.skillCheck is set. |
Dispatch(data) | client | Sends 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).
| Action | What it does |
|---|---|
status | One line per robbery going on: player, phase, class and reaction |
reset <player id> | End that player's robbery and cooldown |
reset all | End 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 off | Back to normal |