gArea - Areasystem for adminzones/others ! (Using IsPlayerInArea AND IsPlayerInRangeOfPoint!!!) -
gamer931215 - 03.06.2011
gArea 1.1
What is it ?
gArea is a include that allows you to create easily admin areas, you can just use the functions to create an area, and it will use a callback when a player entered it!
Functions
pawn Код:
CreateArea(Float:x,Float:y,Float:range) //create an area and scan in a circle inside the range
CreateAreaEx(Float:minx,Float:miny,Float:maxx,Float:maxy) //create an area and scan in a square with min x,min y and max x,and max y
ToggleArea(areaid,bool:toggle)//turn area on/off
Callbacks
pawn Код:
OnPlayerEnterArea(playerid,areaid) //will be called if a player is in the area
OnPlayerLeaveArea(playerid,areaid) //will be called if a player left the area
Defines
Please note that these defines needs to be called BEFORE including (so you have to put these ABOVE the include <gArea> part)
pawn Код:
MAX_AREAS //keep this as low as possible (default = 10)
TIMER_TICKRATE //timer in miliseconds (dont go under the 500 ms for to keep the best performance, default = 1000))
FILTERSCRIPT //define this ONLY when you are using the include inside a filterscript
Example filterscript
pawn Код:
#include <a_samp>
//do this ALWAYS to keep the loops as small as possible (increase performance):
#undef MAX_PLAYERS
#define MAX_PLAYERS 32 //adjust this to the ammount of your serverslots
//defining some settings before including gArea
#define MAX_AREAS 2
#define FILTERSCRIPT
//including gArea
#include <gArea>
public OnFilterScriptInit()
{
CreateAreaEx(2044.6,1867.797,2114.887,1968.367); //making an square area
CreateArea(0,0,10); //making a circle area taking x=0,y=0 as center
return 1;
}
public OnPlayerEnterArea(playerid,areaid) //this will be called once a player entered the area
{
new string[128];format(string,sizeof string,"playerid %i has entered zoneid %i",playerid,areaid);
SendClientMessageToAll(0xffffff,string);
return 1;
}
public OnPlayerLeaveArea(playerid,areaid) //this will be called once a player left the area
{
new string[128];format(string,sizeof string,"playerid %i has left zoneid %i",playerid,areaid);
SendClientMessageToAll(0xffffff,string);
return 1;
}
Changelog
Код:
1.0:
Released
1.1:
callback OnPlayerEnterArea will now only be called once if the player entered
callback OnPlayerLeaveArea added (thanks Donya for the idea!)
Download
Pastebin
Re: gArea - Areasystem for adminzones/others ! (Using IsPlayerInArea AND IsPlayerInRangeOfPoint!!!) -
Meinstad - 03.06.2011
Wow! Good release! 8/10
Testing now!
Re: gArea - Areasystem for adminzones/others ! (Using IsPlayerInArea AND IsPlayerInRangeOfPoint!!!) -
Donya - 03.06.2011
nice, 9/10, what about onplayerleavearea? that might be nice :P
Re: gArea - Areasystem for adminzones/others ! (Using IsPlayerInArea AND IsPlayerInRangeOfPoint!!!) -
juraska - 03.06.2011
Good job and NICELY DONE.
Re: gArea - Areasystem for adminzones/others ! (Using IsPlayerInArea AND IsPlayerInRangeOfPoint!!!) -
gamer931215 - 03.06.2011
Quote:
Originally Posted by Donya
nice, 9/10, what about onplayerleavearea? that might be nice :P
|
Thanks for the idea, this has now been added
Re: gArea - Areasystem for adminzones/others ! (Using IsPlayerInArea AND IsPlayerInRangeOfPoint!!!) -
Swiftz - 03.06.2011
I think this would be lagging ? Correct me if im wrong , I havent actually lukd on to the script
Re: gArea - Areasystem for adminzones/others ! (Using IsPlayerInArea AND IsPlayerInRangeOfPoint!!!) -
Michael@Belgium - 03.06.2011
Whoh
![Tongue](images/smilies/razz.gif)
Nice script gamer931215
![Wink](images/smilies/wink.png)
You're making awesome scripts at the moment
Re: gArea - Areasystem for adminzones/others ! (Using IsPlayerInArea AND IsPlayerInRangeOfPoint!!!) -
gamer931215 - 03.06.2011
Quote:
Originally Posted by Swiftz
I think this would be lagging ? Correct me if im wrong , I havent actually lukd on to the script
|
Thats why people should use:
pawn Код:
#if defined MAX_PLAYERS
#undef MAX_PLAYERS
#define MAX_PLAYERS 32 //adjust this to the ammount of your serverslots
#endif
to keep the loops as small as possible ^^
And for the others, thx
Re: gArea - Areasystem for adminzones/others ! (Using IsPlayerInArea AND IsPlayerInRangeOfPoint!!!) -
Donya - 03.06.2011
Quote:
Originally Posted by gamer931215
Thanks for the idea, this has now been added ![Smiley](images/smilies/smile.png)
|
great, also
pawn Код:
CreateSquareArea(Float:...); //making an square
CreateCircleArea(Float...); //making a circle area
instead of just using AreaEx and Area
and
pawn Код:
CreateRectangleArea(type, Float...); //making a rectangle
(if possible :P?)
Re: gArea - Areasystem for adminzones/others ! (Using IsPlayerInArea AND IsPlayerInRangeOfPoint!!!) -
gamer931215 - 03.06.2011
Quote:
Originally Posted by Donya
great, also
pawn Код:
CreateSquareArea(Float:...); //making an square CreateCircleArea(Float...); //making a circle area
instead of just using AreaEx and Area
and
pawn Код:
CreateRectangleArea(type, Float...); //making a rectangle
(if possible :P?)
|
Just paste this on top of your filterscript/gamemode (right after including gArea) and it will work:
pawn Код:
#define CreateCircleArea CreateArea
#define CreateRectangleArea CreateAreaEx
Re: gArea - Areasystem for adminzones/others ! (Using IsPlayerInArea AND IsPlayerInRangeOfPoint!!!) -
Donya - 03.06.2011
forgot about marcos, anyways is it possible to make a triangle area, i've tried it once, i failed ;\, if you can't i understand
Re: gArea - Areasystem for adminzones/others ! (Using IsPlayerInArea AND IsPlayerInRangeOfPoint!!!) -
gamer931215 - 03.06.2011
Quote:
Originally Posted by Donya
forgot about marcos, anyways is it possible to make a triangle area, i've tried it once, i failed ;\, if you can't i understand ![Smiley](images/smilies/smile.png)
|
I guess it would be possible with a difficult calculation, however i shouldnt know how to do that :P
Re: gArea - Areasystem for adminzones/others ! (Using IsPlayerInArea AND IsPlayerInRangeOfPoint!!!) -
Kwarde - 03.06.2011
Similar to my script:
https://sampforum.blast.hk/showthread.php?tid=229423
Re: gArea - Areasystem for adminzones/others ! (Using IsPlayerInArea AND IsPlayerInRangeOfPoint!!!) -
gamer931215 - 03.06.2011
Quote:
Originally Posted by Kwarde
|
Oh, never saw that before :/
well now you have some competition :P
Re: gArea - Areasystem for adminzones/others ! (Using IsPlayerInArea AND IsPlayerInRangeOfPoint!!!) -
System64 - 03.06.2011
awesome, maybe I used it for my admina zone
Re: gArea - Areasystem for adminzones/others ! (Using IsPlayerInArea AND IsPlayerInRangeOfPoint!!!) -
Kwarde - 03.06.2011
I always loose competitions, that's why I hate it :')
I'll just remove it when you beat me
again, as usually.
It's a nice script though.
Re: gArea - Areasystem for adminzones/others ! (Using IsPlayerInArea AND IsPlayerInRangeOfPoint!!!) -
gamer931215 - 03.06.2011
Quote:
Originally Posted by Kwarde
I always loose competitions, that's why I hate it :')
I'll just remove it when you beat me again, as usually
|
why ?
like there arent thousands of RP script's over the web ^^
I just saw a topic somewhere today from a guy that asked about admin areas and i was bored, thats why i made this ^^
Re: gArea - Areasystem for adminzones/others ! (Using IsPlayerInArea AND IsPlayerInRangeOfPoint!!!) -
Kwarde - 03.06.2011
Well why whould I keep it if no-one needs it no more? :P - If they like this one more, why should I keep it? - If the mods remove it, it even saves database space :')
Respuesta: gArea - Areasystem for adminzones/others ! (Using IsPlayerInArea AND IsPlayerInRangeOfPoint!!!) -
Host-samp - 03.06.2011
nice 9.8/10
Re: gArea - Areasystem for adminzones/others ! (Using IsPlayerInArea AND IsPlayerInRangeOfPoint!!!) -
[KO]KillerThriller - 03.06.2011
Suggestion: TogglePlayerArea(playerid,areaid,bool:toggle)