IsPlayerInRangeOfPoint works even if player isnt in the range of point, why?
#1

Hello

I have made my cmd: /armour
The point is, when you step on armour PickUp and tipe /armour, you get 100 amour.
But I have made if player is in range of point, but it doesnt work, I dont know why.

Here are the codes:

Код:
if (strcmp("/armour", cmdtext, true, 10) == 0)
	{
	IsPlayerInRangeOfPoint(playerid,2, -2167.3972,3306.8318,95.5800);
	SendClientMessage(playerid, COLOR_ORANGE, "Armour PickUP");
	SetPlayerArmour(playerid,100);
	}
It doesnt work that way so I tried:

Код:
if (strcmp("/armour", cmdtext, true, 10) == 0)
   {
   IsPlayerInRangeOfPoint(playerid,2, -2167.3972,3306.8318,95.5800); return SendClientMessage(playerid, COLOR_ORANGE, "You have to be at armour PickUp");
   SendClientMessage(playerid, COLOR_ORANGE, "Armour PickUP");
   SetPlayerArmour(playerid,100);
        return 1;
}
But it doesnt work again. I dont know why, please help.
Compiling this scritps works, everything is fine but when I tipe /armour anywhere ingame I get armour 100.

Thank you.
Reply
#2

Use if(PlayerToPoint(2, playerid, -2167.3972,3306.8318,95.5800))

PHP код:
if (strcmp("/armour"cmdtexttrue10) == 0)
    {
              if(
PlayerToPoint(2playerid, -2167.3972,3306.8318,95.5800))
              {
                       
SendClientMessage(playeridCOLOR_ORANGE"Armour PickUP");
                      
SetPlayerArmour(playerid,100);
                      return 
1;
               }
               else
               {
                      
SendClientMessage(playeridCOLOR_ORANGE"You have to be at armour PickUp");
                      return 
1;
               }
    } 
Reply
#3

pawn Код:
if (strcmp("/armour", cmdtext, true, 10) == 0)
    {
    if(IsPlayerInRangeOfPoint(playerid,2, -2167.3972,3306.8318,95.5800))
{
    SendClientMessage(playerid, COLOR_ORANGE, "Armour PickUP");
    SetPlayerArmour(playerid,100);
    }
return 1;
}
Reply
#4

Код:
if (strcmp("/armour", cmdtext, true, 10) == 0)
{
	if(IsPlayerInRangeOfPoint(playerid,2, -2167.3972,3306.8318,95.5800))
   	{
   		SendClientMessage(playerid, COLOR_ORANGE, "Armour PickUP");
   		SetPlayerArmour(playerid,100);
   	}
   	else
	{
	    SendClientMessage(playerid, COLOR_ORANGE, "You have to be at armour PickUp");
	}
    return 1;
}
Try this
Reply
#5

Thank you Yusei, it works.

Cheers
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)