if else statement, else not being called
#1

I've got the following code:

pawn Код:
case DIALOG_SELROOM:
{
    if( response )
    {
        printf("%f", RoomInfo[0][X]);
        if(strcmp(RoomInfo[listitem][Name], "Empty Room", false ) && RoomBeingCreated[CreatingRoom[playerid]] == 0 )
        {
            print("test");
            ShowPlayerDialog( playerid, DIALOG_CREATEROOM, DIALOG_STYLE_MSGBOX, "You have selected a Blank Room!", "Claim this Room?", "Yes", "No" );
            CreatingRoom[playerid] = listitem;
        }
        else
        {
            print("test2");
            SetSpawnInfo(playerid, 1, 299, RoomInfo[listitem][X], RoomInfo[listitem][Y], RoomInfo[listitem][Z], RoomInfo[listitem][A], 0,0, 0,0, 0,0 );
            SpawnPlayer(playerid);
                   
            plRoom[playerid] = listitem;
        }
    }
    else
    {
        Kick(playerid);
    }
}
The coordinates for RoomInfo[-][X] get called, but "test" nor "test2" get called. What's going on that it causing the code to stop?
Reply
#2

pawn Код:
if(strcmp(RoomInfo[listitem][Name], "Empty Room", false) && RoomBeingCreated[CreatingRoom[playerid]] == 0 )
should be:
pawn Код:
if(!strcmp(RoomInfo[listitem][Name], "Empty Room", false) && RoomBeingCreated[CreatingRoom[playerid]] == 0 )

------------------------


also make sure CreatingRoom[playerid] is in bounds for the if()
Reply
#3

Thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)