This command won't return if the player doesn't have vehicles.
#8

Quote:
Originally Posted by Calabresi
Посмотреть сообщение
That will say player has no vehicles EVEN if they have one, since you never let the loop go and count the vehicle count.
Oh right, I didn't notice that.

pawn Код:
CMD:myvehicles(playerid, params[])//NEEDS REWRITE
{
    new string[512], name1, am = 0;
    if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command."), true;
   
    for(new v = 1; v < MAX_VEHICLES; v++)
    {
        if(VehOwner[v] == PlayerSQLID[playerid])
        {
            am ++;
            printf("CHECKING IF VEHOWNER");
            name1 = GetVehicleModel(v) - 400;
            printf("VehMODEL %d", VehModel[v]);
            format(string, sizeof(string), "{FFFFFF}%s{FFFFFF}%s - {FFFFFF}ID({33AA33}%d{FFFFFF}) - Plate: {33AA33}%s\n",string, VehicleNames[name1], v, VehPlate[v]);
            printf("%s");
        }

    }
    if(am < 1) return SendClientMessage(playerid, COLOUR_GREY, "You do not own any vehicles"), true;
    ShowPlayerDialog(playerid,DIALOG_SHOWCAR,DIALOG_STYLE_MSGBOX,"My Vehicles", string,"Close","");
    printf("shown dialog");
    return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)