if else statement, else not being called - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: if else statement, else not being called (
/showthread.php?tid=443179)
if else statement, else not being called -
2KY - 10.06.2013
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?
Re: if else statement, else not being called -
Chaprnks - 10.06.2013
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()
Re: if else statement, else not being called -
2KY - 10.06.2013
Thanks!