Merge pull request #230 from Ni3znajomy/fix-checking-cvar-bounds
Fix checking cvar's bounds
This commit is contained in:
commit
bebe9f8e2e
@ -40,15 +40,18 @@ static cell AMX_NATIVE_CALL create_cvar(AMX *amx, cell *params)
|
||||
float minVal = amx_ctof(params[6]);
|
||||
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");
|
||||
return 0;
|
||||
}
|
||||
else if (hasMin && maxVal < minVal)
|
||||
{
|
||||
LogError(amx, AMX_ERR_NATIVE, "The maximum value can not be below the minimum value");
|
||||
return 0;
|
||||
if (minVal > maxVal)
|
||||
{
|
||||
LogError(amx, AMX_ERR_NATIVE, "The minimum value can not be above the maximum value");
|
||||
return 0;
|
||||
}
|
||||
else if (maxVal < minVal)
|
||||
{
|
||||
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());
|
||||
|
Loading…
Reference in New Issue
Block a user