29.03.2017, 15:25
Quote:
Can I see the code where you save the coords of the vehicles to the ini itself?
|
PHP код:
function SaveVehicle(fileid)
{
new vFile[128], Float:vsX, Float:vsY, Float:vsZ, Float:vsA;
format(vFile, sizeof(vFile),vPATH,fileid);
GetVehiclePos(VehicleInfo[fileid][vID], vsX, vsY, vsZ);
GetVehicleZAngle(VehicleInfo[fileid][vID], vsA);
VehicleInfo[fileid][vX] = vsX;
VehicleInfo[fileid][vY] = vsY;
VehicleInfo[fileid][vZ] = vsZ;
VehicleInfo[fileid][vA] = vsA;
new INI:File = INI_Open(vFile);
INI_WriteInt(File,"KeyID",VehicleInfo[fileid][vKeyID]);
INI_WriteInt(File,"HasKey",VehicleInfo[fileid][vHasKey]);
INI_WriteInt(File,"Model",VehicleInfo[fileid][vModel]);
INI_WriteInt(File,"Fuel",VehicleInfo[fileid][vFuel]);
INI_WriteInt(File,"UsingFuel",VehicleInfo[fileid][vUsingFuel]);
INI_WriteInt(File,"Oil",VehicleInfo[fileid][vOil]);
INI_WriteInt(File,"CanRun",VehicleInfo[fileid][vCanRun]);
INI_WriteInt(File,"Insured",VehicleInfo[fileid][vInsured]);
INI_WriteFloat(File,"X",VehicleInfo[fileid][vX]);
INI_WriteFloat(File,"Y",VehicleInfo[fileid][vY]);
INI_WriteFloat(File,"Z",VehicleInfo[fileid][vZ]);
INI_WriteFloat(File,"A",VehicleInfo[fileid][vA]);
INI_WriteInt(File,"Color1",VehicleInfo[fileid][vColor1]);
INI_WriteInt(File,"Color2",VehicleInfo[fileid][vColor2]);
INI_WriteInt(File,"Faction",VehicleInfo[fileid][vFaction]);
INI_WriteString(File,"Owner",VehicleInfo[fileid][vOwner]);
INI_WriteInt(File,"PrevOwners",VehicleInfo[fileid][vPrevOwners]);
INI_WriteString(File,"RegDate",VehicleInfo[fileid][vRegdate]);
INI_WriteInt(File,"Cash",VehicleInfo[fileid][vCash]);
INI_WriteInt(File,"Weapon",VehicleInfo[fileid][vWeapon]);
INI_WriteInt(File,"Pot",VehicleInfo[fileid][vPot]);
INI_WriteInt(File,"Crack",VehicleInfo[fileid][vCrack]);
INI_Close(File);
return 1;
}
function SaveVehicles(fileid)
{
for(new i = 0; i < MAX_VEHICLES; i++)
{
if(VehicleInfo[i][vModel] != 0)
{
SaveVehicle(i);
}
}
}
Quote:
Try creating a vehicle under OnGameModeInit, call a timer and destroy it (after 100ms would be fine), and then you may try loading the vehicles using your function.
You should use printf instead of print if you need to show (a) value in it. PHP код:
|