Issue with parking tickets/dialog.
#5

It becomes 0 with the pay all parking tickets although it should return no outstanding tickets.

pawn Код:
if(dialogid == DIALOG_PTICKETS)
    {
        if(response == 0)
        {
            return 1;
        }
        else
        {
            new am, am2, name, string[600], ticket[128], totalamount;
            switch(listitem)
            {
                case 0:
                {
                    for(new x = 1; x < GetVehiclePoolSize()+1; x++)
                    {
                        if(VehOwner[x] == PlayerSQLID[playerid])
                        {
                            am++;
                        }
                        if(am > 0)
                        {
                            for(new y = 1; y < MAX_TICKETS; y++)
                            {
                                if(PTVehSQLID[y] == VehicleSQLID[x])
                                {
                                    am2++;
                                    name = GetVehicleModel(x) - 400;
                                    format(ticket, sizeof(ticket), "Vehicle: %s | Plate: %s | Fine: $%s | Reason: %s\n", VehicleNames[name], VehPlate[x], AddCommas(PTAmount[y]), PTReason[y]);
                                    strcat(string, ticket);
                                    totalamount += PTAmount[y];
                                }
                            }
                        }
                    }
                    RepairCost[playerid] = totalamount;
                    format(ticket, sizeof(ticket), ""COL_WHITE"Total Amount Of Parking Tickets: "COL_RED"%s\n", AddCommas(am2));
                    strcat(string, ticket);
                    format(ticket, sizeof(ticket), ""COL_WHITE"Total Parking Ticket Amount: "COL_RED"$%s", AddCommas(totalamount));
                    strcat(string, ticket);
                    ShowPlayerDialog(playerid, DIALOG_ALLTICKET,DIALOG_STYLE_MSGBOX,"Parking Tickets", string,"Pay All","Cancel");
                }
                case 1:
                {
                    for(new x = 1; x < GetVehiclePoolSize()+1; x++)
                    {
                        if(VehOwner[x] == PlayerSQLID[playerid])
                        {
                            am++;
                        }
                        if(am > 0)
                        {
                            for(new y = 1; y < MAX_TICKETS; y++)
                            {
                                if(PTVehSQLID[y] == VehicleSQLID[x])
                                {
                                    am2++;
                                    name = GetVehicleModel(x) - 400;
                                    VehTicketList[playerid] = am2 - 1;
                                    format(string, sizeof(string), "%sVehicle: %s | Plate: %s | Fine: $%s | Reason: %s\n", string, VehicleNames[name], VehPlate[x], AddCommas(PTAmount[y]), PTReason[y]);
                                }
                            }
                        }
                    }
                    ShowPlayerDialog(playerid, DIALOG_ONETICKET,DIALOG_STYLE_LIST,"Parking Tickets", string,"Info","Cancel");
                }
            }
        }
    }
Reply


Messages In This Thread
Issue with parking tickets/dialog. - by Dokins - 21.04.2016, 22:57
Re: Issue with parking tickets/dialog. - by Abagail - 21.04.2016, 23:01
Re: Issue with parking tickets/dialog. - by Dokins - 21.04.2016, 23:13
Re: Issue with parking tickets/dialog. - by Abagail - 21.04.2016, 23:14
Re: Issue with parking tickets/dialog. - by Dokins - 21.04.2016, 23:18
Re: Issue with parking tickets/dialog. - by Abagail - 21.04.2016, 23:20
Re: Issue with parking tickets/dialog. - by Dokins - 21.04.2016, 23:46

Forum Jump:


Users browsing this thread: 1 Guest(s)