SA-MP Forums Archive
[HELP] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] (/showthread.php?tid=272911)



[HELP] - [MKD]Max - 30.07.2011

in givecash command i have put like this

if(IsNumeric(tmp)){
SendClientMessage(playerid,COLOR_ERROR,"USAGE: /givecash (id) (amount) Amouint Must Be Number");
return 1;
}

all is work every thing but when i try to take money from player when i do like this

/givecash 1 -1000

its tell like that

USAGE: /givecash (id) (amount) Amouint Must Be Number


now how i can make this Code IsNumeric accept that thing -

Код:
IsNumeric(const string[])
{
for (new i = 0, j = strlen(string); i < j; i++) {
    if (string[i] > '9' || string[i] < '0') {
return 0;
}
}

return 1;
}



Re: [HELP] - MadeMan - 30.07.2011

pawn Код:
stock IsNumeric(const string[])
{
    if(!string[0]) return 0;
    new i=0;
    if(string[0] == '+' || string[0] == '-') i++;
    while(string[i])
    {
        if (string[i] < '0' || string[i] > '9')
        {
            return 0;
        }
        i++;
    }
    return 1;
}