SA-MP Forums Archive
enums errors - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: enums errors (/showthread.php?tid=433684)



enums errors - Yiin - 28.04.2013

PHP код:
// defines
#define coords Float:_x, Float:_y, Float:_z
#define coords2 Float:_x2, Float:_y2, Float:_z2
new gTag_i// somewhere in the code, used for array indexes.
    // ...
    // lot of code
    // ...
switch(cache_get_field_int(i"type"))
{
    case 
OBJ_GANG_TAG:
    {
        
objects[gTag][gTag_i][obj_id] = CreateDynamicObject// 998 line
            
cache_get_field_int(i"model"),
            
coords,
            
coords2
        
); 
PHP код:
enum e_obj:(<<= 1)
{
    
fPickedUp 1,
    
fIsActive
};
enum e_obj_other_ids
{
    
obj_gang_id,
    
obj_player_id,
    
obj_text_id
};
enum e_obj_details
{
    
obj_id,
    
e_obj:obj_flags,
    
obj_other_ids[e_obj_other_ids]
};
enum e_objects_list
{
    
gTag[13]
};
new 
objects[e_objects_list][e_obj_details]; 
Console output:

Код:
C:\Users\Yiin\Desktop\story\gamemodes\story.pwn(998) : warning 213: tag mismatch
C:\Users\Yiin\Desktop\story\gamemodes\story.pwn(998) : warning 215: expression has no effect
C:\Users\Yiin\Desktop\story\gamemodes\story.pwn(998) : error 001: expected token: ";", but found "["
C:\Users\Yiin\Desktop\story\gamemodes\story.pwn(998) : error 029: invalid expression, assumed zero
C:\Users\Yiin\Desktop\story\gamemodes\story.pwn(998) : warning 215: expression has no effect
C:\Users\Yiin\Desktop\story\gamemodes\story.pwn(998) : error 001: expected token: ";", but found "]"
C:\Users\Yiin\Desktop\story\gamemodes\story.pwn(998) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664Copyright © 1997-2006, ITB CompuPhase


4 Errors.
[Finished in 10.2s with exit code 1]
What i did wrong?


Re: enums errors - JaKe Elite - 28.04.2013

what is the code in the line 998?


Re: enums errors - Yiin - 28.04.2013

Quote:
Originally Posted by _Jake_
Посмотреть сообщение
what is the code in the line 998?
i already commented that line

objects[gTag][gTag_i][obj_id] = CreateDynamicObject( // 998 line


Re: enums errors - Yiin - 28.04.2013

Quote:
Originally Posted by ******
Посмотреть сообщение
enums aren't arrays and you can't use them as arrays like that. You aren't making a multi-dimensional array by using an enum for the first dimension.
k, thanks.