View Single Post
Author Message
Franc1sco
Veteran Member
Join Date: Oct 2010
Location: Spain (Madrid)
Old 08-28-2013 , 16:37   [Any] Dev Zones (Zones Manager with natives for developers) [Updated 30-Mar-2021]
Reply With Quote #1

Description:

Plugin for create zones and using natives for create third-party plugins easily.

Zones are saved in config files by maps: configs/dev_zones/mapname.zone.txt

Directory and files are created automaticaly.
If you got any error you need to modify directory or file permissions.


Commands:

sm_zones (!zones in chat) for open the main menu and create/edit/remove zones (Required admin flag "t" for use).


Cvars:
Put in server.cfg
Code:
sm_devzones_filter "1" // 1 = Only allow valid alive clients to be detected in the native zones. 0 = Detect entities and all (you need to add more checkers in the third party plugins).
sm_devzones_mode "1" // 0 = Use checks every X seconds for check if a player join or leave a zone, 1 = hook zone entities with OnStartTouch and OnEndTouch (less CPU consume)
sm_devzones_checker "5.0" // checks and beambox refreshs per second, low value = more precise but more CPU consume, More hight = less precise but less CPU consume
sm_devzones_model "models/error.mdl" // Use a model for zone entity (IMPORTANT: change this value only on map start)

Natives:

Code:
/**
 * Check if a player are there in a zone
 *
 * @param client     Player for check
 * @String zone     Zone name
 * @bool equal     Check exact zone name or parcial name
 * @bool caseSensitive     If true, comparison is case sensitive. If false, comparison is case insensitive.
 * @return true if player are there in the zone given in Zone String
 */
native bool Zone_IsClientInZone(int client, const char[] zone, bool equal = true, bool caseSensitive = false);

/**
 * Check if a position is in a zone
 *
 * @param client     Player for check
 * @String zone     Zone name
 * @float posx      X-Pos
 * @float posx      Y-Pos
 * @float posx      Z-Pos
 * @return true if position is in a zone or not
 */
native bool Zone_isPositionInZone(const char[] zone, float posx, float posy, float posz, bool equal = true);

/**
 * Check if zone exists
 *
 * @String zone     Zone name
 * @bool equal     Check exact zone name or parcial name
 * @bool caseSensitive     If true, comparison is case sensitive. If false, comparison is case insensitive.
 * @return true if zone exist
 */
native bool Zone_CheckIfZoneExists(const char [] zone, bool equal = true, bool caseSensitive = false);

/**
 * Called when a player has entered in a zone.
 * @param client   client that has entered in the zone.
 * @String zone   Zone name.
 */
forward void Zone_OnClientEntry(int client, const char [] zone);

/**
 * Called when a player has left a zone.
 * @param client   client that has left the zone.
 * @String zone   Zone name.
 */
forward void Zone_OnClientLeave(int client, const char [] zone);

/**
 * Get a zone position
 * @String zone   Zone name to search position.
 * @bool caseSensitive     If true, comparison is case sensitive. If false, comparison is case insensitive.
 * @Float Position   Array when the zone position will be copied
 * @return true on successfully, false otherwise
 */
native int Zone_GetZonePosition(const char [] zone, bool caseSensitive = false, float Position[3]);

/**
 * Get a zone coordinates
 * @String zone   Zone name to search coordinates.
 * @bool caseSensitive     If true, comparison is case sensitive. If false, comparison is case insensitive.
 * @Float CordA   Array when the zone coordinates A will be copied
 * @Float CordB   Array when the zone coordinates B will be copied
 * @return true on successfully, false otherwise
 */
native int Zone_GetZoneCord(const char [] zone, bool caseSensitive = false, float CordA[3], float CordB[3]);


/**
 * @Param1 -> int client
 * @Param2 -> char[64] zoneBuffer	
 * @return true if zone found false if not
 */
native bool Zone_getMostRecentActiveZone(int client, char zoneBuffer[64]); 

/**
 * Called when a zone is created.
 * @String zone   Zone name.
 */
forward void Zone_OnCreated(const char [] zone);


Suggestions are welcome


Donations (optional):

If you apreciate my work, you can donate me via paypal or with a trade offer


Download:

Main repository
Direct download
Code changes
__________________
Veteran Coder -> Activity channel
Coding on CS2 and taking paid and free jobs.

Contact: Steam, Telegram or discord ( franug ).

You like my work? +Rep in my steam profile comments or donate.


Last edited by Franc1sco; 03-30-2021 at 05:43.
Franc1sco is offline
Send a message via MSN to Franc1sco