Another array problem :/
#1

Код:
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
Reply
#2

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 ...
Reply
#3

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)