Raised This Month: $51 Target: $400
 12% 

Must enums be "global"?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PartialCloning
Senior Member
Join Date: Dec 2015
Old 07-22-2018 , 22:38   Must enums be "global"?
Reply With Quote #1

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.
PartialCloning is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-23-2018 , 04:43   Re: Must enums be "global"?
Reply With Quote #2

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

Last edited by HamletEagle; 07-23-2018 at 04:44.
HamletEagle 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 07:30.


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