AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Must enums be "global"? (https://forums.alliedmods.net/showthread.php?t=309352)

PartialCloning 07-22-2018 22:38

Must enums be "global"?
 
PHP Code:

#include <amxmodx>

new gTest;

public 
plugin_init()
{
    
MyFunction();
}

MyFunction()
{
    if(
gTest)
    {
        new 
Player 0;

        
enum TestEnum {iTestszTest[20]};
        new 
Buffer[TestEnum];
    }
    else
    {
        new 
Player 1;
    }


Error when compiling: "error 021: symbol already defined: "Player"".

When I remove the enum or make it global it compiles.

HamletEagle 07-23-2018 04:43

Re: Must enums be "global"?
 
Put the enum before new Player = 0, it will compile. I am not sure why it does that, maybe a compiler bug? I could not find anything in the language guide.


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

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