PHP код:
Dialog_GetCarSelectHouse(playerid, response, listitem)
{
// Just close the dialog if the player clicked "Cancel"
if(!response) return 1;
// Get the houseid based on the chosen listitem
new HouseID = APlayerData[playerid][Houses][listitem];
new Float:Gasosa, vehicleid; // aqui defeniзгo da Gasosa
vehicleid = GetPlayerVehicleID(playerid);
// Check if it was a valid house
if (HouseID != 0)
{
// Setup local variables
new BuyableCarIndex, VehicleList[500], bool:HouseHasCars = false, CarSlot;
// Store the HouseID, otherwise the next dialog won't be able to get a car from the chosen house
APlayerData[playerid][DialogGetCarHouseID] = HouseID;
// Check if the house has any cars assigned to it
for (CarSlot = 0; CarSlot < 10; CarSlot++)
if (AHouseData[HouseID][VehicleIDs][CarSlot] != 0)
HouseHasCars = true;
strins(VehicleList,"Veiculo\tCombustivel\tApreendido\n", strlen(VehicleList));
Gasosa = AVehicleData[CarSlot][Fuel]; // aqui defeniзгo da Gasosa para converter para porcentagem
// Check if the house has any cars assigned to it
if (HouseHasCars == true)
{
// Add all vehicles to the list
for (CarSlot = 0; CarSlot < 10; CarSlot++)
{
// Check if the carslot has a vehicle in it
if (AHouseData[HouseID][VehicleIDs][CarSlot] != 0)
{
// Get the index where the first vehicle is found in the ABuyableVehicles array
BuyableCarIndex = VehicleBuyable_GetIndex(GetVehicleModel(AHouseData[HouseID][VehicleIDs][CarSlot]));
// Add the name of the vehicle to the list
if (AVehicleData[AHouseData[HouseID][VehicleIDs][CarSlot]][Clamped] == true)
format(VehicleList, 500, "%s{00FF00}%s\t%d%%\tSim\n", VehicleList, ABuyableVehicles[BuyableCarIndex][CarName], floatround(Gasosa)/ 100); // tem ai floatround da gasosa
else
format(VehicleList, 500, "%s{00FF00}%s\t%d%%\tNгo\n", VehicleList, ABuyableVehicles[BuyableCarIndex][CarName], floatround(Gasosa)/ 100); // tem ai floatround da gasosa
}
else
format(VehicleList, 500, TXT_EmptyCarSlot, VehicleList);
}
// Ask which vehicle the player wants to teleport to his location
ShowPlayerDialog(playerid, DialogGetCarSelectCar, DIALOG_STYLE_TABLIST_HEADERS, TXT_SelectVehicleToGet, VehicleList, TXT_DialogButtonSelect, TXT_DialogButtonCancel);
}
else
SendClientMessage(playerid, -1, TXT_NoHouseVehicles);
}
else
SendClientMessage(playerid, -1, TXT_NoHouseInSlot);
return 1;
}