Fix checking cvar's bounds
This commit is contained in:
parent
b4b86113e4
commit
4d3c49f93b
|
@ -39,16 +39,19 @@ static cell AMX_NATIVE_CALL create_cvar(AMX *amx, cell *params)
|
||||||
bool hasMax = params[7] != 0;
|
bool hasMax = params[7] != 0;
|
||||||
float minVal = amx_ctof(params[6]);
|
float minVal = amx_ctof(params[6]);
|
||||||
float maxVal = amx_ctof(params[8]);
|
float maxVal = amx_ctof(params[8]);
|
||||||
|
|
||||||
if (hasMax && minVal > maxVal)
|
if (hasMin && hasMax)
|
||||||
{
|
{
|
||||||
LogError(amx, AMX_ERR_NATIVE, "The minimum value can not be above the maximum value");
|
if (minVal > maxVal)
|
||||||
return 0;
|
{
|
||||||
}
|
LogError(amx, AMX_ERR_NATIVE, "The minimum value can not be above the maximum value");
|
||||||
else if (hasMin && maxVal < minVal)
|
return 0;
|
||||||
{
|
}
|
||||||
LogError(amx, AMX_ERR_NATIVE, "The maximum value can not be below the minimum value");
|
else if (maxVal < minVal)
|
||||||
return 0;
|
{
|
||||||
|
LogError(amx, AMX_ERR_NATIVE, "The maximum value can not be below the minimum value");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_CvarManager.SetCvarMin(info, hasMin, minVal, plugin->getId());
|
g_CvarManager.SetCvarMin(info, hasMin, minVal, plugin->getId());
|
||||||
|
@ -723,4 +726,4 @@ AMX_NATIVE_INFO g_CvarNatives[] =
|
||||||
{"query_client_cvar", query_client_cvar},
|
{"query_client_cvar", query_client_cvar},
|
||||||
|
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user