SA-MP Forums Archive
Getting minx/miny/maxx/maxy - 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: Getting minx/miny/maxx/maxy (/showthread.php?tid=604778)



Getting minx/miny/maxx/maxy - HuntingMan - 09.04.2016

Title says all ^^

How to get it with providing examples please


Re: Getting minx/miny/maxx/maxy - Aliassassin123456 - 09.04.2016

MinX, MinY, MaxX or MaxY of what?


Re: Getting minx/miny/maxx/maxy - HuntingMan - 09.04.2016

of my location..


Re: Getting minx/miny/maxx/maxy - Aliassassin123456 - 09.04.2016

Your location? You have a position on the map, am i missing something?


Re: Getting minx/miny/maxx/maxy - HuntingMan - 09.04.2016

i mean like i have the checkpoint system contains
new Float:checkCoords[MAX_POINTS][4] = {
This is what im talking about.. the minx miny maxx maxy
Ex: {1691.5800, -1120.7292, 1711.5800, -1100.7292}, // ATM (How to get this 4 points (minx, miny, maxx, maxy))
new Float:checkpoints[MAX_POINTS][4] = {

and this is x/y/z normally..

Ex: {1701.5800,-1110.7292,24.0781,1.5}, // ATM


Re: Getting minx/miny/maxx/maxy - OmegaKiller72 - 09.04.2016

use https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint


Re: Getting minx/miny/maxx/maxy - Aliassassin123456 - 09.04.2016

This is you specify the MinX, MinY, MaxX and MaxY. If you want to check a position is in your area with MinX, ... like a player's position you must use following:

Код:
IsInArea(Float:X, Float:Y, Float:MinX, Float:MinY, Float:MaxX, Float:MaxY)
{
    if (X > MinX, && X < MaxX && Y > MinY && Y < MaxY) return 1;
    return 0;
}
Example of checking a player is in specified area or not:
Код:
new Float:exampleArea[4] = {1691.5800, -1120.7292, 1711.5800, -1100.7292};
new Float:Pos[3];

GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
if (IsInArea(Pos[0], Pos[1], exampleArea[0], exampleArea[1], exampleArea[2], exampleArea[3])) SendClientMessage(playerid, -1, "You're in area.");
else SendClientMessage(playerid, -1, "You aren't in area.");



Re: Getting minx/miny/maxx/maxy - NaS - 10.04.2016

To get the actual coordinates you have to /save two points, the lower left corner of the area (minx & miny) and the upper right one (maxx & maxy).

Then use the X/Y coords of each save like said above.


Re: Getting minx/miny/maxx/maxy - HuntingMan - 10.04.2016

Quote:
Originally Posted by OmegaKiller72
Посмотреть сообщение
Quote:
Originally Posted by Aliassassin123456
Посмотреть сообщение
This is you specify the MinX, MinY, MaxX and MaxY. If you want to check a position is in your area with MinX, ... like a player's position you must use following:

Код:
IsInArea(Float:X, Float:Y, Float:MinX, Float:MinY, Float:MaxX, Float:MaxY)
{
    if (X > MinX, && X < MaxX && Y > MinY && Y < MaxY) return 1;
    return 0;
}
Example of checking a player is in specified area or not:
Код:
new Float:exampleArea[4] = {1691.5800, -1120.7292, 1711.5800, -1100.7292};
new Float:Pos[3];

GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
if (IsInArea(Pos[0], Pos[1], exampleArea[0], exampleArea[1], exampleArea[2], exampleArea[3])) SendClientMessage(playerid, -1, "You're in area.");
else SendClientMessage(playerid, -1, "You aren't in area.");
Guys, i don't want "If im in range" i just want when i type a command it SendClientMessage me the minx miny maxx maxy

easy to make a command, but what code that gives me this coords??


Re: Getting minx/miny/maxx/maxy - Sew_Sumi - 10.04.2016

Getting minx/miny/maxx/maxy of _what_ though?


Player positions are based on x,y,z... not minx miny maxx maxy...