AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   ConVar.BoolValue possible bug ? (https://forums.alliedmods.net/showthread.php?t=270461)

xerox8521 08-21-2015 20:42

ConVar.BoolValue possible bug ?
 
So I have this Convar which defaults to 0. However once it has been set to true it doesn't change back to false. Using GetConVarBool and SetConVarBool it works fine using latest stable 1.7.2 SM compiler.
Could someone confirm this bug or maybe tell me if i understood something wrong here ?
PHP Code:

sv_random_variable_name CreateConVar("sv_random_variable_name","0","",FCVAR_NONE,true,0.0,true,1.0); 

To simplyfy toggling it for admins i made a small cmd

PHP Code:

public Action Command_Trail(int clientint args)
{
    
PrintToChatAll("%d",sv_random_variable_name.BoolValue);
    if(
sv_random_variable_name.BoolValue == true)
    {
        
sv_random_variable_name.BoolValue false;
    }
    else
    {
        
sv_random_variable_name.BoolValue true;
    }    
    return 
Plugin_Handled;



hleV 08-21-2015 21:01

Re: ConVar.BoolValue possible bug ?
 
BoolValue might be read-only and you may need to alter it via some function. Look it up.

xerox8521 08-21-2015 21:02

Re: ConVar.BoolValue possible bug ?
 
no it has a setter

// Retrieves or sets a boolean value for the convar.
property bool BoolValue {
public native get();
public native set(bool b);
}

Miu 08-21-2015 21:45

Re: ConVar.BoolValue possible bug ?
 
yeah, seems bugged

Tylerst 08-21-2015 22:17

Re: ConVar.BoolValue possible bug ?
 
PHP Code:

public Action Command_Trail(int clientint args)
{
    
PrintToChatAll("%d",sv_random_variable_name.BoolValue);
    if(
sv_random_variable_name.BoolValue)
    {
        
sv_random_variable_name.SetBool(false);
    }
    else
    {
        
sv_random_variable_name.SetBool(true);
    }    
    return 
Plugin_Handled;



Powerlord 08-22-2015 01:16

Re: ConVar.BoolValue possible bug ?
 
I may be seeing odd behavior in int convars using .IntValue... need to try some things to test some things.

WildCard65 08-22-2015 07:11

Re: ConVar.BoolValue possible bug ?
 
Ya, I remember getting a bug report about convars not being set properly through ConVar's properties(it was for VSH repo I have)

Powerlord 08-22-2015 14:11

Re: ConVar.BoolValue possible bug ?
 
Quote:

Originally Posted by WildCard65 (Post 2335771)
Ya, I remember getting a bug report about convars not being set properly through ConVar's properties(it was for VSH repo I have)

Well, in my case I need to go check if it's something messing with the precedence order.

However, given that it works correctly the first time it's used and not subsequent times....

...oh right, did I mention that this is happening in a core plugin? Specifically, MapChooser when you extend a map. And apparently only for the maxrounds cvar.

blaacky 08-22-2015 22:12

Re: ConVar.BoolValue possible bug ?
 
Yea I have problems with using .IntValue too and am forced to use Get/SetConVarInt. I have a similar problem with adt_array's .Set (or .Get?) function

psychonic 08-22-2015 22:35

Re: ConVar.BoolValue possible bug ?
 
If you believe there to be an issue, please file a bug @ https://bugs.alliedmods.net (forum email and password to log in) with a minimal test case that can reproduce the issue.


All times are GMT -4. The time now is 04:59.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.