Dialog response help
#1

I made a dialog that you need to insert your age but after i put my age i shows ok so you are 0 years old.
how do i make a good dialog response for the user input?


Код:
	
if(dialogid == 959)
	{
		if(response)
		{
		    new text[256];
		    new age = strvalEx(text);
		    PlayerInfo[playerid][pAge] = age;
			format(string, sizeof(string), "Ok, so you are %d year old.",PlayerInfo[playerid][pAge]);
			SendClientMessage(playerid, COLOR_YELLOW2, string);
   			RegistrationStep[playerid] = 3;
			SendClientMessage(playerid, COLOR_NICEBLUE, "What is your Origin? (Type in: USA, Europe, Asia or Africa)");
		}
		else{}
		return 1;
	}
Reply
#2

Show us strvalEx, it's obviously a custom function or something.

Otherwise, changing it to strval should work. (not completely sure)
Reply
#3

Код:
stock strvalEx( const string[] ) 
{
	// written by mabako in less than a minute :X
	if( strlen( string ) >= 50 ) return 0; // It will just return 0 if the string is too long
	return strval(string);
}
Reply
#4

Could it be because you randomly created a text variable, and you do not do anything to it?

pawn Код:
new text[256];
new age = strvalEx(text);
Since this is a dialog, shouldn't it just be inputtext?
Reply
#5

Код:
	if(dialogid == 959)
	{
		if(response)
		{
		if(!strlen(inputtext)) //If they didn't enter any password
            {// then we will tell to them to enter the password to register
			    ShowPlayerDialog(playerid, 959, DIALOG_STYLE_INPUT, "What is your Age? (16-80)", "Insert your age", "OK", "");
                return 1;
            }
			new age = strvalEx(text);
			if(age < 16 || age > 80)
			{
			    SendClientMessage(playerid, COLOR_NICEBLUE, "What is your Age? (16-80)");
			    return 0;
			}
			PlayerInfo[playerid][pAge] = age;
			format(string, sizeof(string), "Ok, so you are %d year old.",PlayerInfo[playerid][pAge]);
			SendClientMessage(playerid, COLOR_YELLOW2, string);
			RegistrationStep[playerid] = 3;
			SendClientMessage(playerid, COLOR_NICEBLUE, "What is your Origin? (Type in: USA, Europe, Asia or Africa)");
		}
		else{}
		return 1;
	}
now i added if he doesn't write age the dialog will popup again.
now it says after compiling no symbol "text"
but before the dialogrespone the "text" exist. here
Код:
		else if(RegistrationStep[playerid] == 2)
	    {
			 new age = strvalEx(text);
			if(age < 16 || age > 80)
			{
			    SendClientMessage(playerid, COLOR_NICEBLUE, "What is your Age? (16-80)");
			    return 0;
			}
			PlayerInfo[playerid][pAge] = age;
			format(string, sizeof(string), "Ok, so you are %d year old.",PlayerInfo[playerid][pAge]);
			SendClientMessage(playerid, COLOR_YELLOW2, string);
			RegistrationStep[playerid] = 3;
			SendClientMessage(playerid, COLOR_NICEBLUE, "What is your Origin? (Type in: USA, Europe, Asia or Africa)");
			return 0;
	    }
Reply
#6

Like I said, change text to inputtext. You're still using a random text variable.
Reply
#7

Oh, thanks buddy.
Helped me.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)