09.12.2014, 07:17
Quote:
I am wondering how to make a safe zone.. i am thinking to use IsPlayerInRangeOfPoint and OnplayerGiveDamage but where to add to check if player enters / or is in the range of point x,y,z,range ?
I also want to add a textdraw which says "SAFE ZONE" when player enters the range. |
pawn Код:
/**
* IsPlayerInArea(...)
* ------------------------------------------
* @params: (Float) minx , maxx , miny , maxy
* Usage: if(IsPlayerInArea(...))...
* ------------------------------------------
* This function returns 1 if said playerid
* is inside the specified area.
* Returns 0 if not.
*/
IsPlayerInArea(playerid, Float:minx, Float:maxx, Float:miny, Float:maxy)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if (x > minx && x < maxx && y > miny && y < maxy) return 1;
return 0;
}
Код:
miny-----------------maxy | | | | | | | | | | | | minx-----------------maxx
to make it visible on the map, if you want to.
Note that if you only create it with GangZoneCreate, its only there but not visible as said in the wiki.
Use GangZoneShowForAll/Player afterwards.
asfor the textdraws, i suggest you create them using Zamaroht's Textdraw editor,
improved by Southclaw: "to include support for Player Textdraws".
i didn't find Zamaroht's original post on the forums (if it still exists)
but you can get the one i just mentioned here