SA-MP Forums Archive
Multiply IsPlayerInRangeOfPoint - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Multiply IsPlayerInRangeOfPoint (/showthread.php?tid=156879)



Multiply IsPlayerInRangeOfPoint - [KMA]DlennartD - 24.06.2010

Hello,

I have a little question, I'm sure the answer is simple, but I'm searching for a few days now to find a solution.
I made a /buy menu where you can buy stuff ingame, I'm using the following line's to make it able to open this menu in multiply places:

Code:
if(!strcmp("/buy",cmdtext))
{
  if(IsPlayerInRangeOfPoint(playerid, 7.0, 2695.6880, -1704.6300, 11.8438))
  {
    "Open buymenu"
  }
  if(IsPlayerInRangeOfPoint(playerid, 7.0, 1695.5674, -5434.6300, 44.8438))
  {
    "Open buymenu"
  }
  if(IsPlayerInRangeOfPoint(playerid, 7.0, 3455.6880, -2345.6300, 523.8438))
  {
    "Open buymenu"
  }
  else{
  SendClientMessage(playerid,0xFFFFFFFF,"You are not near a buy point!");
  }
  return 1;
}
There must be a more easy way to add multiply IsPlayerInRangeOfPoints, but how?

I tryd somethign like:

Code:
if(IsPlayerInRangeOfPoint(playerid, 7.0, 3455.6880, -2345.6300, 523.8438) || IsPlayerInRangeOfPoint(playerid, 7.0, 3455.6880, -2345.6300, 523.8438) || IsPlayerInRangeOfPoint(playerid, 7.0, 3455.6880, -2345.6300, 523.8438))
But that also didn't work, I hope somebody can help me.

Thanks for reading!


Re: Multiply IsPlayerInRangeOfPoint - Hiddos - 24.06.2010

Are you sure if(bla || bla) doesn't work? I never had that before.


Re: Multiply IsPlayerInRangeOfPoint - NewTorran - 24.06.2010

