Cvars: Add bind_pcvar_num/float/string

This commit is contained in:
Arkshine
2015-01-24 21:28:43 +01:00
parent 8ebb7be36d
commit cb0b9da51f
6 changed files with 244 additions and 22 deletions

View File

@ -89,7 +89,7 @@ native cvar_exists(const cvar[]);
native get_cvar_pointer(const cvar[]);
/**
* Creates a hook for when a console variable's value is changed.
* Creates a hook for when a cvar's value is changed.
*
* @note Callback will be called in the following manner:
*
@ -394,6 +394,40 @@ native bool:get_pcvar_bounds(pcvar, CvarBounds:type, &Float:value);
*/
native set_pcvar_bounds(pcvar, CvarBounds:type, bool:set, Float:value = 0.0);
/**
* Binds a cvar to a global integer variable.
* This means that variable will be automagically updated on cvar's value change.
*
* @param pcvar Pointer to cvar
* @param var Global variable to update to
*
* @error Invalid cvar pointer, invalid provided variable or cvar/variable already binded.
*/
native bind_pcvar_num(pcvar, &any:var);
/**
* Binds a cvar to a global float variable.
* This means that variable will be automagically updated on cvar's value change.
*
* @param pcvar Pointer to cvar
* @param var Global variable to update to
*
* @error Invalid cvar pointer, invalid provided variable or cvar/variable already binded.
*/
native bind_pcvar_float(pcvar, &Float:var);
/**
* Binds a cvar to a global string variable.
* This means that variable will be automagically updated on cvar's value change.
*
* @param pcvar Pointer to cvar
* @param var Global variable to update to
* @param varlen Maximum length of string buffer
*
* @error Invalid cvar pointer, invalid provided variable or cvar/variable already binded.
*/
native bind_pcvar_string(pcvar, any:var[], varlen);
/**
* Returns the number of plugin-registered cvars.
*