Help With cash giving in - - 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)
+--- Thread: Help With cash giving in - (
/showthread.php?tid=513221)
Help With cash giving in - -
AroseKhanNiazi - 15.05.2014
i got some problem that we can give the cash in negative amount in this way we can take cash from it so how to know he used the -
pawn Код:
CMD:giveadmincash(playerid, params[])
{
new TargetID, cash,reason[500];
if(pInfo[playerid][Adminlevel] < 10) return SCM(playerid, COLOR_RED, ""ERROR_MESSAGE"");
if(sscanf(params, "uds[500]", TargetID, cash,reason)) return SCM(playerid, COLOR_RED, "USAGE: /giveadmincash [id] [cash] [reason]");
if(TargetID == INVALID_PLAYER_ID || !IsPlayerConnected(TargetID )) return SCM(playerid, COLOR_RED, "*Player Is Not Connected.");
new Miney = pInfo[TargetID][Money];
pInfo[TargetID][Money] =Miney+cash;
new str[128],str1[128];
format(str,sizeof(str),"** Admin Has Given You $%d Cash. REASON : %s", cash,reason);
SCM(TargetID ,COLOR_SKYBLUE, str);
format(str1,sizeof(str1),"** CASH: %s(%d) (ADMIN CASH) Has Been Given Cash '$%d'. Reason %s", pInfo[TargetID][playername], TargetID, cash,reason);
SCMA(COLOR_HOTPINK, str1);
print(str1);
return 1;
}
Re: Help With cash giving in - -
Konstantinos - 15.05.2014
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.
Re: Help With cash giving in - -
]Rafaellos[ - 15.05.2014
pawn Код:
if(cash <= 0) return SendClientMessage(playerid, -1, "Invalid cash");
Edit: Late.
Re: Help With cash giving in - -
AroseKhanNiazi - 15.05.2014
thanks to both