24.06.2016, 17:52
Can someone tell me how can I use ternary operators for this code? I tried but ended up with errors lol.
Or if it's not possible, then are there any better ways to format this list? This right now just works fine but I am just looking for other ways if there's any. Which is probably better than this.
PHP код:
if (_house_HasVehicles(houseid))
{
for (new i = 0, j = MAX_PLAYER_VEHICLES; i < j; i++)
{
if (g_HouseData[houseid][h_pVehs][i])
{
idx = vehicle_ReturnIndex(GetVehicleModel(g_HouseData[houseid][h_pVehs][i]));
if (g_VehicleData[g_HouseData[houseid][h_pVehs][i]][v_Parked])
format(list, sizeof(list), "%s%s\tParked\n", list, g_DealerCars[idx][car_Name]);
else
format(list, sizeof(list), "%s%s\tUnparked\n", list, g_DealerCars[idx][car_Name]);
}
else
format(list, sizeof(list), "%sEmpty\n", list);
}
format(list, sizeof(list), "Vehicle\tStatus\n%s", list);
ShowPlayerDialog(playerid, D_UNPARKEDVEHICLES, DIALOG_STYLE_TABLIST_HEADERS, "Your vehicles", list, "Select", "Back");
}