I'm trying to make a command so the player can find his doors but when I use the command it only shows the first door
How to fix it?
Code:
CMD:mydoors(playerid, params[])
{
new string[128],id1,id2,id3;
id1 = PlayerInfo[playerid][pDoor1];
id2 = PlayerInfo[playerid][pDoor2];
id3 = PlayerInfo[playerid][pDoor3];
if(PlayerInfo[playerid][pDoor1] == -1 && PlayerInfo[playerid][pDoor2] == -1 && PlayerInfo[playerid][pDoor3] == -1) return SCM(playerid,COLOR_WHITE, "You do not own any doors");
if(PlayerInfo[playerid][pDoor1] >= 0 )
{
format(string,sizeof(string), "Door ID: %d | Description: %s", id1, DDoorsInfo[id1][ddDescription]);
SCM(playerid,COLOR_WHITE, string);
}
else if(PlayerInfo[playerid][pDoor2] >= 0 )
{
format(string,sizeof(string), "Door ID: %d | Description: %s", id2, DDoorsInfo[id2][ddDescription]);
SCM(playerid, COLOR_WHITE, string);
}
else if(PlayerInfo[playerid][pDoor3] >= 0)
{
format(string,sizeof(string), "Door ID: %d | Description: %s", id3, DDoorsInfo[id3][ddDescription]);
SCM(playerid, COLOR_WHITE, string);
}
return 1;
}