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



Safe zone. - budelis - 02.11.2011

Hi all.I want ask with one thing. I try do safe zone,i use GangZoneCreate all is well,but i want ask,do i need set timer every second check if player in that zone? or maybe can do it simplier


Re: Safe zone. - AndreT - 02.11.2011

You could use Incognito's streamer plugin for zones, it allows you to create zones in many different shapes. Check it out from the plugins board.


Re: Safe zone. - AeroBlast - 02.11.2011

https://sampwiki.blast.hk/wiki/Areacheck


Re: Safe zone. - budelis - 02.11.2011

Yes,but if i with textdraw make that "Safe Zone" then if player is in that zone every second it will update to me or simplier i do with message and too,i get that message every 1 sec.


Re: Safe zone. - budelis - 03.11.2011

AeroBlast i try your page what you give me but it still don't work here is my code:

Код:
OnGameModeInit:

SetTimer("isPlayerInArea", 1000, true);
Then after all my gm:

Код:
forward isPlayerInArea();
public isPlayerInArea()
{
new Float:X, Float:Y, Float:Z; //We use this to store player position
for(new i=0; i < MAX_PLAYERS; i++) //This line defines a name for all player, the name is "i"
{
print("Hello");
GetPlayerPos(i, X, Y, Z);
if (X <= -55.0116 && X >= 35.5120 && Y <= 1208.9111 && Y >= 1239.7379)         
{
print("Hello2");
SetPlayerHealth(i,5000);
}
}
}
Ok why i use print? I use print because i want check ok,first print is work,but second is doesn't work then i think with this is bad:

Код:
if (X <= -55.0116 && X >= 35.5120 && Y <= 1208.9111 && Y >= 1239.7379)         
{
And too here is my four coord:

Код:
AddPlayerClass(20,-54.9971,1208.9401,19.3594,125.6477,0,0,0,0,0,0); // 1 Hotel corner
AddPlayerClass(20,-55.0116,1238.0369,19.3594,47.6675,0,0,0,0,0,0); // 2 Hotel corner
AddPlayerClass(20,32.5096,1239.7379,19.3438,309.7458,0,0,0,0,0,0); // 3 Hotel corner
AddPlayerClass(20,35.5120,1208.9111,19.0166,222.5389,0,0,0,0,0,0); // 4 Hotel corner
But when i want do gang zone it's work fine...


Re: Safe zone. - $India$ - 03.11.2011

instead of timer
you can put it OnPlayerUpdate
Right?


Re: Safe zone. - AndreT - 03.11.2011

No. Putting the checks in OnPlayerUpdate is a very very bad idea. It is called way too often for all players. Use a timer instead.


Re: Safe zone. - budelis - 03.11.2011

any help?


Re: Safe zone. - BaubaS - 03.11.2011

I bet, the problem is in coordinates. Use iPLEOMAX gangzone creator, it will give 100% correct coordinates.


Re: Safe zone. - budelis - 03.11.2011

I think in coord is good,because how i say with that coordinates i do gang zone and all works fine,but check if player in that zone it i can't do. I don't know maybe method is bad of my coord or something else.