AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Error 008 : Please help ! (https://forums.alliedmods.net/showthread.php?t=294933)

ish12321 03-11-2017 15:47

Error 008 : Please help !
 
PHP Code:

enum _:ADR_ITEMS
{
    
CAMOUFLAGE 0,
    
SPEED,
    
BERSERK,
    
REGENERATE,
    
INVISIBILITY,
    
HIGH_JUMP,
    
MONSTER_HEALTH,
    
GOD_MODE
}

new 
g_iADR_HOOKS[ADR_ITEMS]; 

PHP Code:

        switch(g_iAdrenalineInUse)
        {
line 188        case g_iADR_HOOKS[SPEED] :
            {}
        } 

HTML Code:

Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2013 ITB CompuPhase, AMX Mod X Team

E:\AMXMODX\jCTF\ADR_ITEMS.sma(188) : error 008: must be a constant expression; assumed zero

1 Error.
Could not locate output file E:\AMXMODX\jCTF/ADR_ITEMS.amx (compile failed).
[Finished in 0.5s]


Bugsy 03-11-2017 16:06

Re: Error 008 : Please help !
 
As the error says, you cannot use non-constants in a switch.

Think about the logic behind the rule. When you set up a switch, you want react a particular way for a list of possible values. If you allow dynamic values as a case in the switch, you cannot execute a scenario on the value consistently.

Should you may be doing this? I do not know enough about your code works to give you an educated answer.
PHP Code:

    switch ( g_iAdrenalineInUse )
    {
        case 
SPEED:
        {

        }
    } 


ish12321 03-11-2017 16:42

Re: Error 008 : Please help !
 
nope I need to check for the value I put in switch only as I do something like this too

PHP Code:

    for(new CAMOUFLAGE<= GOD_MODEi++)
    {
        
g_iADR_HOOKS[i]    =    jctf_add_adrenaline_item(g_iADR_TITLE_ML[i], g_iADR_DESC_ML[i], g_iADRCosts[i], g_iADRDrain[i], g_iADR_ITEMS_EOD[i], g_iADR_ITEM_VIP_ONLY[i]);
    } 



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

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