01.01.2016, 03:58
Woooooooooooooww arrays are much heavier than non-arrays variables. Thank you for the first link, I definetely learned the difference now.
Current code:
Current code:
PHP код:
forward public LoadVehicleData(vehicleID, name[], value[]);
public LoadVehicleData(vehicleID, name[], value[])
{
new location[32];
INI_Int("Model", VehicleInfo[vehicleID][vModel]);
for(new i = 0; i < 4; i++)
{
format(location, sizeof location, "Location: %i", i);
INI_Float(location, VehicleInfo[vehicleID][vLoc][i]);
}
INI_WriteFloat(dFile, "LocationX", VehicleInfo[vehicleID][vLoc][0]);
INI_WriteFloat(dFile, "LocationY", VehicleInfo[vehicleID][vLoc][1]);
INI_WriteFloat(dFile, "LocationZ", VehicleInfo[vehicleID][vLoc][2]);
INI_Int("Color 1", VehicleInfo[vehicleID][vColor1]);
INI_Int("Color 2", VehicleInfo[vehicleID][vColor2]);
INI_String("Owner", VehicleInfo[vehicleID][vOwner], MAX_PLAYER_NAME);
VehicleInfo[vehicleID][vLocked] = INI_Int("Locked") == 1 ? true : false;
return 1;
}
stock VehicleSave(vehicleID)
{
new INI:dFile = INI_Open(VehiclePath(vehicleID))
new location[32];
INI_WriteInt(dFile, "Model", VehicleInfo[vehicleID][vModel]);
for(new i = 0; i < 4; i++)
{
format(location, sizeof location, "Location: %i", i);
INI_Float(location, VehicleInfo[vehicleID][vLoc][i]);
}
INI_WriteFloat(dFile, "LocationX", VehicleInfo[vehicleID][vLoc][0]);
INI_WriteFloat(dFile, "LocationY", VehicleInfo[vehicleID][vLoc][1]);
INI_WriteFloat(dFile, "LocationZ", VehicleInfo[vehicleID][vLoc][2]);
INI_WriteInt(dFile, "Color 1", VehicleInfo[vehicleID][vColor1]);
INI_WriteInt(dFile, "Color 2", VehicleInfo[vehicleID][vColor2]);
INI_WriteInt(dFile, "Owner", VehicleInfo[vehicleID][vOwner]);
INI_WriteInt(dFile, "Locked", VehicleInfo[vehicleID][vLocked] ? 1 : 0);
INI_Close(dFile);
return 1;
}