about array create.
#1

Hi guys, I just create a hook for CreateGangZone, and my code is :

PHP код:
stock hook_GangZoneCreate(Float:minxFloat:minyFloat:maxxFloat:maxy) {
    static 
id 0;
    
sZone[id] = {GangZoneCreate(minxminymaxxmaxy), minxminymaxxmaxy};
    
id ++;
}
#if defined _ALS_GangZoneCreate
    #undef GangZoneCreate
#else
    #define _ALS_GangZoneCreate
#endif
#define GangZoneCreate hook_GangZoneCreate 
but give me a error :
PHP код:
error 008must be a constant expressionassumed zero
but I use another method :
PHP код:
stock hook_GangZoneCreate(Float:minxFloat:minyFloat:maxxFloat:maxy) {
    static 
id 0;
    
sZone[id][ID] = GangZoneCreate(minxminymaxxmaxy);
    
sZone[id][MinX] = minx;
    
sZone[id][MinY] = miny;
    
sZone[id][MaxX] = maxx;
    
sZone[id][MaxY] = maxy;
    
id ++;

my opinion, GangZoneCreate returns an varible.
but {} method try to create a constant array.

is that reason why my code false to complie?
Reply


Messages In This Thread
about array create. - by iLuXing - 02.01.2015, 00:32
Re: about array create. - by iLuXing - 02.01.2015, 00:58
Re: about array create. - by iLuXing - 02.01.2015, 01:31

Forum Jump:


Users browsing this thread: 1 Guest(s)