20.08.2015, 22:18
Quote:
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 код:
The code should look something like this: PHP код:
|
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(inputtext, ACTIVATION_CODE))
{
PlayerInfo[playerid][pActivated] = 1;
return 1;
}
}
ShowPlayerDialog(playerid, DIALOG_ACTIVATION, DIALOG_STYLE_INPUT, "Oops! Something went wrong.", "You have entered an incorrect activation code. Please Try again.", "Activate", "Quit");
return 1;
}