26.03.2012, 16:11
Ok so I am completely stumped by this. The if statement never runs. Basically this is a check to see if the user chose a gender. By default the gender is set to "N" for no gender. The user chooses a gender and its changed to M or F. I'm attempting to do this via strcmp, here is the code:
Output:
[11:06:09] strcmp(PlayerInfo[playerid][tGender], 'N') = '0'
[11:06:09] Gender passed with 'N' as its value.
Now if I give the player a gender:
[11:06:45] strcmp(PlayerInfo[playerid][tGender], 'N') = '-1'
[11:06:45] Gender passed with 'M' as its value.
How can this be?
Код:
format(strking, sizeof(strking), "strcmp(PlayerInfo[playerid][tGender], 'N') = '%d'", strcmp(PlayerInfo[playerid][tGender], "N"));
print(strking);
if(strcmp(PlayerInfo[playerid][tGender], "N") == 0)
{
format(strking, sizeof(strking), "Must choose gender.");
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Finish", strking, "Cancel", "");
}
format(strking, sizeof(strking), "Gender passed with '%s' as its value.", PlayerInfo[playerid][tGender]);
print(strking);
[11:06:09] strcmp(PlayerInfo[playerid][tGender], 'N') = '0'
[11:06:09] Gender passed with 'N' as its value.
Now if I give the player a gender:
[11:06:45] strcmp(PlayerInfo[playerid][tGender], 'N') = '-1'
[11:06:45] Gender passed with 'M' as its value.
How can this be?

