Dialog and inputtext
#7

Quote:
Originally Posted by Virtual1ty
Посмотреть сообщение
Strcmp is used to compare two strings, however, you might first want to check if 'inputtext' is NULL, and if it has numeric characters only.
'isnull' from the zcmd include:
PHP код:
#if !defined isnull
    #define isnull(%1) \
                
((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
#endif 
'IsNumeric' you have already been given.
The code should look something like this:
PHP код:
#define YOUR_SUPER_SECRET_CODE "1234567890"
if (dialogid == DIALOG_ACTIVATION)
{
    if (!
response) return Kick(playerid);
    if (!
isnull(inputtext))
    {
        if (!
strcmp(inputtextYOUR_SUPER_SECRET_CODE))
        {
            
PlayerInfo[playerid][pActivated] = true;
            return 
1;
        }
    }
    
ShowPlayerDialog(playeridDIALOG_ACTIVATIONDIALOG_STYLE_INPUT"Oops! Something went wrong.""You have entered an incorrect code. Please Try again.""Activate""Quit");
    return 
1;

Getting there, however now it won't activate even though I enter said code. Probably something small I have forgotten.

PHP код:
#if !defined isnull
    #define isnull(%1) \
                
((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
#endif
#define ACTIVATION_CODE "1234567891"
if(dialogid == DIALOG_ACTIVATION)
    {
         if(!
response) return Kick(playerid);
         if(!
IsNumeric(inputtext))
         if (!
isnull(inputtext))
         if(
response)
         {
            if(!
strcmp(inputtextACTIVATION_CODE))
            {
                
PlayerInfo[playerid][pActivated] = 1;
                return 
1;
            }
        }
        
ShowPlayerDialog(playeridDIALOG_ACTIVATIONDIALOG_STYLE_INPUT"Oops! Something went wrong.""You have entered an incorrect activation code. Please Try again.""Activate""Quit");
        return 
1;
    } 
Reply


Messages In This Thread
Dialog and inputtext - by freddiebox - 19.08.2015, 22:06
Re: Dialog and inputtext - by Lunoxel - 19.08.2015, 22:19
Re: Dialog and inputtext - by freddiebox - 19.08.2015, 22:28
Re: Dialog and inputtext - by Lunoxel - 19.08.2015, 22:33
Re: Dialog and inputtext - by freddiebox - 20.08.2015, 12:08
Re: Dialog and inputtext - by Virtual1ty - 20.08.2015, 13:07
Re: Dialog and inputtext - by freddiebox - 20.08.2015, 22:18
Re: Dialog and inputtext - by Jefff - 20.08.2015, 22:22
Re: Dialog and inputtext - by freddiebox - 20.08.2015, 23:22
Re: Dialog and inputtext - by freddiebox - 21.08.2015, 13:45

Forum Jump:


Users browsing this thread: 1 Guest(s)