If player leaves the area - 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 leaves the area (
/showthread.php?tid=246380)
If player leaves the area -
The Woody - 04.04.2011
Im trying to make so when a player leaves the area stuff will happend. But i have no idea how to make that.
Ive tryed with "!IsPlayerInRangeOfPoint" but that didnt really work because i need it to do stuff in the
second he leaves the area.
If you dont understand what im asking for. Maybe this will help you a little:
pawn Code:
if (//he leaves the area??)
{
SendClientMessage(playerid, GREY, "blalala..");
}
Re: If player leaves the area -
Backwardsman97 - 04.04.2011
You would need a timer to repeatedly check if he has left or not. You could use IsPlayerInRangeOfPoint if you're talking about a circular area or your own way if you wanted a square area.
Re: If player leaves the area -
The Woody - 04.04.2011
Quote:
Originally Posted by Backwardsman97
You would need a timer to repeatedly check if he has left or not. You could use IsPlayerInRangeOfPoint if you're talking about a circular area or your own way if you wanted a square area.
|
Its just a little area, it isnt bigger than a pickup. But how would i update that timer to see if hes in the area?.
Re: If player leaves the area -
Ricop522 - 04.04.2011
Use:
pawn Code:
stock IsPlayerInArea(playerid, Float:xmin, Float:ymin, Float:xmax, Float:ymax)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if(x >= xmin && y >= ymin && x <= xmax && y <= ymax) return true;
return false;
}
Re: If player leaves the area -
The Woody - 04.04.2011
Quote:
Originally Posted by Ricop522
Use:
pawn Code:
stock IsPlayerInArea(playerid, Float:xmin, Float:ymin, Float:xmax, Float:ymax) { new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); if(x >= xmin && y >= ymin && x <= xmax && y <= ymax) return true; return false; }
|
Im going with IsPlayerInRangeOfPoint since its just this one little circual. All i need to know is how i could update
the timer every second or so.
Re: If player leaves the area -
Kwarde - 13.04.2011
Take a look at this:
https://sampforum.blast.hk/showthread.php?tid=229423
Re: If player leaves the area -
Cameltoe - 13.04.2011
Quote:
Originally Posted by The Woody
Im going with IsPlayerInRangeOfPoint since its just this one little circual. All i need to know is how i could update
the timer every second or so.
|
I would recommend IsPlayerInRange, as it checks the z axis also.