31.03.2016, 09:19
Hi!
There are more then only one way because you can use two functions.
1. function - IsPlayerInRangeOfPoint:
IsPlayerInRangeOfPoint is a function which you can use to get the distance between a player and a certain point.
The range which is a parameter in that function is circular from the point.
2. function - IsPlayerInArea:
IsPlayerInArea is a function which you can use to get wheather a player is in a certain "area". This area isn't circular but it's square.
So, I think for your intention it is a good way to use IsPlayerInArea.
This is the function you need. You apply this function in the callback OnPlayerTakeDamage or OnPlayerGiveDamage. It's yours decision.
Try this and feel free to ask if you need help. Good luck!
There are more then only one way because you can use two functions.
1. function - IsPlayerInRangeOfPoint:
IsPlayerInRangeOfPoint is a function which you can use to get the distance between a player and a certain point.
The range which is a parameter in that function is circular from the point.
2. function - IsPlayerInArea:
IsPlayerInArea is a function which you can use to get wheather a player is in a certain "area". This area isn't circular but it's square.
So, I think for your intention it is a good way to use IsPlayerInArea.
PHP код:
IsPlayerInArea(playerid,Float:MinX,Float:MinY,Float:MaxX,Float:MaxY)
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,X,Y,Z);
return (X>=MinX && X<= MaxX && Y=>MinY && Y<=MaxY) ? 1 : 0;
}
Try this and feel free to ask if you need help. Good luck!