[Include] dzones.inc - Dynamic Zones
#1

MOVED TO GITHUB
Github

Description
* This include contains functions to manage gang zones,
* Also contains two callbacks to check when a player enters
* or leaves a zone.

Native list
pawn Код:
native GetDynamicZoneArea(zoneid, &Float:minx, &Float:miny, &Float:maxx, &Float:maxy);
native SetDynamicZoneArea(zoneid, Float:minx, Float:miny, Float:maxx, Float:maxy);
native CreateDynamicZone(Float:minx, Float:miny, Float:maxx, Float:maxy, color);
native FlashDynamicZoneForPlayer(playerid, zoneid, color);
native IsDynamicZoneFlashingForPlayer(playerid, zoneid);
native IsDynamicZoneVisibleForPlayer(playerid, zoneid);
native StopFlashDynamicZoneForPlayer(playerid, zoneid);
native ShowDynamicZoneForPlayer(playerid, zoneid);
native HideDynamicZoneForPlayer(playerid, zoneid);
native IsPlayerInDynamicZone(playerid, zoneid);
native FlashDynamicZoneForAll(zoneid, color);
native SetDynamicZoneColor(zoneid, color);
native StopFlashDynamicZoneForAll(zoneid);
native ShowDynamicZoneForAll(zoneid);
native HideDynamicZoneForAll(zoneid);
native GetDynamicZoneColor(zoneid);
native DestroyDynamicZone(zoneid);
native zexist(zoneid);
Current Version
* 1.0

Functions info
NameFunctionParams
StopFlashDynamicZoneForPlayerStops a zone of flashing for a player.(playerid, zoneid)
IsDynamicZoneFlashingForPlayerChecks if a zone is flashing for a player.(playerid, zoneid)
IsDynamicZoneVisibleForPlayerChecks if a zone is visible for a player.(playerid, zoneid)
StopFlashDynamicZoneForAllStops a zone of flashing for all.(zoneid)
ShowDynamicZoneForPlayerShow a zone for a player.(playerid, zoneid)
FlashDynamicZoneForPlayerFlashes a zone for a player.(playerid, zoneid)
HideDynamicZoneForPlayerHides a zone for a player.(playerid, zoneid)
ShowDynamicZoneForAllFlashes a zone for all.(zoneid)
FlashDynamicZoneForAllFlashes a zone for all.(zoneid)
HideDynamicZoneForAllFlashes a zone for all.(zoneid)
IsPlayerInDynamicZoneChecks if a player is in a zone.(playerid, zoneid)
SetDynamicZoneColorSet the color of a zone.(zoneid, color)
GetDynamicZoneColorGet the color of a zone.(zoneid)
SetDynamicZoneAreaChange the zone position.(zoneid, Float:minx, Float:miny, Float:maxx, Float:maxy)
GetDynamicZoneAreaStore the zone position, passed by reference.(zoneid, Float:minx, Float:miny, Float:maxx, Float:maxy)
DestroyDynamicZoneDestroys a Dynamic Zone(zoneid)
CreateDynamicZoneCreates a Dynamic Zone.(Float:minx, Float:miny, Float:maxx, Float:maxy, color)
zexistCheck if a zone exist.(zoneid)
Atention
* If you're using the include in a filterscript you must #define FILTERSCRIPT before including the inc file.

Callbacks info
NameInfoParams
OnPlayerEnterDynamicZoneCalled when a player enters a zone(playerid, zoneid)
OnPlayerExitDynamicZoneCalled when a player exits a zone(playerid, zoneid)
Example
pawn Код:
public OnPlayerEnterDynamicZone( playerid, zoneid )
{
    if(zoneid == 1 && IsPlayerAdmin(playerid)) SendClientMessage( playerid, 0xFFFFFFFF, "Welcome to the zone, admin." );
    return 1;
}

public OnPlayerExitDynamicZone( playerid, zoneid )
{
    if(zoneid == 1 && IsPlayerAdmin(playerid)) SendClientMessage( playerid, 0xFFFFFFFF, "Good bye, admin." );
    return 1;
}
Download
Github

Thanks
* ******
* SA-MP Team.
Reply
#2

Nice
Whats this? GetDynamicZoneArea(zoneid, &Float:minx, &Float:miny, &Float:maxx, &Float:maxy);
Reply
#3

Quote:
Originally Posted by FireCat
Посмотреть сообщение
Nice
Whats this? GetDynamicZoneArea(zoneid, &Float:minx, &Float:miny, &Float:maxx, &Float:maxy);
Thanks.
It's to get the minx, miny, maxx and maxy coordinates of a zone.
Reply
#4

Nice work, will test it later!
Reply
#5

Quote:
Originally Posted by RuiGy
Посмотреть сообщение
Thanks.
It's to get the minx, miny, maxx and maxy coordinates of a zone.
get minimum x,y and maximum x,y ?
Can you explane more about the minimum,maximum x,y ?
Quote:
pawn Код:
native GetDynamicZoneArea(zoneid, &Float:minx, &Float:miny, &Float:maxx, &Float:maxy);
native SetDynamicZoneArea(zoneid, Float:minx, Float:miny, Float:maxx, Float:maxy);
Reply
#6

Quote:
Originally Posted by xkirill
Посмотреть сообщение
get minimum x,y and maximum x,y ?
Can you explane more about the minimum,maximum x,y ?
Of course, when you create a gang zone you need to specify the area of the zone.

GangZoneCreate(Float:minx, Float:miny, Float:maxx, Float:maxy)

Then, GetDynamicZoneArea Gets these coordinates and SetDynamicZoneArea "changes" these coordinates (change the place of the gang zone).

Thanks guys.
Reply
#7

I Like It Good Job
Reply
#8

Nice Bitch '-'
Reply
#9

I want to say.YOU JUST SAVED HELLA TIME FOR ME. Rep+6 Added. Keep up the good work.

Suggestion to create something like:

OnObjectEnterDynamicZone Called when a object enters a zone (objectid, zoneid)
OnObjectExitDynamicZone Called when a object exits a zone (objectid, zoneid)

Will be cool to have it. We can move Objects from one place to another and we are to know when a object enters a zone declared as well as exit it. Will be helpful for lot of things to script ahead.
Reply
#10

Just a quick question. Sorry for opening up an old thread but it's related to this I think. I recently popped this onto my server and I've gotta say it works awesomely and it saved me crap loads of time. But when I added this it seems that ever since the CPU usage of my SA-MP server has sky rocketed. Could this have happened if I installed it wrong? Or maybe when I pasted the code into the .inc file it pasted in wrong? It's literally since I added this include that it has sky rocketed on the CPU.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)