08.07.2010, 01:17
pawn Код:
dcmd_givecash(playerid,params[])
{
new
giveplayerid,
amount;
if (sscanf(params, "ud", giveplayerid, amount)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /givecash [id] [amount]");
else if (giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "ERROR: Invalid ID!");
else if (GetPlayerMoney(playerid) < amount) return SendClientMessage(playerid, COLOR_RED, "ERROR: Insufficient Funds");
else
{
GivePlayerMoney(giveplayerid, amount);
GivePlayerMoney(playerid, -amount);
new string[100];
format(string, sizeof(string), "%s has sent you $%d", ReturnPlayerName(playerid),amount);
SendClientMessage(giveplayerid, COLOR_YELLOW, string);
format(string, sizeof(string),"$%d sent to %s", amount,ReturnPlayerName(giveplayerid));
SendClientMessage(playerid, COLOR_YELLOW, string);
}
return 1;
}