Is Player In Gang Zone
#1

Hello guys I have got function to check Is Player Is between two points (x,y - x,y), but it doesn't works.
Here is the function:
Quote:

forward IsPlayerInGangZone(playerid, Float:min_x, Float:min_y, Float:max_x, Float:max_y);
public IsPlayerInGangZone(playerid,Float:min_x,Float:min_ y,Float:max_x,Float:max_y)
{
new Float:X1,Float:Y1,Float:Z1;
GetPlayerPos(playerid, X1, Y1, Z1);
if((X1 <= max_x && X1 >= min_x) && (Y1 <= max_y && Y1 >= min_y)) return 1;
return 0;
}

And here is how I'm checking it (using CMD):
Quote:

if(IsPlayerInGangZone(playerid, 2539.976074,-1629.067382, 2504.410400,-1667.414062)) return SendClientMessage(playerid,COLOR_RED,"I'm here");

Reply
#2

Try this:
PHP код:
public IsPlayerInGangZone(playeridFloat:min_xFloat:min_ yFloat:max_xFloat:max_y)
{
    new 
Float:X1Float:Y1Float:Z1;
    
GetPlayerPos(playeridX1Y1Z1);
    if(
X1 min_x && X1 max_x && Y1 min_y && Y1 max_y) return 1;
    return 
0;

Reply
#3

if(X1 > min_x && X1 < max_x && Y1 > min_[look here] && Y1 < max_y)
Reply
#4

My bad, edited.

--

By the way, I recommend you to use Dynamic areas by Streamer plugin for gang zones, It's more easier and faster.
Reply
#5

Again it doesn't works
Reply
#6

In my another server it works my version works perfect, but I created a new one and it doesn't works. Please, help me!
Reply
#7

I suggest you to use CreateDynamicArea! of Streamer plugin and to check if player is in gangone just simply use IsPlayerInDynamicArea. Additional There is OnPlayerEnterDynamicArea and OnPlayerExitDynamicArea.
Reply
#8

I'm creating in-game gangzone creation, so I'm trying to set the gang zone color with using this function. I don't think it will works if I use IsPlayerInDynamicArea! So I tried using IsPlayerInArea, but it says "Undefined symbol IsPlayerInDynamicArea"
Reply
#9

Quote:
Originally Posted by Kraeror
Посмотреть сообщение
I'm creating in-game gangzone creation, so I'm trying to set the gang zone color with using this function. I don't think it will works if I use IsPlayerInDynamicArea! So I tried using IsPlayerInArea, but it says "Undefined symbol IsPlayerInDynamicArea"
You're not doing well then. I actually use Streamer Plugin of Incognito which is very usefull. I made my own dynamic turf/gang system with the help of this plugin the key for this is
Код:
CreateDynamicRectangle(Float:minx, Float:miny, Float:maxx, Float:maxy, worldid = -1, interiorid = -1, playerid = -1)
then
Код:
IsPlayerInDynamicArea(playerid, areaid, recheck = 0)
Reply
#10

Thank you ToiletDuck, I will try it!
+1 REP and again THANKS!

EDITED: IT DOESN'T WORKS, LOOK AT THE NEXT PAGE!
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)