Command not recognised? Don't see the issue?
#1

pawn Код:
CMD:myvehicles(playerid, params[])//NEEDS REWRITE
{
    new string[512];
    if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
    for(new v= 1;v<MAX_VEHICLES;v++)
    {
        if(VehOwner[v] == PlayerSQLID[playerid])
        {
            new name1 = GetVehicleModel(VehModel[v]) - 400;
            format(string, sizeof(string), "%s%s - ID(%d) - Plate: {33AA33}%s\n",string, VehicleNames[name1], v, VehPlate[v]);
        }
    }
    ShowPlayerDialog(playerid,DIALOG_SHOWCAR,DIALOG_STYLE_MSGBOX,"My Vehicles", string,"Close","");
    return 1;
}
Could anyone tell me why this isn't working?
Reply
#2

VehModel[v] is

new Veh_ID = CreateVehicle(...
VehModel[Veh_ID] = Veh_ID; // or model?

?

maybe should be

new name1 = VehModel[v] - 400;
Reply
#3

Oh yeah, Stupid mistake. Thank you, However, the loop seems to stop at the first vehicle it finds that's a match and doesn't continue? could you tell me why?

EDIT: FIXED. THANK YOU!
Reply
#4

Problem is in VehOwner or VehPlate, use this https://sampforum.blast.hk/showthread.php?tid=262796 and it will print where is the problem
Reply
#5

Also, max vehicles should be looped with a less or equal to (<=) since the limit includes MAX_VEHICLES
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)