How too....
#1

Hi, my todays question is.....
How to create a birthday question with a dialog. i already have it with ingame text but now i want to have it with a dialog. now i have no idea how to do this. this is my actual code:

First the Message:
pawn Код:
SendClientMessage(playerid, COLOR_GREEN, "-----------------------------------------------------------------------");
                    SendClientMessage(playerid, COLOR_GREY, "Ok so you're male, let's go on:");
                    SendClientMessage(playerid, COLOR_WHITE, "2. When is your Birthday (format 02.06.1990)");
                    SendClientMessage(playerid, COLOR_GREEN, "-----------------------------------------------------------------------");
And then the registration step/function:
pawn Код:
if(RegistrationStep[playerid] == 2)
        {
            new year, month,day;
            getdate(year, month, day);
            new DateInfo[3][20];
            split(text, DateInfo, '.');
            if(year - strvalEx(DateInfo[2]) > 100 || strvalEx(DateInfo[2]) < 1 || strvalEx(DateInfo[2]) >= year)
            {
                ClearChatbox(playerid, 8);
                SendClientMessage(playerid, COLOR_GREEN, "-----------------------------------------------------------------------");
                SendClientMessage(playerid, COLOR_WHITE, "When is your Birthday? (Format: DD.MM.YYYY)");
                SendClientMessage(playerid, COLOR_GREEN, "-----------------------------------------------------------------------");
                ClearChatbox(playerid, 2);
                return 0;
            }
            new check = year - strvalEx(DateInfo[2]);
            if(check == year)
            {
                ClearChatbox(playerid, 8);
                SendClientMessage(playerid, COLOR_GREEN, "-----------------------------------------------------------------------");
                SendClientMessage(playerid, COLOR_WHITE, "When is your Birthday? (Format: DD.MM.YYYY)");
                SendClientMessage(playerid, COLOR_GREEN, "-----------------------------------------------------------------------");
                ClearChatbox(playerid, 2);
                return 0;
            }
            if(strvalEx(DateInfo[1]) > month)
            {
                check -= 1;
            }
            else if(strvalEx(DateInfo[1]) == month && strval(DateInfo[0]) > day)
            {
                check -= 1;
            }
            PlayerInfo[playerid][pAge] = check;
            ClearChatbox(playerid, 8);
            SendClientMessage(playerid, COLOR_GREEN, "-----------------------------------------------------------------------");
            format(string, sizeof(string), "Ok, so you're %d Years old.",PlayerInfo[playerid][pAge]);
            SendClientMessage(playerid, COLOR_GREY, string);
            RegistrationStep[playerid] = 3;
            SendClientMessage(playerid, COLOR_WHITE, "3. Where are you from, type in: LS, SF, LV or LC.");
            SendClientMessage(playerid, COLOR_GREEN, "-----------------------------------------------------------------------");
            ClearChatbox(playerid, 2);
            return 0;
        }
Reply
#2

Quote:

By not bumping.

OT:

Just search on the SA-MP wiki, about dialogs?, if that is what you mean.
Reply
#3

Okay now all in one:
I tried to change a birthday question ( for registration ) to the dialog style. I hadn't any ideas how to do this but finaly i tried it and there was just 1 error: "'text' is not defined"

pawn Код:
if(dialogid == BIRTHDAY)
    {
        if(strlen(inputtext))
        {
            new year, month,day;
            getdate(year, month, day);
            new DateInfo[3][20];
            split(text, DateInfo, '.'); //<--- Here is the error (( text is not defined )) but how to define it??
            if(year - strvalEx(DateInfo[2]) > 100 || strvalEx(DateInfo[2]) < 1 || strvalEx(DateInfo[2]) >= year)
            {
                ShowPlayerDialog(playerid,BIRTHDAY,DIALOG_STYLE_INPUT,"Error","When is your Birthday? ( DD.MM.YYYY )","Enter","Cancel");
                return 0;
            }
            new check = year - strvalEx(DateInfo[2]);
            if(check == year)
            {
                ShowPlayerDialog(playerid,BIRTHDAY,DIALOG_STYLE_INPUT,"Error","When is your Birthday? ( DD.MM.YYYY )","Enter","Cancel");
                return 0;
            }
            if(strvalEx(DateInfo[1]) > month)
            {
                check -= 1;
            }
            else if(strvalEx(DateInfo[1]) == month && strval(DateInfo[0]) > day)
            {
                check -= 1;
            }
            PlayerInfo[playerid][pAge] = check;
            ClearChatbox(playerid, 8);
            RegistrationStep[playerid] = 3;
            ShowPlayerDialog(playerid, ORTSMENU, DIALOG_STYLE_LIST, "Okay. Where are you from?","Los Santos\nSan Fierro\nLas Venturas\nLiberty City", "Choose", "Cancel");
            return 0;
        }
    }
My question is how to define 'text'. I cannot find the #define or new part of text :O
Reply
#4

Replace 'text' with 'inputtext'
Reply
#5

thx worked
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)