SA-MP Forums Archive
about array create. - 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: about array create. (/showthread.php?tid=554049)



about array create. - iLuXing - 02.01.2015

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?


Re: about array create. - iLuXing - 02.01.2015

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.


Re: about array create. - iLuXing - 02.01.2015

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.