for(new i = 0; i < MAX_PLAYERVEHICLES; i++)
{
format(string,sizeof(string),"Vehicle%d_pvModel",i);
INI_WriteInt(File, string,PlayerVehicleInfo[playerid][i][pvModel]);
format(string,sizeof(string),"Vehicle%d_pvX",i);
INI_WriteFloat(File, string,PlayerVehicleInfo[playerid][i][pvX]);
format(string,sizeof(string),"Vehicle%d_pvY",i);
INI_WriteFloat(File, string,PlayerVehicleInfo[playerid][i][pvY]);
format(string,sizeof(string),"Vehicle%d_pvZ",i);
INI_WriteFloat(File, string,PlayerVehicleInfo[playerid][i][pvZ]);
format(string,sizeof(string),"Vehicle%d_pvAngle",i);
INI_WriteFloat(File, string,PlayerVehicleInfo[playerid][i][pvAngle]);
format(string,sizeof(string),"Vehicle%d_pvColor1",i);
INI_WriteInt(File, string,PlayerVehicleInfo[playerid][i][pvColor1]);
format(string,sizeof(string),"Vehicle%d_pvColor2",i);
INI_WriteInt(File, string,PlayerVehicleInfo[playerid][i][pvColor2]);
format(string,sizeof(string),"Vehicle%d_pvPaintjob",i);
INI_WriteInt(File, string,PlayerVehicleInfo[playerid][i][pvPaintjob]);
format(string,sizeof(string),"Vehicle%d_pvLocked",i);
INI_WriteInt(File, string,PlayerVehicleInfo[playerid][i][pvLocked]);
format(string,sizeof(string),"Vehicle%d_pvVW",i);
INI_WriteInt(File, string,PlayerVehicleInfo[playerid][i][pvVW]);
format(string,sizeof(string),"Vehicle%d_pvInt",i);
INI_WriteInt(File, string,PlayerVehicleInfo[playerid][i][pvInt]);
format(string,sizeof(string),"Vehicle%d_pvPlates",i);
INI_WriteString(File, string,PlayerVehicleInfo[playerid][i][pvPlates]);
for(new m = 0; m < MAX_MODS; m++)
{
format(string,sizeof(string),"Vehicle%d_pvMods%d",i,m);
INI_WriteInt(File,string,PlayerVehicleInfo[playerid][i][pvMods][m]);
}
}
I do not understand, do you want to store the vehicles in any id, that is, in which you choose?
|
for(new i = 0, idx = -1; i < MAX_PLAYERVEHICLES; i++)
{
if(PlayerVehicleInfo[playerid][i][pvModel] == 0) {
continue;
}
idx++;
format(string,sizeof(string),"Vehicle%d_pvModel",idx);
INI_WriteInt(File, string,PlayerVehicleInfo[playerid][i][pvModel]);
format(string,sizeof(string),"Vehicle%d_pvX", idx);
INI_WriteFloat(File, string,PlayerVehicleInfo[playerid][i][pvX]);
format(string,sizeof(string),"Vehicle%d_pvY",idx);
INI_WriteFloat(File, string,PlayerVehicleInfo[playerid][i][pvY]);
format(string,sizeof(string),"Vehicle%d_pvZ",idx);
INI_WriteFloat(File, string,PlayerVehicleInfo[playerid][i][pvZ]);
format(string,sizeof(string),"Vehicle%d_pvAngle",idx);
INI_WriteFloat(File, string,PlayerVehicleInfo[playerid][i][pvAngle]);
format(string,sizeof(string),"Vehicle%d_pvColor1",idx);
INI_WriteInt(File, string,PlayerVehicleInfo[playerid][i][pvColor1]);
format(string,sizeof(string),"Vehicle%d_pvColor2",idx);
INI_WriteInt(File, string,PlayerVehicleInfo[playerid][i][pvColor2]);
format(string,sizeof(string),"Vehicle%d_pvPaintjob",idx);
INI_WriteInt(File, string,PlayerVehicleInfo[playerid][i][pvPaintjob]);
format(string,sizeof(string),"Vehicle%d_pvLocked",idx);
INI_WriteInt(File, string,PlayerVehicleInfo[playerid][i][pvLocked]);
format(string,sizeof(string),"Vehicle%d_pvVW",idx);
INI_WriteInt(File, string,PlayerVehicleInfo[playerid][i][pvVW]);
format(string,sizeof(string),"Vehicle%d_pvInt",idx);
INI_WriteInt(File, string,PlayerVehicleInfo[playerid][i][pvInt]);
format(string,sizeof(string),"Vehicle%d_pvPlates",idx);
INI_WriteString(File, string,PlayerVehicleInfo[playerid][i][pvPlates]);
for(new m = 0; m < MAX_MODS; m++)
{
format(string,sizeof(string),"Vehicle%d_pvMods%d",idx,m);
INI_WriteInt(File,string,PlayerVehicleInfo[playerid][i][pvMods][m]);
}
}
Just add an if statment
PHP код:
|
Using foreach iterator functions this can made possible very easily and faster.
Add your list as foreach iterator. Iter_Free function returns the smallest value that is not in iterator can be used specifically for your purpose Below links can be handy if you dont know how to use them https://sampforum.blast.hk/showthread.php?tid=588526 https://sampforum.blast.hk/showthread.php?tid=570937 https://sampforum.blast.hk/showthread.php?tid=571159 |