else if(!strcmp(tmp, "list", true, 5))
{
new iBigStr[386];
SendClientMessage(playerid, -1, "{3696EB}________________________________________________________________________");
for(new i = 1; i < sizeof(Vehicle); i++)
{
if(!strcmp(Vehicle[i][vOwner], Name(playerid), false))
{
new zone[ 80 ], Float:vipos[3], lockstr[10];
if(Vehicle[i][tmplocked]) myStrcpy(lockstr, "Yes");
else myStrcpy(lockstr, "No");
GetVehiclePos(i, vipos[0], vipos[1], vipos[2]);
GetZone(vipos[0], vipos[1], vipos[2], zone);
format(iBigStr, sizeof(iBigStr), "{bebaba}(ID %d) {51983e}%s [Location: {bebaba}%s{51983e}] [Locked: {bebaba}%s{51983e}]", i, GetVehicleName(i), zone, lockstr);
SendClientMessage(playerid, -1, iBigStr);
}
else return 1;
}
SendClientMessage(playerid, -1, "{3696EB}________________________________________________________________");
}
else if(!strcmp(tmp, "list", true, 5))
{
new iBigStr[386];
SendClientMessage(playerid, -1, "{3696EB}________________________________________________________________________");
for(new i = 1; i < sizeof(Vehicle); i++)
{
if(!strcmp(Vehicle[i][vOwner], Name(playerid), false))
{
new zone[ 80 ], Float:vipos[3], lockstr[10];
if(Vehicle[i][tmplocked]) myStrcpy(lockstr, "Yes");
else myStrcpy(lockstr, "No");
GetVehiclePos(i, vipos[0], vipos[1], vipos[2]);
GetZone(vipos[0], vipos[1], vipos[2], zone);
format(iBigStr, sizeof(iBigStr), "{bebaba}(ID %d) {51983e}%s [Location: {bebaba}%s{51983e}] [Locked: {bebaba}%s{51983e}]", i, GetVehicleName(i), zone, lockstr);
SendClientMessage(playerid, -1, iBigStr);
}
else return 1;
}
// THIS SendClientMessage(playerid, -1, "{3696EB}________________________________________________________________");
}
Don't return inside loops unless you explicitly want to break them.
|
Return after the loop, after the message that isn't displayed. Also if the very first vehicle in the list isn't owned by you then the loop will just stop on the first iteration and the only thing you will see is the first horizontal rule and nothing else.
|
else if(!strcmp(tmp, "list", true, 5))
{
new iBigStr[386];
SendClientMessage(playerid, -1, "{3696EB}________________________________________________________________________");
SendClientMessage(playerid, -1, sprintf("{D4D4D4}[VEHICLES] {ffffff}%s{D4D4D4}'s vehicles: ",Name(playerid)));
for(new i = 1; i < sizeof(Vehicle); i++)
{
if(!strcmp(Vehicle[i][vOwner], Name(playerid), false))
{
new zone[ 80 ], Float:vipos[3], lockstr[10];
if(Vehicle[i][tmplocked]) myStrcpy(lockstr, "Yes");
else myStrcpy(lockstr, "No");
GetVehiclePos(i, vipos[0], vipos[1], vipos[2]);
GetZone(vipos[0], vipos[1], vipos[2], zone);
format(iBigStr, sizeof(iBigStr), "{bebaba}(ID %d) {51983e}%s [Location: {bebaba}%s{51983e}] [Locked: {bebaba}%s{51983e}]", i, GetVehicleName(i), zone, lockstr);
SendClientMessage(playerid, -1, iBigStr);
}
}
SendClientMessage(playerid, -1, "{3696EB}________________________________________________________________");
}
return 1;
for(new i = 1, j = GetVehiclePoolSize(); i <= j; i++)
{
if (!GetVehicleModel(i)) continue; // if the vehicle does not exist, skip the iterator
if(!strcmp(Vehicle[i][vOwner], Name(playerid), false))
{
...
}
}