09.04.2016, 22:12
Title says all ^^
How to get it with providing examples please
How to get it with providing examples please
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; }
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.");
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; } Код:
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."); |