SA-MP Forums Archive
Streamer - Check if area exists (by cords (minx, miny, maxx, maxy), not by areaID - 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: Streamer - Check if area exists (by cords (minx, miny, maxx, maxy), not by areaID (/showthread.php?tid=595837)



Streamer - Check if area exists (by cords (minx, miny, maxx, maxy), not by areaID - Riwerry - 08.12.2015

Hello, I have script that gets min and max XY to variables and then I create area with CreateDynamicRectangle streamer function. And I want to make condition if player create new area, coords will get stored to my variables minx, miny, maxx, maxy and I want to check if the NEW area isn't located in existing area. It's hard for me to explain, thanks.


Re: Streamer - Check if area exists (by cords (minx, miny, maxx, maxy), not by areaID - AbyssMorgan - 08.12.2015

PHP код:
stock IsPointInArea(Float:x,Float:y,Float:z,Float:minx,Float:miny,Float:minz,Float:maxx,Float:maxy,Float:maxz){
    if((
>= minx && <= maxx) && (>= miny && <= maxy) && (>= minz && <= maxz)) return true;
    return 
false;
}
stock IsPointInAreaEx(Float:x,Float:y,Float:z,Float:minx,Float:miny,Float:minz,Float:maxx,Float:maxy,Float:maxz,vw1 = -1,int1 = -1,vw2 = -1,int2 = -1){
    if((
>= minx && <= maxx) && (>= miny && <= maxy) && (>= minz && <= maxz) && (vw1 == vw2) && (int1 == int2)) return true;
    return 
false;

Do you want to check area A is in area B?


Re: Streamer - Check if area exists (by cords (minx, miny, maxx, maxy), not by areaID - Riwerry - 08.12.2015

Uh, for example I have created area A, and if player creates new area B in area A then he will get returned.


Re: Streamer - Check if area exists (by cords (minx, miny, maxx, maxy), not by areaID - Vince - 08.12.2015

Can't you just use IsPlayerInAnyDynamicArea or IsPointInAnyDynamicArea?


Re: Streamer - Check if area exists (by cords (minx, miny, maxx, maxy), not by areaID - Riwerry - 08.12.2015

Yeah but player still can create area outside of the existing area and make it bounds through this area.




Re: Streamer - Check if area exists (by cords (minx, miny, maxx, maxy), not by areaID - Pottus - 09.12.2015

Pretty easy to figure out.
http://stackoverflow.com/questions/3...lap-each-other