24.08.2013, 09:28
What's the line which gives you the error? When I tried to compile your code, it actually compiled it without warnings/errors.
The only thing I'm not sure about is CreateVehicleEx function. You set the size of the array and then you assign about the owner's name. I'd use strcpy, YSI contains it already.
pawn Код:
#include < a_samp >
#include < YSI\y_ini >
enum carDataEnum
{
model,
Float:xspawn,
Float:yspawn,
Float:zspawn,
Float:anglespawn,
col1,
col2,
respawn,
owner[MAX_PLAYER_NAME]
}
new carData[MAX_VEHICLES][carDataEnum];
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);
}
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 CreateVehicleEx(modelid, Float:x, Float:y, Float:z, Float:angle, color1, color2, respawntime, ownername[])
{
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;
strcpy(carData[carid][owner], ownername, MAX_PLAYER_NAME);
validcar[carid] = true;
CreateVehicle(modelid, x, y, z, angle, color1, color2, respawntime);
return carid;
}