Cvars: De-frenchify by Nextra
This commit is contained in:
parent
a5b5c7e9cd
commit
1488b9747f
|
@ -155,7 +155,7 @@ void CvarManager::CreateCvarHook(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
CvarInfo* CvarManager::CreateCvar(const char* name, const char* value, const char* plugin, int pluginId, int flags,
|
CvarInfo* CvarManager::CreateCvar(const char* name, const char* value, const char* plugin, int pluginId, int flags,
|
||||||
const char* helpText, bool hasMin, float min, bool hasMax, float max)
|
const char* helpText, bool hasMin, float min, bool hasMax, float max)
|
||||||
{
|
{
|
||||||
cvar_t* var = nullptr;
|
cvar_t* var = nullptr;
|
||||||
CvarInfo* info = nullptr;
|
CvarInfo* info = nullptr;
|
||||||
|
@ -333,7 +333,7 @@ bool CvarManager::BindCvar(CvarInfo* info, CvarBind::CvarType type, AMX* amx, ce
|
||||||
{
|
{
|
||||||
if (varofs > amx->hlw) // If variable address is not inside global area, we can't bind it.
|
if (varofs > amx->hlw) // If variable address is not inside global area, we can't bind it.
|
||||||
{
|
{
|
||||||
LogError(amx, AMX_ERR_NATIVE, "A global variable must be provided");
|
LogError(amx, AMX_ERR_NATIVE, "Cvars can only be bound to global variables");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -349,7 +349,7 @@ bool CvarManager::BindCvar(CvarInfo* info, CvarBind::CvarType type, AMX* amx, ce
|
||||||
{
|
{
|
||||||
if (bind->varAddress == address)
|
if (bind->varAddress == address)
|
||||||
{
|
{
|
||||||
LogError(amx, AMX_ERR_NATIVE, "A same variable can't be binded with several cvars");
|
LogError(amx, AMX_ERR_NATIVE, "A global variable can not be bound to multiple Cvars");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -492,16 +492,15 @@ void CvarManager::OnConsoleCommand()
|
||||||
if (!indexToSearch)
|
if (!indexToSearch)
|
||||||
{
|
{
|
||||||
print_srvconsole("\nManaged cvars:\n");
|
print_srvconsole("\nManaged cvars:\n");
|
||||||
print_srvconsole(" %-24.23s %-24.23s %-18.17s %-8.7s %-8.7s %-8.7s\n", "NAME", "VALUE", "PLUGIN", "BINDED", "HOOKED", "BOUNDED");
|
print_srvconsole(" %-24.23s %-24.23s %-18.17s %-8.7s %-8.7s %-8.7s\n", "NAME", "VALUE", "PLUGIN", "BOUND", "HOOKED", "BOUNDED");
|
||||||
print_srvconsole(" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n");
|
print_srvconsole(" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (CvarsList::iterator iter = m_Cvars.begin(); iter != m_Cvars.end(); iter++)
|
for (CvarsList::iterator iter = m_Cvars.begin(); iter != m_Cvars.end(); iter++)
|
||||||
{
|
{
|
||||||
CvarInfo* ci = (*iter);
|
CvarInfo* ci = (*iter);
|
||||||
|
|
||||||
// List any cvars having a status either created, hooked, binded or bounded by a plugin.
|
// List any cvars having a status either created, hooked or bound by a plugin.
|
||||||
bool in_list = ci->amxmodx || !ci->binds.empty() || !ci->hooks.empty() || ci->bound.hasMin || ci->bound.hasMax;
|
bool in_list = ci->amxmodx || !ci->binds.empty() || !ci->hooks.empty() || ci->bound.hasMin || ci->bound.hasMax;
|
||||||
|
|
||||||
if (in_list && (!partialName.length() || strncmp(ci->plugin.chars(), partialName.chars(), partialName.length()) == 0))
|
if (in_list && (!partialName.length() || strncmp(ci->plugin.chars(), partialName.chars(), partialName.length()) == 0))
|
||||||
|
@ -538,19 +537,19 @@ void CvarManager::OnConsoleCommand()
|
||||||
|
|
||||||
if (ci->bound.hasMin)
|
if (ci->bound.hasMin)
|
||||||
{
|
{
|
||||||
print_srvconsole(" Min Bounded %-26.25s %f\n", g_plugins.findPlugin(ci->bound.minPluginId)->getName(), ci->bound.minVal);
|
print_srvconsole(" Min value %-26.25s %f\n", g_plugins.findPlugin(ci->bound.minPluginId)->getName(), ci->bound.minVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ci->bound.hasMax)
|
if (ci->bound.hasMax)
|
||||||
{
|
{
|
||||||
print_srvconsole(" Max Bounded %-26.25s %f\n", g_plugins.findPlugin(ci->bound.maxPluginId)->getName(), ci->bound.maxVal);
|
print_srvconsole(" Max value %-26.25s %f\n", g_plugins.findPlugin(ci->bound.maxPluginId)->getName(), ci->bound.maxVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ci->binds.empty())
|
if (!ci->binds.empty())
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < ci->binds.length(); ++i)
|
for (size_t i = 0; i < ci->binds.length(); ++i)
|
||||||
{
|
{
|
||||||
print_srvconsole(" Binded %-26.25s %s\n", g_plugins.findPlugin(ci->binds[i]->pluginId)->getName(), "-");
|
print_srvconsole(" Bound %-26.25s %s\n", g_plugins.findPlugin(ci->binds[i]->pluginId)->getName(), "-");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include "nongpl_matches.h"
|
#include "nongpl_matches.h"
|
||||||
|
|
||||||
char CVarTempBuffer[64];
|
char CVarTempBuffer[64];
|
||||||
const char *invis_cvar_list[5] = { "amxmodx_version", "amxmodx_modules", "amx_debug", "amx_mldebug", "amx_client_languages" };
|
const char *invis_cvar_list[5] ={ "amxmodx_version", "amxmodx_modules", "amx_debug", "amx_mldebug", "amx_client_languages" };
|
||||||
|
|
||||||
// create_cvar(const name[], const default_value[], flags = 0, const description[] = "", bool:has_min = false, Float:min_val = 0.0, bool:has_max = false, Float:max_val = 0.0)
|
// create_cvar(const name[], const default_value[], flags = 0, const description[] = "", bool:has_min = false, Float:min_val = 0.0, bool:has_max = false, Float:max_val = 0.0)
|
||||||
static cell AMX_NATIVE_CALL create_cvar(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL create_cvar(AMX *amx, cell *params)
|
||||||
|
@ -42,13 +42,13 @@ static cell AMX_NATIVE_CALL create_cvar(AMX *amx, cell *params)
|
||||||
|
|
||||||
if (!g_CvarManager.SetCvarMin(info, hasMin, minVal, plugin->getId()))
|
if (!g_CvarManager.SetCvarMin(info, hasMin, minVal, plugin->getId()))
|
||||||
{
|
{
|
||||||
LogError(amx, AMX_ERR_NATIVE, "A lower bound can't be above an upper bound");
|
LogError(amx, AMX_ERR_NATIVE, "The minimum value can not be above the maximum value");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!g_CvarManager.SetCvarMax(info, hasMax, maxVal, plugin->getId()))
|
if (!g_CvarManager.SetCvarMax(info, hasMax, maxVal, plugin->getId()))
|
||||||
{
|
{
|
||||||
LogError(amx, AMX_ERR_NATIVE, "An upper bound can't be below a lower bound");
|
LogError(amx, AMX_ERR_NATIVE, "The maximum value can not be below the minimum value");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -500,7 +500,7 @@ static cell AMX_NATIVE_CALL set_pcvar_bounds(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
if (!g_CvarManager.SetCvarMin(info, set, value, pluginId))
|
if (!g_CvarManager.SetCvarMin(info, set, value, pluginId))
|
||||||
{
|
{
|
||||||
LogError(amx, AMX_ERR_NATIVE, "A lower bound can't be above an upper bound");
|
LogError(amx, AMX_ERR_NATIVE, "The minimum value can not be above the maximum value");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -509,7 +509,7 @@ static cell AMX_NATIVE_CALL set_pcvar_bounds(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
if (!g_CvarManager.SetCvarMax(info, set, value, pluginId))
|
if (!g_CvarManager.SetCvarMax(info, set, value, pluginId))
|
||||||
{
|
{
|
||||||
LogError(amx, AMX_ERR_NATIVE, "An upper bound can't be below a lower bound");
|
LogError(amx, AMX_ERR_NATIVE, "The maximum value can not be below the minimum value");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -670,7 +670,6 @@ static cell AMX_NATIVE_CALL query_client_cvar(AMX *amx, cell *params)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AMX_NATIVE_INFO g_CvarNatives[] =
|
AMX_NATIVE_INFO g_CvarNatives[] =
|
||||||
{
|
{
|
||||||
{"create_cvar", create_cvar},
|
{"create_cvar", create_cvar},
|
||||||
|
|
|
@ -16,7 +16,6 @@ void amx_command()
|
||||||
|
|
||||||
if (!strcmp(cmd, "plugins") || !strcmp(cmd, "list"))
|
if (!strcmp(cmd, "plugins") || !strcmp(cmd, "list"))
|
||||||
{
|
{
|
||||||
|
|
||||||
print_srvconsole("Currently loaded plugins:\n");
|
print_srvconsole("Currently loaded plugins:\n");
|
||||||
print_srvconsole(" %-23.22s %-11.10s %-17.16s %-16.15s %-9.8s\n", "name", "version", "author", "file", "status");
|
print_srvconsole(" %-23.22s %-11.10s %-17.16s %-16.15s %-9.8s\n", "name", "version", "author", "file", "status");
|
||||||
|
|
||||||
|
@ -45,7 +44,8 @@ void amx_command()
|
||||||
{
|
{
|
||||||
//error
|
//error
|
||||||
print_srvconsole("(%3d) Load fails: %s\n", num, (*a).getError());
|
print_srvconsole("(%3d) Load fails: %s\n", num, (*a).getError());
|
||||||
} else if ( (*a).getStatusCode() == ps_error) {
|
}
|
||||||
|
else if ((*a).getStatusCode() == ps_error) {
|
||||||
//error
|
//error
|
||||||
print_srvconsole("(%3d) Error: %s\n", num, (*a).getError());
|
print_srvconsole("(%3d) Error: %s\n", num, (*a).getError());
|
||||||
}
|
}
|
||||||
|
@ -66,11 +66,11 @@ void amx_command()
|
||||||
{
|
{
|
||||||
if (plugin->isStopped())
|
if (plugin->isStopped())
|
||||||
{
|
{
|
||||||
print_srvconsole("Plugin \"%s\" is stopped and may not be paused.\n",plugin->getName());
|
print_srvconsole("Plugin \"%s\" is stopped and may not be paused.\n", plugin->getName());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print_srvconsole("Plugin \"%s\" is already paused.\n",plugin->getName());
|
print_srvconsole("Plugin \"%s\" is already paused.\n", plugin->getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -105,7 +105,8 @@ void amx_command()
|
||||||
else if (!plugin)
|
else if (!plugin)
|
||||||
{
|
{
|
||||||
print_srvconsole("Couldn't find plugin matching \"%s\"\n", sPlugin);
|
print_srvconsole("Couldn't find plugin matching \"%s\"\n", sPlugin);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
print_srvconsole("Plugin %s can't be unpaused right now.\n", sPlugin);
|
print_srvconsole("Plugin %s can't be unpaused right now.\n", sPlugin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -146,7 +147,7 @@ void amx_command()
|
||||||
++a;
|
++a;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print_srvconsole("%d commands\n",ammount);
|
print_srvconsole("%d commands\n", ammount);
|
||||||
}
|
}
|
||||||
else if (!strcmp(cmd, "version"))
|
else if (!strcmp(cmd, "version"))
|
||||||
{
|
{
|
||||||
|
@ -178,7 +179,7 @@ void amx_command()
|
||||||
int running = 0;
|
int running = 0;
|
||||||
int modules = 0;
|
int modules = 0;
|
||||||
|
|
||||||
CList<CModule,const char *>::iterator a = g_modules.begin();
|
CList<CModule, const char *>::iterator a = g_modules.begin();
|
||||||
|
|
||||||
while (a)
|
while (a)
|
||||||
{
|
{
|
||||||
|
@ -229,14 +230,16 @@ void amx_command()
|
||||||
print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3A\x78\x78\x24\x40\x4E\x4E\x4D\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x5E\x3E\x3E\x3F\x3E\x3E\x3E\x3E\x3B\x3B\x3B\x3A\x3A\x3F\x3E\x3A\x2E\x2E\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2E\x45\x4D\x40\x45\x78\x5E\x33\x68\x33\x2B\n");
|
print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3A\x78\x78\x24\x40\x4E\x4E\x4D\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x5E\x3E\x3E\x3F\x3E\x3E\x3E\x3E\x3B\x3B\x3B\x3A\x3A\x3F\x3E\x3A\x2E\x2E\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2E\x45\x4D\x40\x45\x78\x5E\x33\x68\x33\x2B\n");
|
||||||
print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x24\x48\x45\x48\x78\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2B\x4E\x40\x2B\x66\x33\x78\x20\x20\n");
|
print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x24\x48\x45\x48\x78\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2B\x4E\x40\x2B\x66\x33\x78\x20\x20\n");
|
||||||
print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2B\x2C\x20\x3A\x20\x20\n");
|
print_srvconsole("\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2B\x2C\x20\x3A\x20\x20\n");
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
print_srvconsole("Usage: amxx < command > [ argument ]\n");
|
print_srvconsole("Usage: amxx < command > [ argument ]\n");
|
||||||
print_srvconsole("Commands:\n");
|
print_srvconsole("Commands:\n");
|
||||||
print_srvconsole(" version - display amxx version info\n");
|
print_srvconsole(" version - display amxx version info\n");
|
||||||
print_srvconsole(" gpl - print the license\n");
|
print_srvconsole(" gpl - print the license\n");
|
||||||
print_srvconsole(" plugins - list plugins currently loaded\n");
|
print_srvconsole(" plugins - list plugins currently loaded\n");
|
||||||
print_srvconsole(" modules - list modules currently loaded\n");
|
print_srvconsole(" modules - list modules currently loaded\n");
|
||||||
print_srvconsole(" cvars [ plugin ] [ index ] - list cvars handled by amxx or show informations about a cvar if index is provided\n");
|
print_srvconsole(" cvars [ plugin ] [ index ] - list cvars handled by amxx or show information about a cvar if index is provided\n");
|
||||||
print_srvconsole(" cmds [ plugin ] - list commands registered by plugins\n");
|
print_srvconsole(" cmds [ plugin ] - list commands registered by plugins\n");
|
||||||
print_srvconsole(" pause < plugin > - pause a running plugin\n");
|
print_srvconsole(" pause < plugin > - pause a running plugin\n");
|
||||||
print_srvconsole(" unpause < plugin > - unpause a previously paused plugin\n");
|
print_srvconsole(" unpause < plugin > - unpause a previously paused plugin\n");
|
||||||
|
@ -254,7 +257,7 @@ void plugin_srvcmd()
|
||||||
if ((*a).matchCommand(cmd) && (*a).getPlugin()->isExecutable((*a).getFunction()))
|
if ((*a).matchCommand(cmd) && (*a).getPlugin()->isExecutable((*a).getFunction()))
|
||||||
{
|
{
|
||||||
cell ret = executeForwards((*a).getFunction(), static_cast<cell>(g_srvindex),
|
cell ret = executeForwards((*a).getFunction(), static_cast<cell>(g_srvindex),
|
||||||
static_cast<cell>((*a).getFlags()), static_cast<cell>((*a).getId()));
|
static_cast<cell>((*a).getFlags()), static_cast<cell>((*a).getId()));
|
||||||
if (ret) break;
|
if (ret) break;
|
||||||
}
|
}
|
||||||
++a;
|
++a;
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
// https://alliedmods.net/amxmodx-license
|
// https://alliedmods.net/amxmodx-license
|
||||||
|
|
||||||
#if defined _cvars_included
|
#if defined _cvars_included
|
||||||
#endinput
|
#endinput
|
||||||
#endif
|
#endif
|
||||||
#define _cvars_included
|
#define _cvars_included
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
/**
|
/**
|
||||||
* Creates a new cvar for the engine.
|
* Creates a new cvar for the engine.
|
||||||
*
|
*
|
||||||
* @note This is same as regitser_cvar but with more options.
|
* @note This has the same effect as register_cvar but provides more options.
|
||||||
* @note For a list of possible cvar flags see FCVAR_* constants above.
|
* @note For a list of possible cvar flags see FCVAR_* constants above.
|
||||||
* @note If an already existing cvar is registered it will not be duplicated.
|
* @note If an already existing cvar is registered it will not be duplicated.
|
||||||
* @note The returned cvar pointer should be used with the get_pcvar_* and
|
* @note The returned cvar pointer should be used with the get_pcvar_* and
|
||||||
|
@ -38,12 +38,12 @@
|
||||||
*
|
*
|
||||||
* @param name Cvar name
|
* @param name Cvar name
|
||||||
* @param string Default cvar value
|
* @param string Default cvar value
|
||||||
* @param flags Optional bitstring of flags determining how the convar should be handled
|
* @param flags Optional bitsum of flags specifying cvar behavior
|
||||||
* @param description Optional description of the cvar
|
* @param description Optional description of the cvar
|
||||||
* @param has_min Optional boolean that determines if the convar has a minimum valu
|
* @param has_min Optional boolean that specifies if the cvar has a minimum value
|
||||||
* @param min_val Minimum floating point value that the convar can have if has_min is true
|
* @param min_val Minimum floating point value
|
||||||
* @param has_max Optional boolean that determines if the convar has a maximum value
|
* @param has_max Optional boolean that specifies if the cvar has a maximum value
|
||||||
* @param max_val Maximum floating point value that the convar can have if has_max is true
|
* @param max_val Maximum floating point value
|
||||||
*
|
*
|
||||||
* @return Unique cvar pointer
|
* @return Unique cvar pointer
|
||||||
*/
|
*/
|
||||||
|
@ -60,7 +60,7 @@ native create_cvar(const name[], const string[], flags = FCVAR_NONE, const descr
|
||||||
*
|
*
|
||||||
* @param name Cvar name
|
* @param name Cvar name
|
||||||
* @param string Default cvar value
|
* @param string Default cvar value
|
||||||
* @param flags Cvar flags
|
* @param flags Optional bitsum of flags specifying cvar behavior
|
||||||
* @param fvalue Unused
|
* @param fvalue Unused
|
||||||
*
|
*
|
||||||
* @return Unique cvar pointer
|
* @return Unique cvar pointer
|
||||||
|
@ -91,9 +91,8 @@ native get_cvar_pointer(const cvar[]);
|
||||||
/**
|
/**
|
||||||
* Creates a hook for when a cvar's value is changed.
|
* Creates a hook for when a cvar's value is changed.
|
||||||
*
|
*
|
||||||
* @note You cannot prevent cvar changes from happening, you can only change the value again.
|
* @note Changing the cvar value from within this forward can lead to infinite
|
||||||
* @note Be careful not to set a cvar inside a cvar change hook such that
|
* recursion and should be avoided.
|
||||||
* it re-invokes he same callback. This results in infinite recursion.
|
|
||||||
* @note Callback will be called in the following manner:
|
* @note Callback will be called in the following manner:
|
||||||
*
|
*
|
||||||
* public cvar_change_callback(pcvar, const old_value[], const new_value[])
|
* public cvar_change_callback(pcvar, const old_value[], const new_value[])
|
||||||
|
@ -102,16 +101,20 @@ native get_cvar_pointer(const cvar[]);
|
||||||
* old_value - String containing the value of the cvar before it was changed
|
* old_value - String containing the value of the cvar before it was changed
|
||||||
* new_value - String containing the new value of the cvar
|
* new_value - String containing the new value of the cvar
|
||||||
*
|
*
|
||||||
|
* The return value is ignored
|
||||||
|
*
|
||||||
* @param pcvar Pointer to cvar
|
* @param pcvar Pointer to cvar
|
||||||
* @param callback Name of callback function
|
* @param callback Name of callback function
|
||||||
* @error Invalid pointer or invalid callback function
|
*
|
||||||
|
* @return Callback handle that can be used with [disable|enable]_cvar_hook
|
||||||
|
* @error Invalid cvar pointer or invalid callback function
|
||||||
*/
|
*/
|
||||||
native cvarhook:hook_cvar_change(pcvar, const callback[]);
|
native cvarhook:hook_cvar_change(pcvar, const callback[]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stops a cvar hook forward from triggering.
|
* Stops a cvar hook forward from triggering.
|
||||||
*
|
*
|
||||||
* @note Use the return value from hook_cvar_change as the parameter here.
|
* @note Use the handle returned by hook_cvar_change as the parameter here.
|
||||||
*
|
*
|
||||||
* @param handle Forward to stop
|
* @param handle Forward to stop
|
||||||
* @error Invalid hook handle
|
* @error Invalid hook handle
|
||||||
|
@ -121,7 +124,7 @@ native disable_cvar_hook(cvarhook:handle);
|
||||||
/**
|
/**
|
||||||
* Starts a cvar hook forward back up.
|
* Starts a cvar hook forward back up.
|
||||||
*
|
*
|
||||||
* @note Use the return value from hook_cvar_change as the parameter here.
|
* @note Use the handle returned by hook_cvar_change as the parameter here.
|
||||||
*
|
*
|
||||||
* @param handle Forward to back up
|
* @param handle Forward to back up
|
||||||
* @error Invalid hook handle
|
* @error Invalid hook handle
|
||||||
|
@ -390,16 +393,16 @@ native set_pcvar_string(pcvar, const string[]);
|
||||||
*/
|
*/
|
||||||
enum CvarBounds
|
enum CvarBounds
|
||||||
{
|
{
|
||||||
CvarBound_Upper = 0,
|
CvarBound_Upper = 0,
|
||||||
CvarBound_Lower
|
CvarBound_Lower
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the specified bound of a cvar.
|
* Retrieves the specified value bounds of a cvar.
|
||||||
*
|
*
|
||||||
* @param pcvar Pointer to cvar
|
* @param pcvar Pointer to cvar
|
||||||
* @param type Type of bound to retrieve, CvarBound_Lower or CvarBound_Upper
|
* @param type Type of bound to retrieve, CvarBound_Lower or CvarBound_Upper
|
||||||
* @param value By-reference cell to store the specified floating point bound value
|
* @param value Variable to store the specified bound to
|
||||||
*
|
*
|
||||||
* @return True if the cvar has the specified bound set, false otherwise.
|
* @return True if the cvar has the specified bound set, false otherwise.
|
||||||
* @error If an invalid cvar pointer or CvarBounds value, an error is thrown.
|
* @error If an invalid cvar pointer or CvarBounds value, an error is thrown.
|
||||||
|
@ -407,7 +410,7 @@ enum CvarBounds
|
||||||
native bool:get_pcvar_bounds(pcvar, CvarBounds:type, &Float:value);
|
native bool:get_pcvar_bounds(pcvar, CvarBounds:type, &Float:value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the specified bound of a cvar.
|
* Sets the specified bounds of a cvar.
|
||||||
*
|
*
|
||||||
* @param pcvar Pointer to cvar
|
* @param pcvar Pointer to cvar
|
||||||
* @param type Type of bound to set, CvarBound_Lower or CvarBound_Upper
|
* @param type Type of bound to set, CvarBound_Lower or CvarBound_Upper
|
||||||
|
@ -419,34 +422,46 @@ native bool:get_pcvar_bounds(pcvar, CvarBounds:type, &Float:value);
|
||||||
native set_pcvar_bounds(pcvar, CvarBounds:type, bool:set, Float:value = 0.0);
|
native set_pcvar_bounds(pcvar, CvarBounds:type, bool:set, Float:value = 0.0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Binds a cvar to a global integer variable.
|
* Binds a cvar's integer value to a global variable. The variable will then
|
||||||
* This means that variable will be automagically updated on cvar's value change.
|
* always contain the current cvar value as it is automatically kept up to date.
|
||||||
|
*
|
||||||
|
* @note The variable *has* to be a global or a static variable. Local variables
|
||||||
|
* created within functions can not be used for technical reasons.
|
||||||
|
* @note Variables can not be bound to multiple cvars.
|
||||||
*
|
*
|
||||||
* @param pcvar Pointer to cvar
|
* @param pcvar Pointer to cvar
|
||||||
* @param var Global variable to update to
|
* @param var Global variable to keep updated
|
||||||
*
|
*
|
||||||
* @error Invalid cvar pointer, invalid provided variable or cvar/variable already binded.
|
* @error Invalid cvar pointer, invalid provided variable or cvar/variable already binded.
|
||||||
*/
|
*/
|
||||||
native bind_pcvar_num(pcvar, &any:var);
|
native bind_pcvar_num(pcvar, &any:var);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Binds a cvar to a global float variable.
|
* Binds a cvar's float value to a global variable. The variable will then
|
||||||
* This means that variable will be automagically updated on cvar's value change.
|
* always contain the current cvar value as it is automatically kept up to date.
|
||||||
|
*
|
||||||
|
* @note The variable *has* to be a global or a static variable. Local variables
|
||||||
|
* created within functions can not be used for technical reasons.
|
||||||
|
* @note Variables can not be bound to multiple cvars.
|
||||||
*
|
*
|
||||||
* @param pcvar Pointer to cvar
|
* @param pcvar Pointer to cvar
|
||||||
* @param var Global variable to update to
|
* @param var Global variable to keep updated
|
||||||
*
|
*
|
||||||
* @error Invalid cvar pointer, invalid provided variable or cvar/variable already binded.
|
* @error Invalid cvar pointer, invalid provided variable or cvar/variable already binded.
|
||||||
*/
|
*/
|
||||||
native bind_pcvar_float(pcvar, &Float:var);
|
native bind_pcvar_float(pcvar, &Float:var);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Binds a cvar to a global string variable.
|
* Binds a cvar's string value to a global array. The array will then
|
||||||
* This means that variable will be automagically updated on cvar's value change.
|
* always contain the current cvar value as it is automatically kept up to date.
|
||||||
|
*
|
||||||
|
* @note The array *has* to be a global or a static array. Local arrays
|
||||||
|
* created within functions can not be used for technical reasons.
|
||||||
|
* @note Arrays can not be bound to multiple cvars.
|
||||||
*
|
*
|
||||||
* @param pcvar Pointer to cvar
|
* @param pcvar Pointer to cvar
|
||||||
* @param var Global variable to update to
|
* @param var Global array to keep updated
|
||||||
* @param varlen Maximum length of string buffer
|
* @param varlen Maximum length of string array
|
||||||
*
|
*
|
||||||
* @error Invalid cvar pointer, invalid provided variable or cvar/variable already binded.
|
* @error Invalid cvar pointer, invalid provided variable or cvar/variable already binded.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue
Block a user