how i get x x y y
#1

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)
Reply
#2

Wait, your creating Gates on the player?
Reply
#3

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))
    }
   }
Reply
#4

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.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)