seria mais ou menos assim.. obs vocк utiliza o nome do jogador para saber se ele й o dono.
PHP код:
new VEICULOS_CONCESSIONARIA[MAX_CARS]; /* ARMAZENAR OS CARROS DA CONCESSIONARIA */
SaveVehicles(){
new
file[64]
;
for(new v = 1; v < MAX_CARS; v ++){
format(file, 64, CARROS, v);
if(DOF2_FileExists(file)){
DOF2_SetInt(file, "ModelID", VehicleInfo[v][ModelID]);
DOF2_SetString(file, "Owner", VehicleInfo[v][Owner]);
DOF2_SetString(file, "NrPlate", VehicleInfo[v][NrPlate]);
DOF2_SetFloat(file, "Position X", VehicleInfo[v][posX]);
DOF2_SetFloat(file, "Position Y", VehicleInfo[v][posY]);
DOF2_SetFloat(file, "Position Z", VehicleInfo[v][posZ]);
DOF2_SetFloat(file, "Position A", VehicleInfo[v][posA]);
DOF2_SetInt(file, "ColorA", VehicleInfo[v][ColorA]);
DOF2_SetInt(file, "ColorB", VehicleInfo[v][ColorB]);
DOF2_SetInt(file, "Locked", VehicleInfo[v][Locked]);
DOF2_SetInt(file, "Faction", VehicleInfo[v][Faction]);
DOF2_SaveFile();
}
}
return 1;
}
stock CreatePlayerVehicle(playerid, model)
{
new
file[64]
;
for( new v; v < MAX_CARS; v++ ){
format(file, 64, CARROS, v);
if(DOF2_FileExists(v)) continue;
VehicleInfo[v][ModelID] = model;
VehicleInfo[v][NrPlate] = "BB-0000";
format(VehicleInfo[v][Owner], 100, "%s", RPName(playerid));
VehicleInfo[v][posX] = -156.0357;
VehicleInfo[v][posY] = 1181.0258;
VehicleInfo[v][posZ] = 19.3808;
VehicleInfo[v][posA] = 179.2710;
VehicleInfo[v][ColorA] = random(5);
VehicleInfo[v][ColorB] = random(5);
VehicleInfo[v][Locked] = 1;
VehicleInfo[v][Faction] = 0;
DOF2_CreateFile(v);
DOF2_SetInt(file, "ModelID", VehicleInfo[v][ModelID]);
DOF2_SetString(file, "Owner", VehicleInfo[v][Owner]);
DOF2_SetString(file, "NrPlate", VehicleInfo[v][NrPlate]);
DOF2_SetFloat(file, "Position X", VehicleInfo[v][posX]);
DOF2_SetFloat(file, "Position Y", VehicleInfo[v][posY]);
DOF2_SetFloat(file, "Position Z", VehicleInfo[v][posZ]);
DOF2_SetFloat(file, "Position A", VehicleInfo[v][posA]);
DOF2_SetInt(file, "ColorA", VehicleInfo[v][ColorA]);
DOF2_SetInt(file, "ColorB", VehicleInfo[v][ColorB]);
DOF2_SetInt(file, "Locked", VehicleInfo[v][Locked]);
DOF2_SetInt(file, "Faction", VehicleInfo[v][Faction]);
DOF2_SaveFile();
VEICULOS_CONCESSIONARIA[v] = CreateVehicle( VehicleInfo[v][ModelID], VehicleInfo[v][posX],VehicleInfo[v][posY],VehicleInfo[v][posZ],VehicleInfo[v][posA], VehicleInfo[v][ColorA], VehicleInfo[v][ColorB], -1);
PutPlayerInVehicle(playerid, VEICULOS_CONCESSIONARIA[v], 0);
break;
}
return 1;
}