AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Cvar - Tag Mismatch (https://forums.alliedmods.net/showthread.php?t=64389)

taheri6 12-14-2007 17:37

Cvar - Tag Mismatch
 
Hello,

I'm having a problem I hope you can help me with, its probably easy but I could use a fresh set of eyes.


basically I have a bunch of lines like this:

new CVAR_VARIABLE
register_cvar ( "cvar_here", "1.5")
CVAR_VARIABLE = get_cvar_float ( "cvar_here" )

and then when compiling I have
warning 213: tag mismatch

its always on the lines that contain the CVAR_VARIABLE = get_cvar_float ( "cvar_here" ) lines.

thoughts?

Thanks in advance.

Arkshine 12-14-2007 17:46

Re: Cvar - Tag Mismatch
 
First it's better to use pcvar. ( http://wiki.alliedmods.net/Optimizin...#Cvar_Pointers )

Here an exemple :

Code:
    #include <amxmodx>         new         p_cvar_inum,         p_cvar_float,         p_cvar_string;         public plugin_init()     {         p_cvar_inum   = register_cvar( "my_cvar1", "1" );         p_cvar_float  = register_cvar( "my_cvar1", "2.0" );         p_cvar_string = register_cvar( "my_cvar1", "hello" );     }         MyFunc()     {         new iNum = get_pcvar_num( p_cvar_inum );         new Float:fValue = get_pcvar_float( p_cvar_float );                 new sArg[16];         get_pcvar_string( p_cvar_string, sArg, charsmax( sArg ) );             }

You have a 'tag mismatch' because you have omit a 'Float:' tag when you retrieve float value.

taheri6 12-15-2007 14:35

Re: Cvar - Tag Mismatch
 
So one quick question.

Code:

    #include <amxmodx>
   
    new
        p_cvar_inum,
        p_cvar_float,
        p_cvar_string;
   
    public plugin_init()
    {
        p_cvar_inum  = register_cvar( "my_cvar1", "1" );
        p_cvar_float  = register_cvar( "my_cvar1", "2.0" );
        p_cvar_string = register_cvar( "my_cvar1", "hello" );
    }
   
    MyFunc()
    {
        //exec a config file that changes teh value of CVARS HERE

        new iNum = get_pcvar_num( p_cvar_inum );
        new Float:fValue = get_pcvar_float( p_cvar_float );
       
        new sArg[16];
        get_pcvar_string( p_cvar_string, sArg, charsmax( sArg ) );
       
    }

Is that still going to work?


All times are GMT -4. The time now is 11:12.

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