24.08.2013, 08:51
(
Последний раз редактировалось EiresJason; 24.08.2013 в 10:01.
)
Hi. I have been working on a vehicle system that will save vehicles bought at a dealership on OnGameModeExit and then load those saved vehicles up on OnGameModeInit.
I had this problem months ago but just got back into scripting so im a bit rusty xD
I almost have it but I've been up so long; not sure whether the issue is just as easy as renaming a word or just moving one word out of there or something xD
Could any1 take a quick look at this?
Im getting the "error 047: array sizes do not match, or destination array is too small" error.
Im 100% sure it's to do with "carData[vehicle][owner]" in the LoadVehicle stock. Marked with "//THIS".
I marked the full error line with "/*ERROR LINE*/"
Thanks to anyone that helps
CreateVehicleEx stock.
The other needed stocks/publics.
I had this problem months ago but just got back into scripting so im a bit rusty xD
I almost have it but I've been up so long; not sure whether the issue is just as easy as renaming a word or just moving one word out of there or something xD
Could any1 take a quick look at this?
Im getting the "error 047: array sizes do not match, or destination array is too small" error.
Im 100% sure it's to do with "carData[vehicle][owner]" in the LoadVehicle stock. Marked with "//THIS".
I marked the full error line with "/*ERROR LINE*/"
Thanks to anyone that helps

CreateVehicleEx stock.
pawn Код:
stock CreateVehicleEx(modelid, Float:x, Float:y, Float:z, Float:angle, color1, color2, respawntime, ownername[MAX_PLAYER_NAME])
{
new carid = GetFreeVehicleSlot();
carData[carid][model] = modelid;
carData[carid][xspawn] = x;
carData[carid][yspawn] = y;
carData[carid][zspawn] = z;
carData[carid][anglespawn] = angle;
carData[carid][col1] = color1;
carData[carid][col2] = color2;
carData[carid][respawn] = respawntime;
carData[carid][owner] = ownername;
validcar[carid] = true;
CreateVehicle(modelid, x, y, z, angle, color1, color2, respawntime);
return carid;
}
pawn Код:
stock LoadVehicle(vehicle, filename[])
{
INI_ParseFile(filename, "LoadVehicleData", .bExtra = true, .extra = vehicle);
/*ERROR LINE*/CreateVehicleEx(carData[vehicle][model], carData[vehicle][xspawn], carData[vehicle][yspawn], carData[vehicle][zspawn], carData[vehicle][anglespawn], carData[vehicle][col1], carData[vehicle][col2], carData[vehicle][respawn], carData[vehicle][owner]);//THIS
}
forward public LoadVehicleData(vehicle, name[], value[]);
public LoadVehicleData(vehicle, name[], value[])
{
INI_Int("Model", carData[vehicle][model]);
INI_Float("xLast", carData[vehicle][xspawn]);
INI_Float("yLast", carData[vehicle][yspawn]);
INI_Float("zLast", carData[vehicle][zspawn]);
INI_Float("aLast", carData[vehicle][anglespawn]);
INI_Int("Color1", carData[vehicle][col1]);
INI_Int("Color2", carData[vehicle][col2]);
INI_Int("Respawn", carData[vehicle][respawn]);
INI_String("Owner", carData[vehicle][owner], MAX_PLAYER_NAME);
return 1;
}
stock LoadAllVehicles()
{
//new fname[36];
new loadindex = 0;
//format(fname, sizeof(fname), "/vehicles/%d.ini", loadindex);
while(fexist(VehiclePath(loadindex))) //Here's the reason why the ini files are named continuosly
{
LoadVehicle(loadindex, VehiclePath(loadindex));
loadindex++;
//format(fname, sizeof(fname), "/vehicles/%d.ini", index);
}
printf("Vehicles Loaded: %d", loadindex);
}