Posts: 1,648
Threads: 482
Joined: Jun 2010
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?
Posts: 2,593
Threads: 34
Joined: Dec 2007
VehModel[v] is
new Veh_ID = CreateVehicle(...
VehModel[Veh_ID] = Veh_ID; // or model?
?
maybe should be
new name1 = VehModel[v] - 400;
Posts: 1,648
Threads: 482
Joined: Jun 2010
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!
Posts: 2,593
Threads: 34
Joined: Dec 2007
Problem is in VehOwner or VehPlate, use this
https://sampforum.blast.hk/showthread.php?tid=262796 and it will print where is the problem
Posts: 1,164
Threads: 20
Joined: Oct 2008
Reputation:
0
Also, max vehicles should be looped with a less or equal to (<=) since the limit includes MAX_VEHICLES