Skip to content

Events, commands & keys ​

Server events ​

server

Server-local (AddEventHandler), never sent over the network. Event payloads carry gang in the GetGangById shape and turf in the GetTurfAt shape, except bandanaChanged, stashSwitched, the takeover events, protectionCollected and tagSprayed, which carry gang ids.

Event Payload
np_gangs:server:ready none
np_gangs:server:gangCreated / gangDissolved { gang }
np_gangs:server:memberJoined / memberLeft { gang, identifier, rank }
np_gangs:server:bandanaChanged { source, identifier, gang, on }
np_gangs:server:turfChanged { turf, from, to, reason = 'lester' | 'takeover' | 'decay' | 'dissolve' | 'admin' }
np_gangs:server:takeoverStarted / takeoverDecided { turf, attackers, defenders, winner?, loot? = { percent, items = { { name, count } } } } (loot only when the attackers won)
np_gangs:server:shopFlipped { turf, shop, from, to } (shop is the shop record)
np_gangs:server:protectionCollected { source, gang, shop, amount, collectorCut }
np_gangs:server:stashSwitched { gang, from, to, by } (shop ids; to nil = Lester holds it; by an identifier or 'takeover' / 'admin' / 'lester')
np_gangs:server:tagSprayed { source, gang, turf, wall, over } (over = gang id whose tag was painted over)
np_gangs:server:witness { kind = 'rob' | 'bandana', coords, turf, color, print, description }: what witnesses and dispatch get of a robbery. The colour, never a name and never a player id. Also passed to Config.Rob.dispatch
lua
-- a robbery reaches your dispatch with the colour only
AddEventHandler('np_gangs:server:witness', function(report)
  exports.my_dispatch:Send(report.coords, report.description)
end)

-- log turf changes to your own staff channel
AddEventHandler('np_gangs:server:turfChanged', function(e)
  print(('turf %s: %s -> %s (%s)'):format(e.turf.id, tostring(e.from), tostring(e.to), e.reason))
end)

np_gangs' own hooks are on Exports & hooks.

Client events ​

client

Client-local, fired by np_gangs' turf tracking:

Event Arguments
np_gangs:client:turfEntered turf
np_gangs:client:turfLeft turf

Net events ​

Internal between np_gangs' client and server. Listed so you know what they are; don't trigger or listen to them from other resources.

Direction Event Payload / purpose
client → server np_gangs:rpc reqId, method, params: every RPC
client → server np_gangs:ready Client loaded
server → client np_gangs:rpcResult reqId, ok, dataOrError
server → client np_gangs:init / state / gang / turfs Player, gang and turf state (NUI contract)
server → client np_gangs:sync key, data: module state
server → client np_gangs:nui action, data: server-pushed NUI messages
server → client np_gangs:notify / waypoint Fallback toast; a waypoint
server → client np_gangs:lester { id, coords, radius } | false, only to players within 150 m of him
server → client np_gangs:bandana:use / bandana:forced The item was used; the bandana came off (lost, dissolved, admin)
server → client np_gangs:trial:drive / wave / patrol / end Trial: task the NPC driver, spawn a wave, the patrol, the job is over
server → client np_gangs:trusted:offer / offerEnd The card asking to become trusted or to take a bandana
server → client np_gangs:admin:open { tab?, gang? }: an np_admin staff tool opens the editor (the client asks again, the server checks the node)

State bags ​

State bag Value
Player(src).state.npgBandana { gang, color, print, style } or false (replicated)
Player(src).state.npgHandsUp Set by np_gangs' client while the hands-up animation plays, so robbing works without np_inventory too

Commands and keys ​

Command / key Who What
G (hold) / /gangmenu Members in colours The street menu. Rebind in the GTA key settings
E at Lester Everybody near him Talk to him (a list when he has more than one thing to say). The option is np_npchandler's and only shows while he has something for you
E / H / Y in a protected shop Members in colours Collect · back room (at the stashout) · members' price
E / N on a corner The seller Serve the customer · wave them off
/searchspot (bindable, no default key) Everybody Search the spot you stand at (a corner drop opens for anyone who finds it)
/gangadmin Staff (any np_gangs.* node) The staff editor (also in np_menu's radial for staff, and np_admin's staff tools)
gangadmin_export [file], gangadmin_import <file> [replace], gangadmin_seed [replace] Server console Layouts (Staff editor → Console)

Every Lester screen and editor shows its keys at the bottom: arrow keys and number keys to pick, ENTER / E to confirm, ESC to leave.