Hosting and domain costs until October 2024 have been generously sponsored by dumptruck_ds. Thank you!
Difference between revisions of "cvar"
From Quake Wiki
m (Redirect to DP_QC_CVAR_STRING instead of cvar_string.) |
|||
Line 1: | Line 1: | ||
− | + | ''float'' '''cvar'''(''string'' name) | |
− | |||
− | + | == Usage == | |
+ | Gets the value of a console variable as a number. For variables that aren't numbers this will always return 0. | ||
− | + | === Parameters === | |
− | + | *''name'' | |
− | + | :The name of the console variable. | |
− | : | ||
+ | === Return === | ||
+ | The value of the console variable. | ||
+ | |||
+ | == Example == | ||
+ | // Get the current gravity | ||
+ | float gravity = cvar("sv_gravity"); | ||
[[Category:QuakeC Function]] | [[Category:QuakeC Function]] |
Revision as of 14:46, 1 August 2023
float cvar(string name)
Contents
Usage
Gets the value of a console variable as a number. For variables that aren't numbers this will always return 0.
Parameters
- name
- The name of the console variable.
Return
The value of the console variable.
Example
// Get the current gravity float gravity = cvar("sv_gravity");