IsPlayerInZone or near by zone
#1

Hi guys,

On my server I have gang zones,and I have function IsPlayerInZone,and it check is player in certain zone.Now,i want to make function which will check Is Player In Zone or near by zone(20m for example)

Function IsPlayerInZone

Код:
IsPlayerInZone(playerid, zoneid)
{
	new Float:x, Float:y, Float:z;
	GetPlayerPos(playerid, x, y, z);
	return (x > GZ[zoneid][mX] && x < GZ[zoneid][vX] && y > GZ[zoneid][mY] && y < GZ[zoneid][vY]);
}
Quote:

mx = minX
mY = minY
vX = maxX
vY = maxY

It will work only if player is IN zone,so I want to make new function so that I can check is player in zone or near by it zone..I hope you can understand me.
Reply
#2

By near your mean on (outside) the gang zone ?
Reply
#3

Yes.I think on outside gang zone,but near it.

For example:


Green is real gang zone.(Red zone is just example)

With function IsPlayerInZone I can check,is player in Green Zone.But I want to make new function so that I can check is player in zone(green) or near by zone(red color on picture(Example)).


My player abuse some commands,So I want to make check where they can use it.I want to make that they can't use some commands on GangZone or near by GangZone.Thank you
Reply
#4

Add every minx and miny by -20 and add every maxx and maxy by 20

If "20" will be a parameter variable, surround it by floatabs function before adding it, so any min and max values wont go wrong (e.g -100 for maxx)

Then to find only red area, use combination of two functions to check if the player is near zone and not in the zone
But its better to make it a single function for such case to prevent double calculation

Sorry, posting from phone
Reply
#5

use streamer dynamic zones
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)