Raised This Month: $ Target: $400
 0% 

Cvar - Tag Mismatch


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
taheri6
Member
Join Date: Mar 2006
Old 12-14-2007 , 17:37   Cvar - Tag Mismatch
Reply With Quote #1

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.
taheri6 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-14-2007 , 17:46   Re: Cvar - Tag Mismatch
Reply With Quote #2

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.
__________________

Last edited by Arkshine; 12-14-2007 at 18:00.
Arkshine is offline
taheri6
Member
Join Date: Mar 2006
Old 12-15-2007 , 14:35   Re: Cvar - Tag Mismatch
Reply With Quote #3

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?

Last edited by taheri6; 12-15-2007 at 14:49.
taheri6 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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