dialog gender input
#4

Strings should be arrays so each character is stored in a cell. To get user's input use sscanf

Quote:
Originally Posted by v4yne1
Посмотреть сообщение
thanks,

how do I get dialog's inputtext and put it under 'gender' variable?

Код:
 new gender = inputtext;
i get: error 033: array must be indexed (variable "-unknown-")
error 001: expected token: "-string end-", but found "-identifier-"
pawn Код:
if(dialogid == DIALOG_GENDER)
{
    if(!response)
    {
        Kick(playerid);
    }
    else
    {
        if(strlen(inputtext))
        {
            new gender[8];
            if(sscanf(inputtext, "s[7]", gender))
                return 0; // The user's input is not a string, so it stops the code.

            if(strcmp(gender, "male") || strcmp(gender, "female")) // if the code doesn't stop, it will reach here and execute
            {
                ShowPlayerDialog(playerid, DIALOG_GENDER, DIALOG_STYLE_INPUT, "Gender","What is the gender of your character? (male/female)","Next","Quit");
            }
            else
            {
                strcat(PlayerInfo[playerid][Gender], gender, 8); // Dont copy strings directly, use strcat.
                new string[16];
                format(string, sizeof(string), "You are %s", gender);
                SendClientMessage(playerid, -1, string);
            }
        }
    }
}
Reply


Messages In This Thread
dialog gender input - by v4yne1 - 15.03.2019, 17:20
Re: dialog gender input - by TheToretto - 15.03.2019, 17:31
Re: dialog gender input - by v4yne1 - 15.03.2019, 17:39
Re: dialog gender input - by TheToretto - 15.03.2019, 17:47
Re: dialog gender input - by v4yne1 - 15.03.2019, 18:47
Re: dialog gender input - by TheToretto - 15.03.2019, 19:26
Re: dialog gender input - by v4yne1 - 15.03.2019, 19:54
Re: dialog gender input - by d3Pedro - 15.03.2019, 20:06
Re: dialog gender input - by v4yne1 - 15.03.2019, 20:23
Re: dialog gender input - by d3Pedro - 15.03.2019, 20:35
Re: dialog gender input - by v4yne1 - 15.03.2019, 21:07

Forum Jump:


Users browsing this thread: 1 Guest(s)