SA-MP Forums Archive
Plants in 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: Plants in zone (/showthread.php?tid=538254)



Plants in zone - ShoortyFl - 20.09.2014

So what i'm trying to do is, if player is not in the zone he can't plant weed and if he is in it he can.
Here's the polygon that i've created, now can someone please tell me how to make something that will check if he is in that polygon

http://pastebin.com/mgpZBjbN


Re: Plants in zone - ShoortyFl - 20.09.2014

anyone ?


Re: Plants in zone - Marricio - 20.09.2014

Use Incognito Streamer, the areas are very effective.


Re: Plants in zone - ShoortyFl - 20.09.2014

Yeah but how to select area to make it usable ?


Re: Plants in zone - MicroD - 20.09.2014

Код:
IsPlayerInDynamicArea(playerid, areaid, recheck = 0);



Re: Plants in zone - ShoortyFl - 20.09.2014

Yeah but there is no id of my area thats why i created the polygon around the place i want to be the area.


Re: Plants in zone - MicroD - 20.09.2014

In weed command you put this check:
Код:
if(IsPlayerInDynamicArea(playerid, zones[0]))
{
//DoStuff
}



Re: Plants in zone - ShoortyFl - 22.09.2014

So this is how i've done it and it's not working, it's saying Not in the zone !

pawn Код:
poligonzone[0] = CreateDynamicPolygon(gsfzona1);
poligonzone[1] = CreateDynamicPolygon(gsfzona2);
pawn Код:
new Float:gsfzona1[] = {
        -1103.0,-914.0,-1163.0,-914.0,-1192.0,-933.0,-1198.0,-979.0,-1171.0,-996.0,-1098.0,-999.0,-1099.0,-1031.0,-1068.0,-1059.0,-1069.0,-938.0,-1103.0,-914.0
};
new Float:gsfzona2[] = {
        -1034.0,-1060.0,-1034.0,-1033.0,-1067.0,-1000.0,-1068.0,-1058.0,-1034.0,-1060.0
};
pawn Код:
if(!IsPlayerInDynamicArea(playerid, poligonzone[0]) || !IsPlayerInDynamicArea(playerid, poligonzone[1])) return SCM(playerid, GREY, "* Not in the zone  !");



Re: Plants in zone - amirab - 22.09.2014

use your zone , i don't know it's gang zone or something esle but there's a function that we call it
IsPlayerInArea
this is the function :
PHP код:
stock IsPlayerInArea(playeridFloat:MinXFloat:MinYFloat:MaxXFloat:MaxY)
{
    new 
Float:XFloat:YFloat:Z;
    
GetPlayerPos(playeridXYZ);
    if(
>= MinX && <= MaxX && >= MinY && <= MaxY) {
        return 
1;
    }
    return 
0;




Re: Plants in zone - ShoortyFl - 22.09.2014

Yeah, but how to use my polygon zones with IsPlayerInArea function ?


Re: Plants in zone - ShoortyFl - 22.09.2014

anyone ?


Re: Plants in zone - ShoortyFl - 23.09.2014

anyone


Re: Plants in zone - ShoortyFl - 28.09.2014

?/