A /heal command.
#5

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;
}
Reply


Messages In This Thread
A /heal command. - by Sting. - 16.11.2012, 19:17
Re: A /heal command. - by Lean - 16.11.2012, 19:22
Re: A /heal command. - by Konstantinos - 16.11.2012, 19:26
Re: A /heal command. - by Lean - 16.11.2012, 19:30
Re: A /heal command. - by Abreezy - 16.11.2012, 19:36
Re: A /heal command. - by Anthony © - 16.11.2012, 19:48
Re : Re: A /heal command. - by Konstantinos - 16.11.2012, 19:56
Re: A /heal command. - by MatZZPL - 16.11.2012, 20:12
Re: Re : Re: A /heal command. - by Anthony © - 16.11.2012, 21:14
Re: A /heal command. - by Sting. - 17.11.2012, 03:28

Forum Jump:


Users browsing this thread: 7 Guest(s)