SA-MP Forums Archive
Area Check - 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)
+--- Thread: Area Check (/showthread.php?tid=574845)



Area Check - StR_MaRy - 21.05.2015

Код HTML:
hi guys i wanted to do an Area Check to kill or respawn a player and i did this model

#include <a_samp>

#define COLOR_RED 0xFF0000C8

forward isPlayerInArea();

public OnGameModeInit()
{
    SetTimer("isPlayerInArea", 1000, 1);
	return 1;
}

public isPlayerInArea()
{
	new Float:X, Float:Y, Float:Z;
	for(new i=0; i < MAX_PLAYERS; i++)
	{
		GetPlayerPos(i, X, Y, Z);
		if (X <= 1856 && X >= -1464 && Y >= 1981 && Y <= -1349)
		{
			SpawnPlayer(i);
                        SetPlayerHealth(i, 0);
			SendClientMessage(i, COLOR_RED, "{FF0000}[Oras Inchis]: {FFFFFF}Salut, ne cerem scuze dar nu poti intra in acest Oras.");
			SendClientMessage(i, COLOR_RED, "{FF0000}[Oras Inchis]: {FFFFFF}Te rugam nu mai incerca sa te intorci pana nu faci level 5.");
		}
	}
} 
in a filterscript can some1 help me why is not working ? wont respawn or kill me SetPlayerHealth(i, 0);



Re: Area Check - Gammix - 21.05.2015

pawn Код:
if (X <= 1856.0 && X >= -1464.0 && Y <= 1981.0 && Y >= -1349.0)
You had wrong indicators (or whatever you call them) incase of Y Coordinates. The scheme behind checking is like this:
minx < player_x &&
maxx > player_x &&
miny < player_y &&
maxy > player_y


Re: Area Check - StR_MaRy - 21.05.2015

fixed , thx Gammix