Can someone teach me this.
#1

Can someone teach me about the IfPlayerIsInRangeOfPoint code and how to put in in use in command so the player has to be near a certain point to use the command.
Reply
#2

IsPlayerInRangeOfPoint(playerid, range, X, Y, Z)

check playerid in range of X , Y , Z coordinates with radius range.

for example you want to make a " /heal " command that work just near hospital. (max distance is 10)

hospital coord is :
1212.258, -1326.565, 15.0

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/heal", cmdtext, true, 10) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid,10.0,1212.258, -1326.565, 15.0))
        {
          SetPlayerHealth(playerid,100.0);
        }
        else
        {
         SendClientMessage(playerid,-1,"{FF0000}you should near hospital to use this command.");
        }
        return 1;
    }
    return 0;
}
Reply
#3

And use Zcmd instead.
pawn Код:
CMD:heal(playerid, params[])
{
    if(!IsPlayerInRangeOfPoint(playerid, 10, 1212.258, -1326.565, 15.0) return SendClientMessage(playerid, -1, "You should be near hospital to use this command.");
    SetPlayerHealth(playerid, 100.0);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)