Getting minx/miny/maxx/maxy
#1

Title says all ^^

How to get it with providing examples please
Reply
#2

MinX, MinY, MaxX or MaxY of what?
Reply
#3

of my location..
Reply
#4

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

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
Reply
#6

use https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint
Reply
#7

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.");
Reply
#8

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.
Reply
#9

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??
Reply
#10

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


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


Forum Jump:


Users browsing this thread: 1 Guest(s)