SA-MP Forums Archive
IsPlayerInArea ?! - 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: IsPlayerInArea ?! (/showthread.php?tid=74689)



IsPlayerInArea ?! - Trooper[Y] - 25.04.2009

I want to check if a player is in a specific Area....
With browsing the wiki,i found
Код:
GetPlayerPos(i, X, Y, Z); //Here we are storing the player position on the variables X, Y, and Z defined previously
      if (X <= -3915 && X >= -3694 && Y <= 401 && Y >= 37)
Now i want to search , if a Player is in an area, but the area is defined with variables.

So the variables are declared ...:
Код:
  new Float:X,Float:Y,Float:Z;
	GetPlayerPos(killerid,X,Y,Z);
	oldxx = oldx - distance;
	oldx2 = oldx + distance;
	oldyy = oldy + distance;
	oldy2 = oldy - distance;
	print("Distanz");
	printf("%i",distance); //Distance
	print("oldxx");
	printf("%f",oldxx); //down
	print("oldx2");
	printf("%f",oldx2); //top
	print("oldyy");
	printf("%f",oldyy); //left
	print("oldy2");
	printf("%f",oldy2); //right
	print("X");
  printf("%f",X); //actual x position
  print("Y");
  printf("%f",Y); //actual y position
  
	if(X >= oldxx && X <= oldx2 && Y >= oldyy && Y <= oldy2)
You can see the last condition?
Heres the log:
Quote:

[12:06:27] Incomming connection: 192.168.2.100:2028
[12:06:27] [join] Trooper[Y] has joined the server (0:192.168.2.100)
[12:06:49] Distanz
[12:06:49] 500
[12:06:49] oldxx
[12:06:49] -615.161743
[12:06:49] oldx2
[12:06:49] 384.838256
[12:06:49] oldyy
[12:06:49] 2529.385253
[12:06:49] oldy2
[12:06:49] 1529.385253
[12:06:49] X
[12:06:49] 317.487945
[12:06:49] Y
[12:06:49] 2526.640625
[12:06:54] [part] Trooper[Y] has left the server (0:1)

And can you know tell my,why nothing had happened ?
From my Point of view, the condition have to be right !
I cant understand why the condition isn`t true....

Hope on your answer,
Trooper


Re: IsPlayerInArea ?! - MenaceX^ - 25.04.2009

It just doesn't get called, that's why it doesn't print it.


Re: IsPlayerInArea ?! - Trooper[Y] - 25.04.2009

Quote:

It just doesn't get called,

How do you exactly man it?
Can u give an example ?

I call it with
Код:
SetTimerEx("checkregion",10000,0,"iffi",killerid,X-500,Y-500,500);