pawn Code:
if(IsPlayerInRangeOfPoint(playerid, 7.0, 3455.6880, -2345.6300, 523.8438 || IsPlayerInRangeOfPoint(playerid, 7.0, 3455.6880, -2345.6300, 523.8438 || IsPlayerInRangeOfPoint(playerid, 7.0, 3455.6880, -2345.6300, 523.8438))
Try that


Re: Multiply IsPlayerInRangeOfPoint - Assyria - 24.06.2010

Quote:
Originally Posted by Joe Torran C
pawn Code:
if(IsPlayerInRangeOfPoint(playerid, 7.0, 3455.6880, -2345.6300, 523.8438 || IsPlayerInRangeOfPoint(playerid, 7.0, 3455.6880, -2345.6300, 523.8438 || IsPlayerInRangeOfPoint(playerid, 7.0, 3455.6880, -2345.6300, 523.8438))
Try that
You are missing some ")"...

Correct version:

Code:
if(!strcmp("/buy",cmdtext))
{
	if(IsPlayerInRangeOfPoint(playerid, 7.0, 2695.6880, -1704.6300, 11.8438) || IsPlayerInRangeOfPoint(playerid, 7.0, 1695.5674, -5434.6300, 44.8438) || IsPlayerInRangeOfPoint(playerid, 7.0, 3455.6880, -2345.6300, 523.8438))
	{
			"Open buymenu"
  	}
  	else return SendClientMessage(playerid,0xFFFFFFFF,"You are not near a buy point!");
  	return 1;
}
(Intendations are made using space...)


Re: Multiply IsPlayerInRangeOfPoint - Niixie - 24.06.2010

If you want to use this

pawn Code:
if(!strcmp("/buy",cmdtext))
{
  if(IsPlayerInRangeOfPoint(playerid, 7.0, 2695.6880, -1704.6300, 11.8438))
  {
    "Open buymenu"
  }
  if(IsPlayerInRangeOfPoint(playerid, 7.0, 1695.5674, -5434.6300, 44.8438))
  {
    "Open buymenu"
  }
  if(IsPlayerInRangeOfPoint(playerid, 7.0, 3455.6880, -2345.6300, 523.8438))
  {
    "Open buymenu"
  }
  else{
  SendClientMessage(playerid,0xFFFFFFFF,"You are not near a buy point!");
  }
  return 1;
}
then GOD next time remember to use else if

correct version
pawn Code:
if(!strcmp("/buy",cmdtext))
{
  if(IsPlayerInRangeOfPoint(playerid, 7.0, 2695.6880, -1704.6300, 11.8438))
  {
    "Open buymenu"
  }
  else if(IsPlayerInRangeOfPoint(playerid, 7.0, 1695.5674, -5434.6300, 44.8438))
  {
    "Open buymenu"
  }
  else if(IsPlayerInRangeOfPoint(playerid, 7.0, 3455.6880, -2345.6300, 523.8438))
  {
    "Open buymenu"
  }
  else{
  SendClientMessage(playerid,0xFFFFFFFF,"You are not near a buy point!");
  }
  return 1;
}
but ofc.

Assyrias version is WAY better
pawn Code:
if(IsPlayerInRangeOfPoint(playerid, 7.0, 2695.6880, -1704.6300, 11.8438) || IsPlayerInRangeOfPoint(playerid, 7.0, 1695.5674, -5434.6300, 44.8438) || IsPlayerInRangeOfPoint(playerid, 7.0, 3455.6880, -2345.6300, 523.8438))
    {
            "Open buymenu"
    }
    else return SendClientMessage(playerid,0xFFFFFFFF,"You are not near a buy point!");
Because the first one is a shitload of space thats not needed.


Re: Multiply IsPlayerInRangeOfPoint - NewTorran - 24.06.2010

Quote:
Originally Posted by Assyria
Quote:
Originally Posted by Joe Torran C
pawn Code:
if(IsPlayerInRangeOfPoint(playerid, 7.0, 3455.6880, -2345.6300, 523.8438 || IsPlayerInRangeOfPoint(playerid, 7.0, 3455.6880, -2345.6300, 523.8438 || IsPlayerInRangeOfPoint(playerid, 7.0, 3455.6880, -2345.6300, 523.8438))
Try that
You are missing some ")"...

Correct version:

Code:
if(!strcmp("/buy",cmdtext))
{
	if(IsPlayerInRangeOfPoint(playerid, 7.0, 2695.6880, -1704.6300, 11.8438) || IsPlayerInRangeOfPoint(playerid, 7.0, 1695.5674, -5434.6300, 44.8438) || IsPlayerInRangeOfPoint(playerid, 7.0, 3455.6880, -2345.6300, 523.8438))
	{
			"Open buymenu"
  	}
  	else return SendClientMessage(playerid,0xFFFFFFFF,"You are not near a buy point!");
  	return 1;
}
(Intendations are made using space...)
I know i missed ) because with his code/you code it dosent work.


Re: Multiply IsPlayerInRangeOfPoint - Finn - 24.06.2010

pawn Code:
if(!strcmp("/buy",cmdtext))
{
  if( IsPlayerInRangeOfPoint(playerid, 7.0, 2695.6880, -1704.6300, 11.8438) ||
    IsPlayerInRangeOfPoint(playerid, 7.0, 1695.5674, -5434.6300, 44.8438) ||
    IsPlayerInRangeOfPoint(playerid, 7.0, 3455.6880, -2345.6300, 523.8438))
  {
    "Open buymenu"

    return 1;
  }

  return SendClientMessage(playerid, 0xFFFFFFFF, "You are not near a buy point!");
}
You don't need to have them all in a row if you don't like the width of the code line.

Not that any of the posts above wouldn't work or if this method would be faster and/or better, just wanted to throw this in.