27.05.2016, 12:21
Check at mine /vinfo commands. You required to know the vehicle's ID:
Also the info vehicle needs to be loaded before this. They are loaded during the gamemode's initialization.
Like this :
PHP код:
#define red 0xCC0000FF
#define rougeUC "{FF000E}"
CMD:vinfo(playerid, params[])
{
if(PlayerInfo[playerid][pAdminlvl] >= 5)
{
new vehid;
if(sscanf(params,"i",vehid)) return SendClientMessage(playerid, X11_LIGHT_BLUE_1, "/vinfo [id_vehicle]");
if(vehid > GetVehiclePoolSize() || vehid <= 0) return SendClientMessage(playerid, red, "[SYSTEM]"rougeUC" Wrong ID.");
printf("\n[DEBUG] /vinfo CALLED | Vehicle ID : %i", vehid);
printf("[vID] %i", PlayerVehicle[vehid][vID]);
printf("[vX] %f",PlayerVehicle[vehid][vX]);
printf("[vY] %f",PlayerVehicle[vehid][vY]);
printf("[vZ] %f",PlayerVehicle[vehid][vZ]);
printf("[vZr] %f",PlayerVehicle[vehid][vZr]);
printf("[vColor1] %i",PlayerVehicle[vehid][vColor1]);
printf("[vColor2] %i",PlayerVehicle[vehid][vColor2]);
printf("[vHealth] %02f",PlayerVehicle[vehid][vHealth]);
printf("[vModel] %i",PlayerVehicle[vehid][vModel]);
printf("[vPrio] %s",PlayerVehicle[vehid][vPrio]);
printf("[vTake] %i",PlayerVehicle[vehid][vTake]);
printf("[vPlate] %i",PlayerVehicle[vehid][vPlate]);
return 1;
}
else return SendClientMessage(playerid, red, "[SYSTEM]"rougeUC" You are not allowed to use this command.");
}
Like this :
PHP код:
for(new i = GetVehiclePoolSize(); i != 0; i--)
{
if(!fexist(UserPathV(i)))
{
printf("Vehicle ID : %i", i);
new randomC1, randomC2;
randomC1 = random(100);
randomC2 = random(100);
GetVehicleZAngle(i,PlayerVehicle[i][vZr]);
GetVehiclePos(i, PlayerVehicle[i][vX], PlayerVehicle[i][vY], PlayerVehicle[i][vZ]);
PlayerVehicle[i][vID] = i;
PlayerVehicle[i][vColor1] = randomC1;
PlayerVehicle[i][vColor2] = randomC2;
ChangeVehicleColor(i, PlayerVehicle[i][vColor1], PlayerVehicle[i][vColor2]);
PlayerVehicle[i][vModel] = GetVehicleModel(i);
GetVehicleHealth(i, PlayerVehicle[i][vHealth]);
PlayerVehicle[i][vTake] = 0;
printf("vID : %i", PlayerVehicle[i][vID]);
printf("vPos (x,y,z) : %f %f %f - %i", PlayerVehicle[i][vX], PlayerVehicle[i][vY], PlayerVehicle[i][vZ], i);
printf("vZr : %f", PlayerVehicle[i][vZr]);
printf("Color : %i - %i", PlayerVehicle[i][vColor1], PlayerVehicle[i][vColor2]);
printf("vModel : %i", PlayerVehicle[i][vModel]);
printf("vHealth : %02f", PlayerVehicle[i][vHealth]);
printf("vTake : %i", PlayerVehicle[i][vTake]);
printf("vPlate : %i", PlayerVehicle[i][vPlate]);
new INI:File = INI_Open(UserPathV(i));
INI_WriteInt(File,"vID",PlayerVehicle[i][vID]);
INI_WriteFloat(File,"vX",PlayerVehicle[i][vX]);
INI_WriteFloat(File,"vY",PlayerVehicle[i][vY]);
INI_WriteFloat(File,"vZ",PlayerVehicle[i][vZ]);
INI_WriteFloat(File,"vZr",PlayerVehicle[i][vZr]);
INI_WriteInt(File,"vColor1",PlayerVehicle[i][vColor1]);
INI_WriteInt(File,"vColor2",PlayerVehicle[i][vColor2]);
INI_WriteFloat(File,"vHealth",PlayerVehicle[i][vHealth]+1000.0);
INI_WriteInt(File,"vModel",PlayerVehicle[i][vModel]);
INI_WriteString(File,"vPrio","None");
INI_WriteInt(File,"vTake",PlayerVehicle[i][vTake]);
INI_WriteInt(File,"vPlate",PlayerVehicle[i][vPlate]);
INI_Close(File);
printf("\n[FILE] Vehicle ID : %i - Created\n", i);
}
else
{
new chemin[120];
//printf("\n--------------------\nStarting to load vehicle id %i", i);
format(chemin, sizeof(chemin), "/daday/Vehicle/%i.ini", i);
INI_ParseFile(chemin, "LoadUserV_data", .bExtra = true, .extra = i);
VehicleParams[i][vMotor] = 0;
VehicleParams[i][vPhares] = 0;
VehicleParams[i][vAlarme] = 0;
VehicleParams[i][vLock] = 0;
VehicleParams[i][vCapot] = 0;
VehicleParams[i][vCoffre] = 0;
VehicleParams[i][vObjective] = 0;
SetVehicleParamsEx(i, VehicleParams[i][vMotor], VehicleParams[i][vPhares], VehicleParams[i][vAlarme], VehicleParams[i][vLock], VehicleParams[i][vCapot], VehicleParams[i][vCoffre], VehicleParams[i][vObjective]);
/*printf("\nvID %i", PlayerVehicle[i][vID]);
printf("vX %f",PlayerVehicle[i][vX]);
printf("vY %f",PlayerVehicle[i][vY]);
printf("vZ %f",PlayerVehicle[i][vZ]);
printf("vZr %f",PlayerVehicle[i][vX]);
printf("vColor1 %i",PlayerVehicle[i][vColor1]);
printf("vColor2 %i",PlayerVehicle[i][vColor2]);
printf("vHealth %f",PlayerVehicle[i][vHealth]);
printf("vModel %i",PlayerVehicle[i][vModel]);
printf("vPrio '%s'",PlayerVehicle[i][vPrio]);
printf("vTake %i",PlayerVehicle[i][vTake]);*/
//print("\nVehicle loaded");
}
}
printf("Vehicle loaded\nMax ID : %i", GetVehiclePoolSize());