Entities module exposes the game’s entity list. Every entity is backed
by a cached snapshot that is refreshed each frame - reads are fast and
safe to call in per-frame callbacks without worrying about memory access.
Entity objects are lazy - they hold an index, not a pointer. The
actual data is fetched from the per-frame cache on first property access.
Always check
.isValid before reading fields in contexts where an entity
might have just died or despawned.Overview
Fetching entities
Get all entities, look up by index, or grab players.
Query builder
Chain class filters and iterators - forEach, map, filter, first.
Entity object
Reserved properties, helper methods, schema fields, and raw-buffer API.
Supported field types
How the engine maps every C++ type to a JS value.
Fetching entities
Entities.getByIndex
Entity handle for a given entity list index. The entity may or
may not be valid - always check .isValid.
Entities.getEntities
Entities.getPlayers
C_CSPlayerPawn and
C_CSObserverPawn). Each element is the pawn entity - use .controller
to reach the CCSPlayerController.
Entities.getLocalPlayer
null if not in-game.
Query builder
Entities.find() returns a Query - a lazy, chainable object that filters
entities from the snapshot. Nothing is read until you call a terminal method
(toArray, forEach, first, count, map, some, every).
Entities.find
Query methods
Entity object
Every value returned by theEntities API is an Entity - a dynamic
proxy that reads fields directly from the per-frame entity cache.
Reserved properties
These are always present regardless of the entity’s class:Entity methods
Available on all entities..isEnemy
other is an enemy. Respects mp_teammates_are_enemies.
.getOrigin
.getVelocity
.getBoundingBox
[mins, maxs] for the entity, or null if it’s
behind the camera.
.getModelName
"characters/models/ctm_fbi/ctm_fbi.vmdl"). Returns
null if the scene node or model is invalid.
.getBone / .getBones
getBones() returns every bone as an
array; getBone(id) returns a single bone by index and only reads the
32 bytes for that bone, which is much cheaper if you need just one.
Both return null when the scene, model, or bone array is invalid.
getBone also returns null when id is out of range.
- Bone shape
- All bones
- Single bone
.getHitbox / .getHitboxes
getHitboxes() returns every hitbox;
getHitbox(id) returns a single hitbox by index (0 .. length - 1)
and only touches the one bone needed to resolve start / end.
getHitboxes() returns null on error or [] when the model has no
hitboxes. getHitbox returns null when id is out of range or the
bone / model is invalid.
- Hitbox shape
- All hitboxes
- Single hitbox
Static fields (cached per model):
Dynamic fields (recomputed each call):
Player methods
Available on player pawns (C_CSPlayerPawn, C_CSObserverPawn).
.controller
CCSPlayerController linked to this pawn.
.getEyePosition
.isVisible
other’s origin.
Weapon methods
Available on weapons (C_BasePlayerWeapon).
.getWeaponData
damage, range, spread, weaponType,
price, and all schema fields.
Schema fields
Any field in the entity’s C++ class hierarchy is accessible by name directly on the entity object. The engine resolves the field through the full inheritance chain automatically.CUtlVector fields
Fields of typeCUtlVector (or CNetworkUtlVectorBase) return a
UtlVector object - a lazy wrapper around the native array that
reads elements on demand.