SA-MP Forums Archive
Another array problem :/ - 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: Another array problem :/ (/showthread.php?tid=270277)



Another array problem :/ - dowster - 19.07.2011

Код:
new Hospitals[7][3] = {
    {-2655.202880}, {637.699462}, {14.453125},
    {-2203.409912}, {-2309.779052}, {31.375000},
    {1176.615478}, {-1323.509399}, {14.030076},
    {2034.536376}, {-1403.756469}, {17.276647},
    {1243.341308}, {331.165222}, {19.554687},
    {-319.580474}, {1050.357910}, {20.340259},
    {1579.732910}, {1768.892456}, {10.820312}
};
i keep getting the "initialization data exceeds array size" error, what am i doing wrong?
thanks


Re: Another array problem :/ - Jofi - 19.07.2011

I would do it like this:

pawn Код:
new Float:Hospitals[7][3] = {
    {-2655.202880,637.699462,14.453125},
    {-2203.409912,-2309.779052,31.375000},
    {1176.615478,-1323.509399,14.030076},
    {2034.536376,-1403.756469,17.276647},
    {1243.341308,331.165222,19.554687},
    {-319.580474,1050.357910,20.340259},
    {1579.732910,1768.892456,10.820312}
};
And then you can use coords like this
pawn Код:
SetPlayerPos(playerid, Hospitals[1][0], Hospitals[1][1], Hospitals[1][2]); // Hospitals[1][0] = -2655.202880 | Hospitals[1][1] = 637.699462 ...



Re: Another array problem :/ - Raimis_R - 19.07.2011

And add
pawn Код:
new Float:Hospitals[7][3] = {



Re: Another array problem :/ - dowster - 19.07.2011

thanks guys
and jofi i have a loop that goes through all the coords and checks which hospital is closest then spawns the player, the problem was just the array, thanks