SA-MP Forums Archive
how i get x x y y - 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: how i get x x y y (/showthread.php?tid=145037)



how i get x x y y - oOhossamOo - 30.04.2010

hi
i edit script its for gates i add new gate but it require get x x y y
example:
new Float, Float:y, Float:z;
GetPlayerPos(i, x, y, z);
if(x >= -1665.449218 && x <= -1601.449218 && y >= 658.321044 && y <= 706.321044)


Re: how i get x x y y - -Rebel Son- - 30.04.2010

Wait, your creating Gates on the player?


Re: how i get x x y y - oOhossamOo - 30.04.2010

Quote:
Originally Posted by [N
BL!nk ]
Wait, your creating Gates on the player?
full example

Код:
public Sfpdgateopen()
{
  for (new i = 0; i < MAX_PLAYERS; i++)
  {
		if(IsPlayerConnected(i) && IsSpawned[i] == 1)
		{
     new Float:x, Float:y, Float:z;
	   GetPlayerPos(i, x, y, z);
     if(x >= -1665.449218 && x <= -1601.449218 && y >= 658.321044 && y <= 706.321044)
     {
		 if(gTeam[i] == TEAM_COP || gTeam[i] == TEAM_ARMY || PlayerAdminLevel[i] == 1337)
		 {
		 if(GateWestern == 0) // closed
		 {
      MoveObject(sfpdgate1, 2294.1990,2510.2039,4.2959, 2);
      GateWestern =1; // open
      SetTimer("WesternCopGateClose",5000,0);
      	//if(isPlayerInArea(i, 2363.7737, -1135.5779, 2366.7964, -1125.8202))
		 }
		 }
		}
	 }
	}
 }
public Sfpdgateclose()
{
    if(GateWestern == 1) // open
	  {
      MoveObject(sfpdgate1, 2294.1990,2500.2039,4.2959, 2);
      GateWestern =0; // closed
      //if(isPlayerInArea(i, 2363.7737, -1135.5779, 2366.7964, -1125.8202))
    }
   }



Re: how i get x x y y - Victor - 30.04.2010

You could do
if(IsPlayerInRangeOfPoint(i, 3, x, y, z))
rather then what you have
X, Y, Z being the coords of the gate.
You can change 3 to how far away the player can be before it opens.