Commands/Lua

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

CS2D Command CS2D Console Commands

Lua Hook Lua Hooks

Lua Command Lua Commands

Lua Command player

Categories

Parameters

  • id
  • "value"

Info

Returns a value of a player:

  • exists: boolean, true if player with this ID exists, false otherwise
  • name: name of the player
  • ip: IP address of the player
  • port: Port of the player
  • usgn: Unreal Software Gaming Network / UnrealSoftware.de user ID (0 if not logged in)
  • usgnname: Unreal Software Gaming Network / UnrealSoftware.de user name ("" if not logged in)
  • steamid: Steam ID as string ("0" if not logged in)
  • steamname: Steam user name ("" if not logged in)
  • mousex: player mouse x screen position (-1 if not available)
  • mousey: player mouse y screen position (-1 if not available)
  • mousemapx: player mouse x position on map (-1 if not available)
  • mousemapy: player mouse y position on map (-1 if not available)
  • mousedist: distance between player and player mouse (-1 if not available)
  • ping: current ping (ms)
  • idle: idle time (no movement) in seconds
  • bot: boolean, true if player is a bot, false otherwise
  • team: 0 for spec, 1 for t, 2 for ct, 3 for VIP (ct)
    CS2D Teams
  • look: player look (0-3) = selected skin
  • x: current x position on map (in pixels)
  • y: current y position on map (in pixels)
  • rot: current rotation angle
  • tilex: current x position on map (in tiles)
  • tiley: current y position on map (in tiles)
  • health: health value
  • armor: armor value
  • money: money value
  • score: score (kills+mission goals)
  • deaths: number of deaths
  • teamkills: teammates killed
  • hostagekills: hostages killed
  • teambuildingkills: buildings of own team killed
  • mvp: number of rounds the player was the most valuable player
  • assists: number of kill assists
  • weapontype: type of current weapon
  • nightvision: boolean, true if has a nightvision, false otherwise
  • defusekit: boolean, true if has a defusekit, false otherwise
  • gasmask: boolean, true if has a gasmask, false otherwise
  • bomb: boolean, true if has bomb, false otherwise
  • flag: boolean, true if has a flag, false otherwise
  • reloading: boolean, true if is currently reloading, false otherwise
  • process: current process (internal id for reloading/planting/defusing...)
    • 1 - Start bomb planting
    • 2 - Cancel bomb planting
    • 3 - End bomb planting
    • 4 - Cancel bomb defuse
    • 5 - End bomb defuse
    • 6 - Bomb explode
  • sprayname: name of spaylogo
  • spraycolor: color of spraylogo
  • votekick: ID of the player the player voted to kick (or 0 if player did not vote to kick anyone)
  • votemap: name of the map the player voted for (or empty string if player did not vote for a map)
  • favteam: favorite team
  • spectating: ID of player currently being spectated
  • speedmod: speedmod value
  • maxhealth: maximum health
  • rcon: boolean, true if logged in with correct RCon password, false otherwise
  • spectating: ID of the player this player is currently spectating / was spectating last
  • ai_flash: how long (in seconds) is this bot flashed by a flashbang (0 for not flashed)
  • screenw: the game screen width (in pixels) of this player. Only game area, possible borders not included.
  • screenh: the game screen height (in pixels) of this player. Only game area, possible borders not included.


Moreover there is:

  • player(0,"table"): a Lua table with all player IDs
  • player(0,"tableliving"): a Lua table with all living player IDs
  • player(0,"team1"): a Lua table with all terrorist IDs
  • player(0,"team2"): a Lua table with all counter-terrorist IDs
  • player(0,"team1living"): a Lua table with all living terrorist IDs
  • player(0,"team2living"): a Lua table with all living counter-terrorist IDs


Sample 1: Using the player table to list the names of all players
local playerlist=player(0,"table")
for _,id in pairs(playerlist) do
   print(player(id,"name"))
end