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

Category: basic (14)

Lua Command reqcld

Categories

Parameters

  • id
  • mode
  • [parameter] (optional)

Info

reqcld is short for "request client data". This command requests data from a single player client (id=player id) or from all clients (id=0).

Mode specifies which data the server will receive:

  • Mode 0: Cursor position (cursor position on screen in pixels, scaled based on mp_hudscale)
    Deprecated: It is recommended to use player with parameters "mousex"/"mousey" instead!

  • Mode 1: Map scrolling (scrolling offset in pixels)

  • Mode 2: Absolute cursor position (cursor position on map in pixels, NOT influenced by mp_hudscale)
    Deprecated: It is recommended to use player with parameters "mousemapx"/"mousemapy" instead!

  • Mode 3: 1 if the client has the advanced light engine enabled, 0 otherwise (second value always 0)

  • Mode 4: 1 if the file specified with parameter (file path relative to the CS2D folder) has been loaded, 0 otherwise; checksum of the file (only if the file is under gfx/ or sfx/) as provided by checksumfile

  • Mode 5: Mod info

  • Mode 6: 1 if the client has 3D rendering (render3d) enabled, 0 otherwise (second value always 0)


The last parameter is not required for all modes. For some modes (mode 4) it is crucial though. Please read the descriptions of the modes to learn when and how it is used.

The requested data will be received with a delay. This is because it is sent over the network. You have to use the clientdata-hook to handle the incoming data!

Note: reqcld-data is guaranteed to arrive (unless the client is unreachable).

Note: The last parameter is optional and only required/used by some of the modes.

Note: mode 0 / mode 2: Please check if you can use the player Lua command instead. It allows you to get "mousex"/"mousey" or "mousemapx"/"mousemapy" as well without causing additional network traffic!

Attention: This command uses reliable UDP packets. Using it too frequently might lead to lags or ping spikes!

Attention: Keep in mind that all values sent by the client might be manipulated by hacks or other software. You can't trust them 100%!