19.08.2015, 22:19
You must use the strval and IsNumeric.
IsNumeric:
Код:
if(dialogid == DIALOG_ACTIVATION)
{
if(!response) return Kick(playerid);
if(!IsNumeric(inputtext)) return SendClientMessage(playerid, -1, "In this dialog you can only use numbers."); // Else, another message
if(response)
{
if(strval(inputtext) == 1)
{
PlayerInfo[playerid][pActivated] = 1;
}
else
{
ShowPlayerDialog(playerid, DIALOG_ACTIVATION, DIALOG_STYLE_INPUT, "Oops! Something went wrong.", "You have entered an incorrect code. Please Try again.", "Activate", "Quit");
}
}
}
Код:
IsNumeric(const string[])
{
for (new i = 0, j = strlen(string); i < j; i++)
{
if (string[i] > '9' || string[i] < '0') return 0;
}
return 1;
}

