03.01.2011, 18:31
(
Последний раз редактировалось Haydz; 03.01.2011 в 19:47.
)
Fixed
if(isNumeric(const string[])==false)
{
SendClientMessage(playerid, color, "Invalid ammount!");
return 1;
}
stock isNumeric(const string[]) {
new length=strlen(string);
if (length==0) return false;
for (new i = 0; i < length; i++) {
if (
(string[i] > '9' || string[i] < '0' && string[i]!='-' && string[i]!='+') // Not a number,'+' or '-'
|| (string[i]=='-' && i!=0) // A '-' but not at first.
|| (string[i]=='+' && i!=0) // A '+' but not at first.
) return false;
}
if (length==1 && (string[0]=='-' || string[0]=='+')) return false;
return true;
}
You can use this:
pawn Код:
pawn Код:
|
if(dialogid == DUELWAGER && response == 1)
{
if(isNumeric(const string[])==false) return SendClientMessage(playerid, COLOR_RED, "Invalid ammount!");
new
amount = strval(inputtext);
if(!(10 <= amount <= 10000)) // Min 10, max 10000 - change these if you like
return SendClientMessage(playerid, COLOR_RED, "Invalid Amount!");