Reference for console commands, Lua hooks and Lua commands in CS2D.

CS2D Command CS2D Console Commands

Lua Hook Lua Hooks

Lua Hook turretscan



  • turret object id: id of turret which is scanning the environment for targets
  • turret team: 0 = neutral, 1 = terrorist, 2 = counter-terrorist
  • turret x position: X position of turret on map (center of turret in pixels)
  • turret y position: Y position of turret on map (center of turret in pixels)


Executed whenever a turret scans the environment for an enemy.
The default behavior (which kicks in when returning 0) is to attack the closest enemy which is in sight.

You can return a player ID (1-32) to attack that specific player or -1 to attack no player at all.

Note: Specifying an allied player will make the turret shoot at the player but depending on settings (friendly fire) he might not get hurt

Note: Turrets can only attack players and no specific positions or objects

Return Values

  • 0: proceed normally (normal scan & attack closest enemy player)
  • 1-32: attack player with that ID (may not cause damage depending on team)
  • -1: stay idle and attack nobody

Lua Command Lua Commands