pawn Код:
CMD:heal(playerid, params[])
{
new pID;
if(sscanf(params, "u", pID)) return SendClientMessage(playerid, -1, "Usage: /heal playerid");
if(IsPlayerInRangeOfPlayer(playerid, pID, 5))
{
if(playerid != pID)
{
SetPlayerHealth(pID, 100);
GivePlayerMoney(playerid, 150);
GivePlayerMoney(pID, -150);
SendClientMessage(pID, -1, "You have been healed.");
SendClientMessage(playerid, -1, "You have healed the player.");
}
else
{
SendClientMessage(playerid, -1, "You can't heal yourself.");
}
}
else
{
SendClientMessage(playerid, -1, "You aren't close enough to the player.");
}
return 1;
}
Theres the command, heres the function:
pawn Код:
stock IsPlayerInRangeOfPlayer(playerid, targetid, distance)
{
new
Float:X, Float:Y, Float:Z, Float:tX, Float:tY, Float:tZ;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerPos(targetid, tX, tY, tZ);
if(IsPlayerInRangeOfPoint(playerid, distance, tX, tY, tZ)) return 1;
return 0;
}