SA-MP Forums Archive
What's wrong with this? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: What's wrong with this? (/showthread.php?tid=78773)



What's wrong with this? - Ignas1337 - 23.05.2009

This is a functio i've been working on. what's wrong with it? whenever I incude it in my gamemode or fs the compiler crashes if i try to compile.

pawn Код:
new inc_Gangzone[][][8];
new split_gangzones = 0;

forward CreateSplitGangzone(minx, miny, maxx, maxy, rows, columns);

public CreateSplitGangzone(minx, miny, maxx, maxy, rows, columns)
 {
  if((rows != 0 && columns != 0) && (split_gangzones) < 8))
  {
    new s_x = maxx-minx;
    new s_y = maxy-miny;
    new max_x, max_y, min_x, min_y;
    for(new i = 1; i <= columns; i++)
        {
            min_x = minx + ((s_x/columns)*(i-1));
            max_x = maxx - ((s_x/columns)*(i));
            for(new j = 1; j <= rows; j++)
            {
                min_y = miny +((s_y/columns)*(j-1));
                max_y = maxy +((s_y/columns)*(j));
                inc_Gangzone[i][j][split_gangzones] = GangZoneCreate(min_x, min_y, max_x, max_y);
            }
        }
        split_Gangzones++;
  }
  return 0;
 }



Re: What's wrong with this? - Ignas1337 - 23.05.2009

should I specify the size of that array, huh!?


Re: What's wrong with this? - yezizhu - 23.05.2009

new inc_Gangzone[][][8];
This is?


Re: What's wrong with this? - Ignas1337 - 23.05.2009

the returning id of the split gangzone
three dimension array : 1st specifies the row, 2nd column and 3rd specifies which of the 8 possible gangzones (i limited it to 9, duno why) it is.
this function is supposed to create rows*columns size of gangzone


Re: What's wrong with this? - yezizhu - 23.05.2009

Quote:
Originally Posted by Ignas1337
should I specify the size of that array, huh!?
Yes.


Re: What's wrong with this? - Ignas1337 - 23.05.2009

i did, same thing ;/


Re: What's wrong with this? - yezizhu - 23.05.2009

pawn Код:
#include <a_samp>
new inc_Gangzone[20][20][8];
new split_gangzones = 0;
main(){}
forward CreateSplitGangzone(minx, miny, maxx, maxy, rows, columns);

public CreateSplitGangzone(minx, miny, maxx, maxy, rows, columns)
{
    if((rows != 0 && columns != 0) && (split_gangzones < 8))
    {
        new s_x = maxx-minx;
        new s_y = maxy-miny;
        new max_x, max_y, min_x, min_y;
        for(new i = 1; i <= columns; i++){
            min_x = minx + ((s_x/columns)*(i-1));
            max_x = maxx - ((s_x/columns)*(i));
            for(new j = 1; j <= rows; j++){
                min_y = miny +((s_y/columns)*(j-1));
                max_y = maxy +((s_y/columns)*(j));
                inc_Gangzone[i][j][split_gangzones] = GangZoneCreate(min_x, min_y, max_x, max_y);
            }
        }
        split_gangzones++;
    }
    return 0;
}
Not same thing when trying to complie it.....huh?


Re: What's wrong with this? - Ignas1337 - 23.05.2009

what did you do, to be exact?


Re: What's wrong with this? - yezizhu - 23.05.2009

Quote:
Originally Posted by Ignas1337
what did you do, to be exact?
new inc_Gangzone[20][20][8];


Re: What's wrong with this? - Ignas1337 - 24.05.2009

oh, ok. thanks. it works perfectly now, not the logical part tho, gtto recalculate the coords