Commands/Lua

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

CS2D Command CS2D Console Commands

CS2D Command mp_hudscale

Categories

Parameters

  • Scale mode (0-3): (How) is custom HUD stuff scaled?

Info

Server setting to control how scripted HUD elements are scaled.

This setting affects: hudtxt, hudtxt2, Lua HUD images and also reqcld mode 0 (mouse position).

mp_hudscale has been implemented for backward compatibility with old CS2D versions. In CS2D 1.0.0.3 the standard game resolution has been changed to 850x480. In older versions it was 640x480. Therefore scripts drawing HUD elements need to be adjusted. This setting can be used with the value 2 or 3 if you want to simply scale or center the graphics from old scripts without adjusting the script itself.

The following modes are supported:
  • 0 - no scaling, default
  • 1 - scale to fit screen if script is written for 850x480 resolution
  • 2 - scale to fit screen if script is written for 640x480 resolution (use this for old scripts)
  • 3 - no scaling but center to fit screen if script is written for 640x480 resolution (use this for old scripts)


Note: Take a look at the Lua sample sys/lua/samples/hudimg.lua to get a better understanding of this setting!
Note: You can use player(id, "screenw") and player(id, "screenh") to get the actual game resolution of a player in your Lua scripts! This is especially useful for mode 0!

Lua Hook Lua Hooks

Lua Command Lua Commands