15.04.2015, 19:15
(
Последний раз редактировалось Rabea; 15.04.2015 в 20:04.
)
i'm doing vehicle system is there anything wrong here?
also what I need to add else?
also what I need to add else?
PHP код:
enum vehicleInfo
{
vehModel,
vehOwner[32],
Float:vehX,
Float:vehY,
Float:vehZ
}
new VehicleInfo[MAX_VEHS][vehicleInfo];
stock LoadVehs()
{
new vehinfo[21][32], string[256], File:file = fopen("vehs.cfg", io_read);
if(file)
{
for(new idx = 1; idx < MAX_VEHS ; idx++)
{
fread(file, string);
split(string, vehinfo, '|');
VehicleInfo[idx][vehModel] = strval(vehinfo[0]);
format(VehicleInfo[idx][vehOwner], 32, "%s", vehinfo[1]);
VehicleInfo[idx][vehX] = floatstr(vehinfo[2]);
VehicleInfo[idx][vehY] = floatstr(vehinfo[3]);
VehicleInfo[idx][vehZ] = floatstr(vehinfo[4]);
CreateVehicle(VehicleInfo[idx][vehModel], VehicleInfo[idx][vehX], VehicleInfo[idx][vehY], VehicleInfo[idx][vehZ], -1, -1, -1, -1);
}
}
return 1;
}
stock SaveVehs()
{
new idx = 1, File:file;
new string[256];
while(idx < MAX_VEHS)
{
format(string, sizeof(string), "%d|%d|%d|%s|%f|%f|%f|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d\r\n",
VehicleInfo[idx][vehModel],
VehicleInfo[idx][vehX],
VehicleInfo[idx][vehY],
VehicleInfo[idx][vehZ],
VehicleInfo[idx][vehOwner]
);
if(idx == 1)
{
file = fopen("vehs.cfg", io_write);
}
else
{
file = fopen("vehs.cfg", io_append);
}
fwrite(file, string);
fclose(file);
idx++;
}
}