Skip to content

Events, state bags & commands ​

Client events ​

client

Local events (AddEventHandler), fired on the player's own client:

Event Arguments Fired when
np_ccs:stanceChanged new, old, proneType The stance changed. proneType is 'front' / 'back' when new is 'prone', else nil. A roll between front and back fires it with new == old == 'prone'
np_ccs:deployChanged deployed, weaponClass The weapon went up (true) or down (false) while prone
np_ccs:shotFired weaponHash, to A prone shot was fired. to is the impact point (vector3). np_inventory uses it for durability
crouch_crawl:onCrouch crouched Legacy, with Config.Compat.legacyEvents. true on entering crouch, false on leaving it
crouch_crawl:onCrawl prone Legacy, with Config.Compat.legacyEvents. true on entering prone, false on leaving it
lua
AddEventHandler('np_ccs:stanceChanged', function(new, old, proneType)
  print(('stance %s -> %s (%s)'):format(old, new, proneType or '-'))
end)

AddEventHandler('np_ccs:deployChanged', function(deployed, class)
  if deployed and class == 'sniper' then
    -- e.g. hide your own crosshair UI
  end
end)

Listened to:

Event Arguments Description
np_ccs:block reason, on Same as BlockStance(reason) / UnblockStance(reason). on = false removes the block, anything else adds it
np_inventory:currentWeapon, ox_inventory:currentWeapon item | nil nil (holstered) lowers a deployed weapon
playerSpawned, esx:onPlayerSpawn Back to standing without animation
esx:onPlayerLogout, QBCore:Client:OnPlayerUnload, np_character:unloaded Back to standing, and no stance until the character is loaded again
lua
TriggerEvent('np_ccs:block', 'cutscene', true)
TriggerEvent('np_ccs:block', 'cutscene', false)

Net events ​

These are internal. Listed so you know what they are; don't trigger them yourself.

Event Direction Arguments Purpose
np_ccs:shot client → server { weapon, class, from, to, seq } Report of a prone shot for validation
np_ccs:shotRelay server → clients in range src, weapon, from, to Accepted shot, for the remote muzzle flash
np_ccs:testkit:info both { onesync, version } /ccs_check asks the server for its OneSync mode. Only answered while the test kit is on

Server events ​

server

Event Arguments Fired when
np_ccs:suspicious src, reason, shot A prone shot failed validation, with Config.Server.log = 'event'. reason is one of the validation reasons
lua
AddEventHandler('np_ccs:suspicious', function(src, reason, shot)
  -- feed your anticheat or a Discord log
  print(('[ccs] %s: %s'):format(GetPlayerName(src), reason))
end)

State bags ​

Player state bags, set by the client with replication on, so other clients and the server can read them (Player(src).state.stance, Player(GetPlayerServerId(player)).state.stance).

Bag Values Description
stance 'stand' | 'crouch' | 'prone' Current stance
proneType 'front' | 'back' | nil nil unless prone
proneDeployed boolean Prone on the front with the weapon up. np_inventory skips its own reloads while it is true
isProne boolean Legacy (crouch_crawl), with Config.Compat.legacyStateBags
isCrouched boolean Legacy, with Config.Compat.legacyStateBags

The server validates every replicated change. An invalid value (a wrong type, an unknown stance) is reset to the standing values and logged. The stance bags are reset to standing when the resource stops.

lua
-- client: someone else's stance
local stance = Player(GetPlayerServerId(player)).state.stance

-- client: react to your own changes without depending on the resource
AddStateBagChangeHandler('proneDeployed', ('player:%s'):format(GetPlayerServerId(PlayerId())), function(_, _, value)
  print('deployed', value)
end)

np_hud draws its stance chip from stance, proneType and proneDeployed.

Read, not written: the common downed and cuffed bags (isDead, dead, downed, isDowned, inLastStand, handcuffed, isCuffed, cuffed), npd_overdose (np_drugs), invOpen and invBusy (np_inventory) and handsUp.

Key mappings ​

Mapping Default Description
+np_crouch LCONTROL Stance: crouch
+np_prone Z Stance: prone (hold to stand up)

See Controls → Rebinding.

Commands ​

Command Side Description
/ccs_check client Animation, pose pack, integration and OneSync report. See In-game test kit
/ccs_spike engine|pose|shoot|bullet|capsule|stop client The six sync spikes. See In-game test kit

Both commands only exist with Config.Debug = true or setr ccs_testkit 1 in server.cfg. There are no admin commands and no permissions to set up.