15.05.2014, 10:08
Check if the amount of the money is negative number.
EDIT: I checked for negative cash only and it should be for $0 too as Rafaellos posted.
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;
}