SA-MP Forums Archive
Initialization data exceeds declared size - 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: Initialization data exceeds declared size (/showthread.php?tid=409557)



Initialization data exceeds declared size - Neil. - 22.01.2013

pawn Код:
new Float:TruckLocations[][3] =
{
    {"LS Construction Site", 1859.0, -1314.0, 14.0}, // Initialization data exceeds declared size & tag mismatch
    {"SF Construction Site", -2083.0, 209.0, 35.5},
    {"LV Construction Site", 2708.0, 878.0, 10.0},
    {"Avery Construction", 312.25, -233.75, 1.6},
    {"Clown's Pocket Constr.", 2467.0, 1923.0, 9.8},
    {"Solarin Industries", -1822.5, 41.25, 15.25},
    {"Blueberry Truck Terminal", 52.75, -278.0, 1.7},
    {"KACC Military Fuels", 2708.5, 2641.25, 11.0},
    {"SA Federal Mint", -2441.0, 521.5, 30.0},
    {"Angel Pine Sawmill", -1965.75, -2436.0, 30.7},
    {"Quarry", 587.25, 844.75, -42.5}
};
Errors are commented in the pawn code
:/


Re: Initialization data exceeds declared size - SuperViper - 22.01.2013

pawn Код:
enum eTruckLocations
{
    tName[64],
    Float: tPositionX,
    Float: tPositionY,
    Float: tPositionZ,
}

new Float: TruckLocations[][eTruckLocations] =
{
    {"LS Construction Site", 1859.0, -1314.0, 14.0},
    {"SF Construction Site", -2083.0, 209.0, 35.5},
    {"LV Construction Site", 2708.0, 878.0, 10.0},
    {"Avery Construction", 312.25, -233.75, 1.6},
    {"Clown's Pocket Constr.", 2467.0, 1923.0, 9.8},
    {"Solarin Industries", -1822.5, 41.25, 15.25},
    {"Blueberry Truck Terminal", 52.75, -278.0, 1.7},
    {"KACC Military Fuels", 2708.5, 2641.25, 11.0},
    {"SA Federal Mint", -2441.0, 521.5, 30.0},
    {"Angel Pine Sawmill", -1965.75, -2436.0, 30.7},
    {"Quarry", 587.25, 844.75, -42.5}
};
Usage:

pawn Код:
print(TruckLocations[0][tName]);



Re: Initialization data exceeds declared size - Neil. - 22.01.2013

Quote:
Originally Posted by SuperViper
Посмотреть сообщение
pawn Код:
enum eTruckLocations
{
    tName[64],
    Float: tPositionX,
    Float: tPositionY,
    Float: tPositionZ,
}

new Float: TruckLocations[][eTruckLocations] =
{
    {"LS Construction Site", 1859.0, -1314.0, 14.0},
    {"SF Construction Site", -2083.0, 209.0, 35.5},
    {"LV Construction Site", 2708.0, 878.0, 10.0},
    {"Avery Construction", 312.25, -233.75, 1.6},
    {"Clown's Pocket Constr.", 2467.0, 1923.0, 9.8},
    {"Solarin Industries", -1822.5, 41.25, 15.25},
    {"Blueberry Truck Terminal", 52.75, -278.0, 1.7},
    {"KACC Military Fuels", 2708.5, 2641.25, 11.0},
    {"SA Federal Mint", -2441.0, 521.5, 30.0},
    {"Angel Pine Sawmill", -1965.75, -2436.0, 30.7},
    {"Quarry", 587.25, 844.75, -42.5}
};
Usage:

pawn Код:
print(TruckLocations[0][tName]);

Well, there are couple tag mismatch's
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    if(Work[playerid] == 1)
    {
        DisablePlayerCheckpoint(playerid);
        SendClientMessage(playerid, 0xFFFF00FF, "You have finished the mission");
        new string[140];
        new rand = random(sizeof(TruckLocations));
        new rand2 = random(sizeof(TruckLocations));

        format(string,sizeof(string),"Mission from %s to %s", ALocations[rand][0], ALocations[rand2][0]);
        SendClientMessage(playerid, 0xFFFF00FF, string);
        SetPlayerCheckpoint(playerid, TruckLocations[rand2][0],TruckLocations[rand2][1],TruckLocations[rand2][2],7);// 3 tag mismatches right here
    }
    return 1;
}
SetPlayerCheckpoint has 3 tag mismatch


Re: Initialization data exceeds declared size - SuperViper - 22.01.2013

Use

pawn Код:
TruckLocations[rand2][tPositonX]



Re: Initialization data exceeds declared size - Neil. - 22.01.2013

Quote:
Originally Posted by SuperViper
Посмотреть сообщение
Use

pawn Код:
TruckLocations[rand2][tPositonX]
Bit of noobish here but it says undefined symbol

EDIT: Nevermind, I got it