SA-MP Forums Archive
Is Player In Gang 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: Is Player In Gang Zone (/showthread.php?tid=641895)



Is Player In Gang Zone - Kraeror - 22.09.2017

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");




Re: Is Player In Gang Zone - oMa37 - 22.09.2017

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;




Re: Is Player In Gang Zone - Kraeror - 22.09.2017

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


Re: Is Player In Gang Zone - oMa37 - 22.09.2017

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.


Re: Is Player In Gang Zone - Kraeror - 22.09.2017

Again it doesn't works


Re: Is Player In Gang Zone - Kraeror - 22.09.2017

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


Re: Is Player In Gang Zone - ToiletDuck - 22.09.2017

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.


Re: Is Player In Gang Zone - Kraeror - 22.09.2017

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"


Re: Is Player In Gang Zone - ToiletDuck - 22.09.2017

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)



Re: Is Player In Gang Zone - Kraeror - 22.09.2017

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

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