AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved warn 213 when i'm using enums (https://forums.alliedmods.net/showthread.php?t=333171)

kww 06-23-2021 07:56

warn 213 when i'm using enums
 
Hi! I'm getting warning 213: tag mismatch if i using enum like below:
PHP Code:

enum eTheBestEnumeration{
    
ENUM_ZERO 0,
    
ENUM_ONE,
    
ENUM_TWO
}
// .......
public somecmd(executor) {
    new 
arg[2]
    
read_argv(1argcharsmax(arg))
    
    new 
iArg clamp(str_to_num(arg), 02)
    if(
iArg == ENUM_ZERO) {} //insert useless code here
    
else if(iArg == ENUM_ONE) {} //insert useless code here
    
else if(iArg == ENUM_TWO) {} //insert useless code here
    // I KNOW HERE MUST BE USED SWITCH INSTEAD OF IFS
    // And it works perfectly with switches
    
}


How can it be fixed?

Natsheh 06-23-2021 12:47

Re: warn 213 when i'm using enums
 
PHP Code:

new eTheBestEnumeration:iArg clamp(str_to_num(arg), ENUM_ZEROENUM_TWO


HamletEagle 06-23-2021 14:07

Re: warn 213 when i'm using enums
 
Another alternative is to de-tag the enum, but this many not be ideal.
enum eTheBestEnumeration -> enum _:eTheBestEnumeration

kww 06-23-2021 14:25

Re: warn 213 when i'm using enums
 
Thank you @Natsheh and @HamletEagle


All times are GMT -4. The time now is 02:33.

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