03.06.2011, 15:41
(
Последний раз редактировалось gamer931215; 04.06.2011 в 01:30.
)
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
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
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;
}
Код:
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!)
Pastebin



Nice script gamer931215
You're making awesome scripts at the moment