27.07.2012, 11:12
pawn Код:
CMD:pay(playerid, params[])
{
new otherid, cash;
if (sscanf(params, "dd", otherid, cash)) SendClientMessage(playerid, 0xFF0000AA, "Usage: /pay [ID] [Cash]");
else
{
if(GetPlayerMoney(playerid) < cash) SendClientMessage(playerid, COLOR_RED, "You don't have that much!");
if(!IsPlayerConnected(otherid)) SendClientMessage(playerid, COLOR_RED, "That PlayerID is not connected!");
if(otherid == playerid) SendClientMessage(playerid, COLOR_RED, "It is pointless to pay yourself..");
else
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(otherid, X, Y, Z);
if(IsPlayerInRangeOfPoint(playerid, 5.0, X, Y, Z);
{
GivePlayerMoney(playerid, -cash);
GivePlayerMoney(otherid, cash);
}
else return SendClientMessage(playerid, -1, "You are not close enough to the specified player!");
}
}
return 1;
}