PHP код:
GetPlayerNameEx(playerid)
{
new pname[25];
GetPlayerName(playerid, pname, sizeof(pname));
return pname;
}
CMD:givecash(playerid, params[])
{
new targetid, amount, string[128];
if (sscanf(params, "ud", targetid, amount)) SendClientMessage(playerid, -1, "SERVER(S): /givecash <playerid/name> <amount>");
if(!IsPlayerConnected(targetid) || targetid == playerid) return SendClientMessage(playerid, -1, "SERVER{ff0000}(E){FFFFFF}: Target ID is offline/yourself.");
if (amount > GetPlayerMoney(playerid)) SendClientMessage(playerid, -1, "SERVER{ff0000}(E){FFFFFF}: You don't have enough money to send.");
if (amount < 1 && amount > 100000) SendClientMessage(playerid, -1, "SERVER{ff0000}(E){FFFFFF}: Your amount value should be between 1 to 100,000.");
GivePlayerMoney(targetid, amount);
GivePlayerMoney(playerid, -amount);
format(string, sizeof(string), "~g~+%d$", amount);
GameTextForPlayer(targetid, string, 3000, 1);
format(string, sizeof(string), "~r~-%d$", amount);
GameTextForPlayer(playerid, string, 3000, 1);
format(string, sizeof(string), "- {FFF2E7}%s(%d) has sent you '%d$'.", GetPlayerNameEx(playerid), playerid, amount);
SendClientMessage(targetid, -1, string);
format(string, sizeof(string), "- {FFF2E7}You've sent '%d$' to %s(%d)", amount, GetPlayerNameEx(targetid), targetid);
SendClientMessage(playerid, -1, string);
return 1;
}