Summer 2026 Music Kit Competition is now here! - Create a summer themed electronic music kit and submit it by - Enter Now!
CS exposes Counter-Strike gamemode state and synchronous gameplay events. It is available only when the server loads the Counter-Strike project integration. Use Instance.IsAvailable("CS") when a script may run outside that environment; see optional APIs.
The complete Counter-Strike export set is CS, CSTeam, CSRoundEndReason, CSWeaponType, CSRoundState, CSGearSlot, and CSDamageFlags. The enums are documented on the Enums page.
| Function | Returns | Description |
|---|---|---|
CS.GetRoundState() |
CSRoundState | Current round state. |
CS.SetRoundState(state) |
undefined | Changes the current round state to a CSRoundState value. |
CS.GetRoundRemainingTime() |
number | Remaining round time in seconds. |
CS.SetRoundRemainingTime(time) |
undefined | Sets the remaining round time in seconds. |
CS.GetRoundsLeft() |
number | Number of rounds left. |
CS.GetRoundsPlayed() |
number | Number of rounds played so far. |
CS.IsFreezePeriod() |
boolean | Whether the current round is in freeze time. |
CS.IsWarmupPeriod() |
boolean | Whether the match is in warmup. |
CS.GetGameType() |
number | Current project game-type identifier. |
CS.GetGameMode() |
number | Current project game-mode identifier. |
Each CS.On... function registers a callback on the current script instance. Registrations last until that script is reloaded or destroyed.
| Function | Callback | Description |
|---|---|---|
CS.OnRoundStart(callback) |
() |
A new round has started. |
CS.OnRoundEnd(callback) |
(winningTeam, reason) |
A round has ended. winningTeam is a CSTeam value and reason is a CSRoundEndReason. |
CS.OnBombPlant(callback) |
(plantedC4, planter) |
The bomb was planted. Receives the planted Entity and PlayerEntity. |
CS.OnBombDefuse(callback) |
(plantedC4, defuser) |
The bomb was defused. Receives the planted Entity and PlayerEntity. |
CS.OnModifyPlayerDamage(callback) |
(event) |
Runs immediately before player damage is applied. May return a ModifyPlayerDamageResult. |
CS.OnPlayerDamage(callback) |
(event) |
A player was damaged. Receives a CSPlayerDamageEvent. |
CS.OnPlayerKill(callback) |
(event) |
A player was killed. Receives a CSPlayerKillEvent. |
CS.OnPlayerPing(callback) |
(player, position) |
A player pinged a world Vector. |
CS.OnGunReload(callback) |
(player, weapon) |
A player reloaded a WeaponEntity. |
CS.OnGunFire(callback) |
(player, weapon) |
A player fired a WeaponEntity. |
CS.OnBulletImpact(callback) |
(player, weapon, position, hitEntity) |
A bullet impacted a surface or entity. hitEntity may be undefined. |
CS.OnGrenadeThrow(callback) |
(player, weapon, projectile) |
A grenade projectile was created. |
CS.OnGrenadeBounce(callback) |
(player, projectile, bounces) |
A grenade projectile bounced; bounces is its bounce count. |
CS.OnKnifeAttack(callback) |
(player, weapon) |
A knife attack occurred, including attacks that miss. |
Damage modification is synchronous. Return only the fields that should change, or return undefined for no change:
import { CS, CSDamageFlags } from "lambda_script/point_script";
CS.OnModifyPlayerDamage((event) => {
if (event.player.IsBot()) {
return {
damage: event.damage * 0.5,
damageFlags: event.damageFlags | CSDamageFlags.PREVENT_DEATH,
};
}
});
These interfaces describe the plain JavaScript objects passed to CS event listeners. Property names are case-sensitive.
ModifyPlayerDamageEventPassed to CS.OnModifyPlayerDamage before armor and health damage are applied:
| Property | Type | Description |
|---|---|---|
player |
PlayerEntity | Player about to take damage. |
damage |
number | Pending damage amount. |
damageTypes |
DamageType | Bitmask composed from DamageType values. |
damageFlags |
CSDamageFlags | Bitmask composed from CSDamageFlags values. |
hitGroup |
HitGroup | Hit location. |
inflictor |
Entity | Entity that inflicted the damage. |
attacker |
Entity or undefined | Attacking entity, when available. |
weapon |
WeaponEntity or undefined | Weapon responsible for the damage, when available. |
ModifyPlayerDamageResultAn OnModifyPlayerDamage callback may return a plain object containing any combination of these optional fields:
| Property | Type | Description |
|---|---|---|
abort |
boolean | When true, cancels the damage event. |
damage |
number | Replaces the pending damage amount. |
damageTypes |
DamageType | Replaces the damage-type bitmask. |
damageFlags |
CSDamageFlags | Replaces the Counter-Strike damage-flag bitmask. |
Returning undefined, null, or no value means that listener proposes no changes.
CSPlayerDamageEventPassed to CS.OnPlayerDamage after player damage occurs. It has the same fields as ModifyPlayerDamageEvent, but is a notification and has no result contract:
{
player: PlayerEntity,
damage: number,
damageTypes: DamageType,
damageFlags: CSDamageFlags,
hitGroup: HitGroup,
inflictor: Entity,
attacker?: Entity,
weapon?: WeaponEntity,
}
CSPlayerKillEventPassed to CS.OnPlayerKill:
{
IsSuicide: boolean,
Attacker: {
Blinded: boolean,
ID: string,
Name: string,
Color: Color,
Weapon: string,
},
HasAssist: boolean,
Assist: {
ID: string,
Name: string,
Color: Color,
Flash: boolean,
},
Kill: {
IsNoScope: boolean,
WentThroughSmoke: boolean,
Penetrated: boolean,
Headshot: boolean,
InAir: boolean,
},
Victim: {
ID: string,
Name: string,
Color: Color,
},
}
EntityDamageEventThe declarations also provide a generic damage shape for compatible project-specific events:
{
damage: number,
damageTypes: DamageType,
damageFlags: CSDamageFlags,
inflictor?: Entity,
attacker?: Entity,
weapon?: WeaponEntity,
}
None of the currently documented CS.On... listeners directly use EntityDamageEvent; it is available for project extensions that adopt the same damage contract.