Needing help on a script
#3

Can't you just check if cmdreason < 0? If so don't allow transaction.

pawn Код:
CMD:transfer(playerid,params[])
{
    new string[128],ID,cmdreason;
    if(sscanf(params, "ud", ID, cmdreason))
    {
        SendClientMessage(playerid,COLOR_ERROR,"USAGE: /transfer (id/name) (Amount)");
        return 1;
    }
   
    if( cmdreason < 0 )
    {
        SendClientMessage(playerid,COLOR_ERROR,"ERROR: Cannot tranfer negative amount.");
        return 1;
    }
   
    //... rest of stuff
   
    return 1;
}
EDIT: Changed your sscanf line to use the 'u' specifier too. Now you can do /transfer [name][amount] aswell as id.
Reply


Messages In This Thread
Needing help on a script - by yvoms - 13.04.2012, 21:48
Re: Needing help on a script - by yvoms - 13.04.2012, 22:21
Re: Needing help on a script - by iggy1 - 13.04.2012, 22:24
Re: Needing help on a script - by yvoms - 13.04.2012, 23:10
Re: Needing help on a script - by ReneG - 13.04.2012, 23:15
Re: Needing help on a script - by yvoms - 14.04.2012, 00:17
Re: Needing help on a script - by yvoms - 14.04.2012, 10:08

Forum Jump:


Users browsing this thread: 1 Guest(s)