25.02.2011, 09:45
Quote:
untested but should work
pawn Код:
|
pawn Код:
COMMAND:pay(playerid, params[])
{
new target, amount;
if(sscanf(params, "ui", target, amount)) return SendClientMessage(playerid, 0x00ff0fff, "USAGE: /pay [playerid/name] [monies]");
else if(target == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0x00ff0fff, "Enter a valid player!");
else if(amount > GetPlayerMoney(playerid)) return SendClientMessage(playerid, 0x00ff0fff, "You haven't got enough monies to give!");
GivePlayerMoney(target, amount);
GivePlayerMoney(playerid, -amount);
new string[128], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
GetPlayerName(target, string, MAX_PLAYER_NAME);
format(string, sizeof string, "%s takes out some money and gives it to %s", pName, string);
ProxDetector(40.0, playerid, str, COLOR_ACTION,COLOR_ACTION,COLOR_ACTION,COLOR_ACTION,COLOR_ACTION);
format(string, sizeof string, "You have received %i monies from %s!", amount, pName);
SendClientMessage(target, 0xff0fffff, string);
return 1;
}