SA-MP Forums Archive
If player in zone. - 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: If player in zone. (/showthread.php?tid=68441)



If player in zone. - xbatista - 10.03.2009

How to detect if player in this zone:
new US;

US = GangZoneCreate(93.423, 1763.359, 350.3363, 2066.984);

And increase his health SetPlayerHealth(playeris, GetPlayerHealth(playerid) -5.0) by - 5 for 1 second?


Re: If player in zone. - lesley - 10.03.2009

Use a timer. and the wiki please.


Re: If player in zone. - Rks25 - 10.03.2009

IsPlayerInArea(minX,minY,maxX,maxY);


Re: If player in zone. - xbatista - 10.03.2009

IsPlayerInArea(minX,minY,maxX,maxY);
Thanks found stock.

And where I must use this exactly?IsPLayerInArea?

In what forward? :/


Re: If player in zone. - Rks25 - 10.03.2009

make a new function attached to a timer.


Re: If player in zone. - xbatista - 10.03.2009

Код:
forward AreaCheck(playerid)

SetTimer("AreaCheck", 3000, 1);

public AreaCheck(playerid)
{
	new Float:h;
	for(new i=0; i<MAX_PLAYERS; i++ )
	{
	  if(!IsPlayerConnected(i)) continue;
		if(IsPlayerInArea(i,2989.536, -2989.536, 502.1487,-2942.825) && IsPlayerAlive[i])
		{
			SetPlayerHealth(i, 0.0);
			SendClientMessage(i, COLOR_RED, "Danger Zone!");
			//Add timer for god here
		}
 		if(IsPlayerInArea(i, -1331.278, -3001.214, 1634.903, 443.7593) && IsPlayerAlive[i])
		{
			SetPlayerHealth(i, GetPlayerHealth(i, h) -1.0);
			SendClientMessage(i, COLOR_RED, "Danger Zone!");
			//Add timer for god here
		}
	}
}
Something like this?

Why when I spawn I'm dying!!!!!!!!!!?
And I'm not in death zone ((
Zone is good created,all coordinates good, but why when I spawn I die? After choosen class I'm die And one time when connected.


Re: If player in zone. - Rks25 - 10.03.2009

u using correct coords at isplayerinarea?


Re: If player in zone. - xbatista - 10.03.2009

Problem solved by MYSELF...
SetTimer must be in OnPlayerSpawn....


Re: If player in zone. - Rks25 - 10.03.2009

why using (playerid) and a loop?


Re: If player in zone. - xbatista - 11.03.2009

About player id,i've deleted it and LOOP? What is this?