Question !!! [ REP ++ ]
#1

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

Quote:
Originally Posted by buburuzu19
Посмотреть сообщение
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.
use IsPlayerInArea
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;
}
this is how you gather the coordinates:
Код:
miny-----------------maxy
|			|
|			|
|			|
|			|
|			|
|			|
minx-----------------maxx
you could also use GangZoneCreate with the coordinates you gathered
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
Reply
#3

And how to use it ? like public function? or to add if(IsPlayerInArea(playerid, Float:minx, Float:maxx, Float:miny, Float:maxy)) at on gamemodeinit ?
Reply
#4

I mean i want to detect if player enters the specified area. And when he enters to block damage and show SAFEZOne. I Know how to block damage but i don't know how to make it detect when player enters the area with safe zone.
Reply
#5

You can use streamer plugin
It has a function that you can make an area
That if a player enter that area "OnPlayerEnterDynamicArea" will call !
With this plugin you don't need to make timer and….
If you don't want to use streamer
Just set a timer and use isplayerinarea function in loop
If someone was in area block damage…
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)