[Include] gArea - Areasystem for adminzones/others ! (Using IsPlayerInArea AND IsPlayerInRangeOfPoint!!!)
#1

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

Wow! Good release! 8/10

Testing now!
Reply
#3

nice, 9/10, what about onplayerleavearea? that might be nice :P
Reply
#4

Good job and NICELY DONE.
Reply
#5

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
Reply
#6

I think this would be lagging ? Correct me if im wrong , I havent actually lukd on to the script
Reply
#7

Whoh Nice script gamer931215 You're making awesome scripts at the moment
Reply
#8

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
Reply
#9

Quote:
Originally Posted by gamer931215
Посмотреть сообщение
Thanks for the idea, this has now been added
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?)
Reply
#10

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
Reply
#11

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
Reply
#12

Quote:
Originally Posted by Donya
View Post
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
I guess it would be possible with a difficult calculation, however i shouldnt know how to do that :P
Reply
#13

Similar to my script: https://sampforum.blast.hk/showthread.php?tid=229423
Reply
#14

Quote:
Originally Posted by Kwarde
View Post
Oh, never saw that before :/
well now you have some competition :P
Reply
#15

awesome, maybe I used it for my admina zone
Reply
#16

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

Quote:
Originally Posted by Kwarde
View Post
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 ^^
Reply
#18

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 :')
Reply
#19

nice 9.8/10
Reply
#20

Suggestion: TogglePlayerArea(playerid,areaid,bool:toggle)
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)