Issue with parking tickets/dialog.
#1

The issue with this command is that it works when I don't spawn an admin vehicle (create a new vehicle) but whenever I do, it prints these results:





pawn Код:
CMD:viewtickets(playerid, params[])
{
    if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
    new am, am2, string[128], totalamount;
    if(!IsPlayerInRangeOfPoint(playerid, 3.0, 362.6061,172.3386,1008.3828))return SendClientMessage(playerid, COLOUR_GREY, "You must be at city hall to pay parking tickets.");
    for(new x = 1; x < GetVehiclePoolSize()+1; x++)
    {
        if(VehOwner[x] == PlayerSQLID[playerid])
        {
            am++;
        }
    }
    if(am == 0)return SendClientMessage(playerid, COLOUR_GREY, "You do not own any vehicles.");
    if(am > 0)
    {
        for(new y = 1; y < MAX_TICKETS; y++)
        {
            for(new v = 1; v < GetVehiclePoolSize()+1; v++)
            {
                if(VehicleSQLID[v] > 0)
                {
                    if(PTVehSQLID[y] == VehicleSQLID[v])
                    {
                        am2++;
                        totalamount += PTAmount[y];
                    }
                }
            }
        }
    }
    printf("am %d", am);
    printf("Am2 %d", am2);
    if(am2 == 0)return SendClientMessage(playerid, COLOUR_GREY, "You do not have any outstanding parking tickets.");
    format(string, sizeof(string), "Pay All Tickets: "COL_RED"$%s\n"COL_WHITE"Pay Individual Ticket", AddCommas(totalamount));
    ShowPlayerDialog(playerid, DIALOG_PTICKETS, DIALOG_STYLE_LIST, "Parking Tickets", string, "Select","Exit");
    return 1;
}
I think it's to do with getting the vehicle pool size, I do + 1 because it doesn't seem to display vehicles correctly or by the correct ID or anything
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)