31.10.2015, 14:30
PHP код:
CMD:givecash(playerid, params[])
{
new player, amount,name1[24], name2[24], string[128];
if(!sscanf(params, "ui",player,amount))
{
if(playerid != player)
{
if(GetPlayerMoney(playerid) >= amount)
{
GetPlayerName(playerid, name1, 24);
GetPlayerName(player, name2, 24);
format(string, sizeof(string), "* You send $%d to %s",amount,name2);
SendClientMessage(playerid, COLOR_GREY2, string);
format(string, sizeof(string), "* You have received $%d from %s", amount, name1);
SendClientMessage(player, COLOR_GREY2, string);
GivePlayerMoney(playerid, -amount);
GivePlayerMoney(player, amount);
return 1;
}
else {
format(string, sizeof(string), "* Sorry, invalid transaction... you dont have $%d!",amount);
return SendClientMessage(playerid, COLOR_ERROR_YELLOW, string);}
}
else return SendClientMessage(playerid, COLOR_ERROR_YELLOW,"* Sorry, you cannot give cash to yourself!");
}
else {
SendClientMessage(playerid, COLOR_ERROR_YELLOW,"** Usage: /givecash <PlayerID/PlayerName> <MoneyAmount>");
return SendClientMessage(playerid, COLOR_ERROR_YELLOW,"* Gives the specified amount of your money to the player specified.");}
}