So this is
Legacy SourcePawn syntax back then.
https://github.com/Tabbernaut/L4D2-R...s.sp#L711-L717
PHP Code:
// Legacy code enum EntInfo // for blind_infected adaptation { iEntity , bool : hasBeenSeen } myfunction () { // you got enum array size with _:EntInfo I guess }
This is current, new one
https://forums.alliedmods.net/showthread.php?t=312822
enum and enum structs are syntatic sugar in code, it almost just a array.
You can either try this way.
PHP Code:
Handle g_hBlockedEntities ; enum struct EntInfo { int iEntity ; bool hasBeenSeen ; } void nothing () { if( g_hBlockedEntities == null ) g_hBlockedEntities = CreateArray ( sizeof ( EntInfo )); EntInfo currentEnt , anotherEnt ; // random nums currentEnt . iEntity = 69 ; currentEnt . hasBeenSeen = true ; anotherEnt . iEntity = 6 ; anotherEnt . hasBeenSeen = false ; // save in array handle PushArrayArray ( g_hBlockedEntities , currentEnt ); PushArrayArray ( g_hBlockedEntities , anotherEnt ); // change value currentEnt . iEntity = anotherEnt . iEntity = - 1 ; currentEnt . hasBeenSeen = anotherEnt . hasBeenSeen = false ; // get values from handle GetArrayArray ( g_hBlockedEntities , 0 , anotherEnt ); GetArrayArray ( g_hBlockedEntities , 1 , currentEnt ); PrintToServer ( "anotherEnt %i %s\ncurrentEnt %i %s\nsizeof currentEnt %i" , anotherEnt . iEntity , anotherEnt . hasBeenSeen ? "TRUE" : "FALSE" , currentEnt . iEntity , currentEnt . hasBeenSeen ? "TRUE" : "FALSE" , sizeof ( currentEnt )); delete g_hBlockedEntities ; }
or
bad example
This works for now, int type variable can accept bool type.
But when you go types float, char, this will not work anymore.
PHP Code:
Handle g_hBlockedEntities ; enum { iEntity = 0 , hasBeenSeen , EntInfo }; void nothing () { if( g_hBlockedEntities == null ) g_hBlockedEntities = CreateArray ( EntInfo ); // dynamic array int [] currentEnt = new int [ EntInfo ]; int [] anotherEnt = new int [ EntInfo ]; // random nums currentEnt [ iEntity ] = 69 ; currentEnt [ hasBeenSeen ] = true ; anotherEnt [ iEntity ] = 6 ; anotherEnt [ hasBeenSeen ] = false ; // save in array handle PushArrayArray ( g_hBlockedEntities , currentEnt ); PushArrayArray ( g_hBlockedEntities , anotherEnt ); // change value currentEnt [ iEntity ] = anotherEnt [ iEntity ] = - 1 ; currentEnt [ hasBeenSeen ] = anotherEnt [ hasBeenSeen ] = false ; // get values from handle GetArrayArray ( g_hBlockedEntities , 0 , anotherEnt ); GetArrayArray ( g_hBlockedEntities , 1 , currentEnt ); PrintToServer ( "anotherEnt %i %s\ncurrentEnt %i %s\nsizeof currentEnt %i" , anotherEnt [ iEntity ], anotherEnt [ hasBeenSeen ] ? "TRUE" : "FALSE" , currentEnt [ iEntity ], currentEnt [ hasBeenSeen ] ? "TRUE" : "FALSE" , EntInfo ); delete g_hBlockedEntities ; }
__________________