16.10.2011, 10:06
pawn Код:
CMD:pay(playerid, params[])
{
new Target, Amount;
if( !sscanf(params, "ui", Target, Amount) )
{
if( Amount < 5 ) return SendClientMessage(playerid, -1, "Minimum amount: 5"); // if amount is lower as 5
if( Target == INVALID_PLAYER_ID ) return SendClientMessage(playerid, -1, "Invalid playerid!"); // if target is an invalid playerid
if( Target == playerid ) return SendClientMessage(playerid, -1, "You cant pay yourself."); // if youre the target
if( GetPlayerMoney(playerid) < Amount ) return SendClientMessage(playerid, -1, "You dont have that amount of cash."); // if you dont have enough money you wanted to send to the player
GivePlayerMoney(playerid, -Amount); // removing the money from you
GivePlayerMoney(Target, Amount); // adding the money to you
} else return SendClientMessage(playerid, -1, "Usage: /pay <playerid> <money>");
return 1;
}