02.03.2016, 08:57
PHP код:
dcmd_pay(playerid, params[])
{
new otherid, cash,string[128],name[MAX_PLAYER_NAME],name2[MAX_PLAYER_NAME];
if(sscanf(params, "ui", otherid, cash)) return SendClientMessage(playerid, 0xFF0000AA, "Usage: /pay [ID] [Cash]");
if(GetPlayerMoney(playerid) > cash) return SendClientMessage(playerid, COLOR_RED, "You don't have that much!");
if(!IsPlayerConnected(otherid)) return SendClientMessage(playerid, COLOR_RED, "That PlayerID is not connected!");
if(otherid == playerid) return SendClientMessage(playerid, COLOR_RED, "It is pointless to pay yourself..");
GivePlayerMoney(playerid, -cash);
GivePlayerMoney(otherid, cash);
GetPlayerName(otherid,name,sizeof(name));
format(string,sizeof(string),"You have given $%d to %s(%d)",cash,name,otherid);
SendClientMessage(playerid,COLOR_RED,string);
GetPlayerName(playerid,name2,sizeof(name2));
format(string,sizeof(string),"You have received $%d from %s(%d). Make sure to thank them",cash,name2,playerid);
SendClientMessage(otherid,COLOR_RED,string);
return 1;
}