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
#2

Quote:
Originally Posted by ******
Посмотреть сообщение
If you have a theory of why your code doesn't work, why don't you test the theory by trying different code in place of what may be failing? Surely that is going to teach you more than asking here?
as beginner I am, I tried this code and just dont know why.
I post here after I test it.
Reply
#3

Quote:
Originally Posted by ******
Посмотреть сообщение
My point was, try something different.
Thank you and I will.

BTW, thank you for other post, I got a lot.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)