Initialization data exceeds declared size
#1

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
:/
Reply
#2

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]);
Reply
#3

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
Reply
#4

Use

pawn Код:
TruckLocations[rand2][tPositonX]
Reply
#5

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

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

EDIT: Nevermind, I got it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)