04.12.2016, 12:31
Hey guys. I am having a problem with when I delete my vehicle.
I log off and let the statistics update.
I type in my command for spawning vehicles.
I have scripted that non-existing vehicles can't be spawned. (if the model id is 0)
When I pick the first item (listitem is 0) it says non existing vehicles can't be spawned.
When I pick the second item (listitem 1, which my valid vehicle has been saved & loaded into) it spawns the first vehicle on the list because only valid vehicles show on the list.
My question is, how do I save the vehicles in empty slots when they are getting saved?
For example: I deleted the first vehicle (ID 0) and I want the second (ID 1) to be stored as ID 0.
Thank you!
I log off and let the statistics update.
I type in my command for spawning vehicles.
I have scripted that non-existing vehicles can't be spawned. (if the model id is 0)
When I pick the first item (listitem is 0) it says non existing vehicles can't be spawned.
When I pick the second item (listitem 1, which my valid vehicle has been saved & loaded into) it spawns the first vehicle on the list because only valid vehicles show on the list.
My question is, how do I save the vehicles in empty slots when they are getting saved?
For example: I deleted the first vehicle (ID 0) and I want the second (ID 1) to be stored as ID 0.
Thank you!
PHP код:
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]);
}
}