19.12.2012, 08:38
Here is the pay cmd which i am using in my script you can change it in your way i think.
pawn Код:
CMD:pay(playerid, params[])
{
new string[128], playerb, amount;
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(sscanf(params, "ui", playerb, amount)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /pay [playerid] [amount]");
if(amount <= 0) return SendClientMessage(playerid, COLOR_GREY, "Invalid money amount.");
if(playerid == playerb) return SendClientMessage(playerid, COLOR_GREY, "You can't pay money to yourself.");
if(!IsPlayerLoggedIn(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
if(!IsPlayerNearPlayer(playerid, playerb, 2)) return SendClientMessage(playerid, COLOR_GREY, "You are too far away from that player.");
if(PlayerInfo[playerid][pMoney] < amount) return SendClientMessage(playerid, COLOR_GREY, "You don't have that much on you right now.");
GivePlayerMoney(playerid, -amount);
GivePlayerMoney(playerb, amount);
format(string, sizeof(string), " You have given %s $%d.", RPN(playerb), amount);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), " %s has given you $%d.", RPN(playerid), amount);
SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
return 1;
}