Help With cash giving in -
#2

Check if the amount of the money is negative number.

pawn Код:
CMD:giveadmincash(playerid, params[])
{
    if(pInfo[playerid][Adminlevel] < 10) return SCM(playerid, COLOR_RED, ""ERROR_MESSAGE"");
    new TargetID, cash, reason[50];
    if(sscanf(params, "uds[50]", TargetID, cash,reason)) return SCM(playerid, COLOR_RED, "USAGE: /giveadmincash [id] [cash] [reason]");
    if(TargetID == INVALID_PLAYER_ID) return SCM(playerid, COLOR_RED, "*Player Is Not Connected.");
    if(cash <= 0) return SCM(playerid, COLOR_RED, "You cannot give negative amount of money");
    pInfo[TargetID][Money] += cash;
    new str[128];
    format(str,sizeof(str),"** Admin Has Given You $%d Cash. REASON : %s", cash,reason);
    SCM(TargetID ,COLOR_SKYBLUE, str);
    format(str,sizeof(str),"** CASH: %s(%d) (ADMIN CASH) Has Been Given Cash '$%d'. Reason %s", pInfo[TargetID][playername], TargetID, cash,reason);
    SCMA(COLOR_HOTPINK, str);
    print(str);
    return 1;
}
EDIT: I checked for negative cash only and it should be for $0 too as Rafaellos posted.
Reply


Messages In This Thread
Help With cash giving in - - by AroseKhanNiazi - 15.05.2014, 10:02
Re: Help With cash giving in - - by Konstantinos - 15.05.2014, 10:08
Re: Help With cash giving in - - by ]Rafaellos[ - 15.05.2014, 10:09
Re: Help With cash giving in - - by AroseKhanNiazi - 15.05.2014, 10:15

Forum Jump:


Users browsing this thread: 1 Guest(s)