pawn Код:
CMD:givemoney(playerid,params[]) {
new Moneys,giveplayerid,giveplayer[MAX_PLAYER_NAME],sendername[MAX_PLAYER_NAME],playerMoney[MAX_PLAYERS],string[64];
new tmp3[50]; GetPlayerIp(playerid,tmp3,50);
if (sscanf(params, "ud",giveplayerid, Moneys)) return SendMessageToPlayer(playerid, COLOR_LIGHTBLUE, "USAGE: /gc [playerid] [amount]");
// if (!IsNumeric(giveplayerid)) giveplayerid = ReturnPlayerID(giveplayerid);
if (IsPlayerConnected(giveplayerid)) {
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
playerMoney[playerid] = GetPlayerMoney(playerid);
if (Moneys > 0 && playerMoney[playerid] >= Moneys) {
GivePlayerMoney(playerid, (-Moneys));
GivePlayerMoney(giveplayerid, Moneys);
format(string, sizeof(string), "You have sent %s (id: %d), $%d.", giveplayer,giveplayerid, Moneys);
SendMessageToPlayer(playerid, green, string);
format(string, sizeof(string), "You have recieved $%d from %s (id: %d).", Moneys, sendername, playerid);
SendMessageToPlayer(giveplayerid, green, string);
printf("%s(playerid:%d) has transfered $ %d to %s(playerid:%d)",sendername, playerid, Moneys, giveplayer, giveplayerid);
format(string, 256, "* %s(playerid:%d) has transfered $ %d to %s(playerid:%d)",sendername, playerid, Moneys, giveplayer, giveplayerid);
SendClientMessageToAll(COLOR_BRIGHTRED, string );}
else {
SendMessageToPlayer(playerid, COLOR_BRIGHTRED, "Invalid transaction amount.");}}
else {
format(string, sizeof(string), "ID:%d is not an active player.", giveplayerid);
SendMessageToPlayer(playerid, COLOR_BRIGHTRED, string);}
return 1;}