23.06.2016, 12:09
Alright, I'm trying to make a 'Public' that update vehicle in a file named 'vehicles.cfg', to brief here's the code
e.g: If I'm in the second line(veh ID 2), the change is gonna happen in the first line(always the same thing,even if there's more vehicles),I don't know where is the wrong, please any help/suggestion is welcome
Код:
if(strcmp(cmd, "/admingarerveh", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new IDVEH = GetPlayerVehicleID(playerid);
new Float:PosX, Float:PosY, Float:PosZ, Float:PosA;
GetVehiclePos(IDVEH, PosX, PosY, PosZ);
GetVehicleZAngle(IDVEH, PosA);
CarSystem[IDVEH][cX] = PosX;
CarSystem[IDVEH][cY] = PosY;
CarSystem[IDVEH][cZ] = PosZ;
CarSystem[IDVEH][cAngle] = PosA;
UpdateVehicle(IDVEH);
}
return 1;
}
Код:
public UpdateVehicle(IDVEH)
{
new File: file2 = fopen("vehicles.cfg");
new coordsstring[258];
format(coordsstring, sizeof(coordsstring), "%d|%d|%f|%f|%f|%f|%d|%d|%d|%d|%d|%d|%s|%d|%d|%d|%d|%d|%d|%d|%d|%d|%s|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d",
CarSystem[IDVEH][cModel],
CarSystem[IDVEH][cEssence],
CarSystem[IDVEH][cX],
CarSystem[IDVEH][cY],
CarSystem[IDVEH][cZ],
CarSystem[IDVEH][cAngle],
CarSystem[IDVEH][cColor1],
CarSystem[IDVEH][cColor2],
CarSystem[IDVEH][cKM],
CarSystem[IDVEH][cObjective],
CarSystem[IDVEH][cDoorsLocked],
CarSystem[IDVEH][cVehicleType],
CarSystem[IDVEH][cPlaque],
CarSystem[IDVEH][cVehicleMaterials],
CarSystem[IDVEH][cVehicleCrack],
CarSystem[IDVEH][cVehiclePot],
CarSystem[IDVEH][cJantes],
CarSystem[IDVEH][cMetre],
CarSystem[IDVEH][cVehicleHealth],
CarSystem[IDVEH][cVehicleAlarm],
CarSystem[IDVEH][cVehicleOwned],
CarSystem[IDVEH][cDescription],
CarSystem[IDVEH][cOwner],
CarSystem[IDVEH][cNitro],
CarSystem[IDVEH][cLoad],
CarSystem[IDVEH][veh_int],
CarSystem[IDVEH][veh_world],
CarSystem[IDVEH][cPaintJob],
CarSystem[IDVEH][cHydro],
CarSystem[IDVEH][cPimped],
CarSystem[IDVEH][cPerma],
CarSystem[IDVEH][cRank],
CarSystem[IDVEH][cPrice],
CarSystem[IDVEH][cSpoiler],
CarSystem[IDVEH][cFbumper],
CarSystem[IDVEH][cRbumper]);
fwrite(file2, coordsstring);
fclose(file2);
}
PHP код:
410|100|2095.676269|-1817.695922|13.038349|272.177825|-1|-1|0|0|0|0|none|0|0|0|-1|12|1000|0|0|0|none|-1|0|1|-1|0|-1|-1|-1|0|0|-1|-1|-1|
414|100|2132.622070|-1869.314697|13.165164|359.999023|-1|-1|0|0|0|0|none|0|0|0|-1|0|1000|0|0|0|none|-1|0|0|1|-1|-1|-1|-1|0|0|-1|-1|-1|


