20.08.2015, 13:07
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:
'IsNumeric' you have already been given.
The code should look something like this:
'isnull' from the zcmd include:
PHP код:
#if !defined isnull
#define isnull(%1) \
((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
#endif
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(inputtext, YOUR_SUPER_SECRET_CODE))
{
PlayerInfo[playerid][pActivated] = true;
return 1;
}
}
ShowPlayerDialog(playerid, DIALOG_ACTIVATION, DIALOG_STYLE_INPUT, "Oops! Something went wrong.", "You have entered an incorrect code. Please Try again.", "Activate", "Quit");
return 1;
}