10.01.2011, 11:16
This is an example of a /pay command, you could easily change this to your preferences. (Don't critize the code it's coded on a Macintosh which is pain!)
pawn Код:
COMMAND:pay(playerid, params[])
{
new
user,
string[128];
if(sscanf(params, "ud ", user, amount)) return SendClientMessage(playerid, COLOR_WHITE, "ERROR >> That's not the way, try: /pay (player) (amount)");
if(ConnectedStatus[user] != 3) return SendClientMessage(playerid, COLOR_WHITE, "ERROR >> That player is not currently logged in!"); // Should be changed.
if(GetDistanceBetweenPlayers(playerid, user) > 3.0) return SendClientMessage(playerid, COLOR_WHITE, "ERROR >> You are too far away!");
if(amount < 1 || amount > 100000) return SendClientMessage(playerid, COLOR_WHITE, "ERROR >> The amount has to between $1 and $100.000.");
if(player[playerid][money] < amount) return SendClientMessage(playerid, COLOR_WHITE, "ERROR >> You don't have enough money to do that!");
// Everything below this should be changed.
format(string, sizeof(string), "{purple}** %s hands %s an amount of cash.", RemoverUnderScore(playerid), RemoveUnderScore(user));
SendClientMessage(playerid, COLOR_WHITE, string);
player[user][money] = player[user][money]+amount;
player[playerid][money] = player[payerid][money]-amount;
SetPlayerMoney(playerid, player[payerid][money]);
SetPlayerMoney(user, player[user][money]);
return 1;
}