26.04.2013, 21:44
Ok so I have a CMD which is supposed to show a Dialog to the player with a list of occupied police vehicles and different stats of each car.
The only problem is that it doesn't display all of them in the Dialog, only the first police vehicle it finds. How can I make it list them all? What did I do wrong?
Here's the code:
Thanks in advance guys!
The only problem is that it doesn't display all of them in the Dialog, only the first police vehicle it finds. How can I make it list them all? What did I do wrong?
Here's the code:
pawn Код:
new string[800 char];
new CurrentCars;
CurrentCars = 0;
for(new i = 0; i < MAX_VEHICLES; i++) // MY WIP Police Vehicle Info system. Includes Health, driver, passengers, Location?, and Veh ID
{
if(IsACopCar(i))//All Cop Cars
{
for(new q = 0; q < MAX_PLAYERS; q++)
{
if(IsPlayerInVehicle(q, i))//All Cop Cars with People in the vehicle
{
if(GetPlayerVehicleSeat(q) == 0)//All cop cars with a driver
{
new vehicle[24];
new player[800];
new Float:engine;
GetVehicleHealth(i, engine);
new Float:currenthealth;
currenthealth = engine / 10;
GetVehicleName(i, vehicle, sizeof(vehicle));
new zone[MAX_ZONE_NAME];
GetVehicle2DZone(i, zone, MAX_ZONE_NAME);
new atext[20];
if(gEngine[i] == 1) { atext = "{76EE00}ON{FFFFFF}"; }
else if(gEngine[i] == 0) { atext = "{EE0000}OFF{FFFFFF}"; }
new kmh = GetPlayerSpeed(q, true);
format(player, sizeof(player), "{FFFFFF}Vehicle: %s (%d) | Gov ID: %d | Driver: %s (%d) \n", vehicle, GetVehicleModel(i), i, Nick(q), q);// Want to add more stuff here...
strcat(string, player)
format(player, sizeof(player), " {FFFFFF}Engine Status: %s | Health: %.1f %% | Speed: %d | Location: %s \n", atext, currenthealth, kmh, zone);// Want to add more stuff here...
strcat(string, player)
ShowPlayerDialog(playerid, 1592, DIALOG_STYLE_MSGBOX, "Dispatch Vehicles Display System (DVDS)", string, "Close", "");
strdel(string, 0, strlen(string));
CurrentCars = 1;
return 1;
}
}
}
}