MSGBOX Help
#1

Hey guys.. I've tried doing my GENDER System :P

This is my Showdialog:
Код:
			ShowPlayerDialog(playerid, DIALOG_GENDER, DIALOG_STYLE_MSGBOX, "Gender Selection", "Please select the Gender of your character.\nRemember that the gender you select will be the gender you will roleplay as!\nSelect either 'Male' or 'Female' from the buttons below!", "Male", "Female");
And this is DIALOG_GENDER:
Код:
        case DIALOG_GENDER:
        {
            if(!response)
            {
			ShowPlayerDialog(playerid, DIALOG_GENDER, DIALOG_STYLE_MSGBOX, "Gender Selection", "You MUST select a gender to continue!\n\nPlease select the Gender of your character.\nRemember that the gender you select will be the gender you will roleplay as!\nSelect either 'Male' or 'Female' from the buttons below!", "Male", "Female");
			}
   			if(response) 
	        {
	            PlayerInfo[playerid][pGender] = 0;
	        }
	        else 
	        {
	            PlayerInfo[playerid][pGender] = 1;
	        }
        }
I want to know if I've done the DIALOG_GENDER Correct, or if there's anything I need to change? :/ Thanks!
Reply
#2

I would do it like this, if the response is true, it means they have chosen to become a male, if response is false they have chosen to become a female. There is no need to first check if the response is false because it actually means they have chosen to become a female.

Код:
case DIALOG_GENDER:
{
	PlayerInfo[playerid][pGender] = (response) ? 0 : 1;
}
Reply
#3

Wait I don't get that ^^ What If they press ESC? How do I make it so that the Dialog Re-appears?
And could you explain that more? Is that ALL I would need to put and that would be if they choose first option they are male and if they choose the second option they are female?
Reply
#4

If they press escape it will return false (!response), which is assigned to 'Female'.

What that line does;

Код:
if(response)
{
    PlayerInfo[playerid][pGender] = 0;
}
else
{
    PlayerInfo[playerid][pGender] = 1;
}
You could also see it as:

Код:
PlayerInfo[playerid][pGender] = (response == 1) ? (==) male : (else) female;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)