Area Check
#1

Код 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);
Reply
#2

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
Reply
#3

fixed , thx Gammix
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)