PHP Code:
cmd:givecash(playerid,params[])
{
new ID;
new Cash;
new string[128];
if(!IsPlayerName(playerid,"Owner") && !IsPlayerName(playerid, "heeh")) return SCM(playerid,COLOR_WHITE,"{FF0000}[ERROR]{FFFFFF}You have submitted an invalid command, Type /commands or /cmds to see the server commands");
if(sscanf(params,"ui",ID,Cash))
{
SendClientMessage(playerid,COLOR_WHITE,""COL_USAGE"[SYNTAX] {FFFFFF}/givecash [PLAYER_ID] [AMOUNT]");
return 1;
}
if(!IsPlayerConnected(ID))
{
format(string,sizeof(string),"{AFAFAF}[Error]: {FFFFFF}Invalid player ID.");
SendClientMessage(playerid,COLOR_WHITE,string);
return 1;
}
if(Cash > 99999999) return SCM(playerid,COLOR_WHITE,"{AFAFAF}[Error]: {FFFFFF}You cannot enter an amount more than $99,999,999.");
if(Cash < 0)
{
format(string,sizeof(string),""COL_ADMIN"[ADMIN]{FFFFFF} You have token {F8E607}$%s{FFFFFF} from {AFAFAF}%s(%d).",FiN(Cash),PlayerName(ID),ID);
SendClientMessage(playerid,COLOR_WHITE,string);
format(string,sizeof(string),""COL_ADMIN"[ADMIN] {FFFFFF}%s(%d) has token {F8E607}$%s{FFFFFF} from you!",PlayerName(playerid),ID,FiN(Cash));
SendClientMessage(ID,COLOR_WHITE,string);
GivePlayerMoney(ID,Cash);
return 1;
}
if(Cash == 0) return SCM(playerid,COLOR_WHITE,"{AFAFAF}[Error]: {FFFFFF}Invalid money amount.");
GivePlayerMoney(ID,Cash);
format(string,sizeof(string),""COL_ADMIN"[ADMIN] {FFFFFF}%s has given you {F8E607}$%s{FFFFFF}!",PlayerName(playerid),FiN(Cash));
SendClientMessage(ID,COLOR_WHITE,string);
format(string,sizeof(string),""COL_ADMIN"[ADMIN] {FFFFFF}You have given {AFAFAF}%s(%d){F8E607} $%s{FFFFFF}.",PlayerName(ID),ID,FiN(Cash));
SendClientMessage(playerid,COLOR_WHITE,string);
return 1;
}