k1lly0u
Advanced zone manager for creating in-game zones

Supported Games
GameServerKingsGameServerKings

Zone Manager is an advanced zone manager for creating in-game zones.

Permissions

zonemanager.zone -- Allows access to chat/console commands

zonemanager.ignoreflag.<flagtype> -- Allows players to bypass any flag set on a zone. Replace <flagtype with the flag you wish to ignore

Make sure you do not blindly grant players any of the ignore flags!

If you are unsure what the result of granting an ignoreflag will be, simply look at what the flag does and by granting the ignore flag permission that player will be able to bypass the flags affect

Chat Commands

These are only accessible for players with auth level 2 or the permission zonemanager.zone

/zone_add - Create a new zone on your location

/zone_edit <zone ID> - Edit the zone with the specified ID

/zone_list - List all zones with their corresponding zone ID

/zone_remove <zone ID> - Remove the zone with the specified ID

/zone_wipe - Deletes all zones

/zone_player <opt:player ID or name> - Display information about the zones the specified player is in and what flags they currently have

/zone_stats - Display the count of various entities in all zones

/zone flags - Open the UI flag editor

/zone <flag> <value> - Set's the specified field or flag

Zone Flags

Zone flags are conditions you can apply to a zone. To set a zone flag you must first be editing the target zone. You can then apply flags to the zone by typing /zone <option> <value>.

You can apply multiple flags in one line by continuing the pattern (ex. /zone eject true killsleepers true nobuild true)

Alternatively, you can type /zone flags to open a GUI menu in which you can toggle flags easily.

Flag Types

Flag name - Values - Description

These are all the available flags. First is the name of the flag, followed by the value type it accepts.

  • autolights - true/false - Toggles lights on and off automatically depending on the time (time's can be set in the config)

  • eject - true/false - All players will be kicked from the zone when trying to enter it unless they are on the zone whitelist, or have the permission associated with that zone. (This flag will not affect admins)

  • ejectsleepers - true/false - Players will be moved out of the zone when they go to sleep (This flag will not affect admins)

  • infinitetrapammo - true/false - Flame turrets, gun traps and auto-turrets won't consume fuel

  • kill - true/false - Players will be killed when they enter the zone

  • killsleepers - true/false - Players will be killed when they go to sleep (This flag will not affect admins)

  • lootself - true/false - Players will be able to loot their own body/bag. This flag only applies when the flag NoPlayerLoot is active on a zone

  • noapctargeting - true/false - APCs will not target players in the zone

  • nobleed - true/false - Prevent players from bleeding

  • noboxloot - true/false - Prevent players from looting boxes

  • nobuild - true/false - Prevent players from building (This flag will not affect admins)

  • nochat - true/false - Prevent player from using chat (This flag will not affect admins)

  • nocollect - true/false - Prevent players from picking up collectables

  • nocorpse - true/false - Remove player corpses when they spawn

  • nocraft - true/false - Disable crafting in the zone

  • nocup - true/false - Prevent players from placing a Tool Cupboard

  • nodecay - true/false - Stop decay-able entities from taking decay damage

  • nodeploy - true/false - Prevent players from deploying items (This flag will not affect admins)

  • nodooraccess - true/false - Prevent players from opening doors

  • nodrop - true/false - Removes dropped items

  • nodrown - true/false - Prevent players from drowning

  • noentitypickup - true/false - Prevent players from picking up entities such as doors, locks etc

  • nofalldamage - true/false - Prevent players from taking fall damage

  • nogather - true/false - Prevent players from gathering resources

  • nohelitargeting - true/false - Stops helicopters from targeting players and sends them to a new location

  • nokits - true/false - Prevent players from claiming kits (Kits plugin)

  • nolootspawns - true/false - Prevent loot from spawning in the zone

  • nonpcspawns - true/false - Prevent animals from spawning in the zone

  • nonpctargeting - true/false - NPC players wont target players in the zone

  • nooventoggle - true/false - Prevent players from toggling on/off ovens/lights/fires etc

  • nopickup - true/false - Prevent players from picking up dropped items

  • noplayerloot - true/false - Prevent players from looting other players

  • nopve - true/false - Animals will be invincible to player attacks

  • noremove - true/false - Prevent players using the remove tool (RemoveTool plugin)

  • nosignupdates - true/false - Prevent players from updating signs

  • noshop - true/false - Prevent players from using a shop (GUIShop/ServerRewards)

  • nostability - true/false - Disable structure stability

  • nostash - true/false - Prevent players from hiding a stash

  • nosuicide - true/false - Prevent players from using the suicide command

  • notp - true/false - Prevent players from using teleportation (Teleportation plugin)

  • notrade - true/false - Prevent players from trading (Trade plugin)

  • noturrettargeting - true/false - Stops turrets from targeting players (autoturret/flameturret/guntrap)

  • noupgrade - true/false - Buildings can not be upgraded (This flag will not affect admins)

  • novending - true/false - Prevent players from using vending machines

  • novoice - true/false - Prevent players from using voice chat (This flag will not affect admins)

  • nowounded - true/false - Skip the wounded state when a player dies

  • keepvehiclesin - true/false - Vehicles inside the zone will be prevented from leaving

  • keepvehiclesout - true/false - Vehicles will be prevented from entering the zone

  • npcfreeze - true/false - Stop animals from moving around

  • pvegod - true/false - Players will have PVE god mode

  • pvpgod - true/false - Players will have PVP god mode

  • sleepgod - true/false - Sleeping players will have god mode

  • undestr - true/false - Buildings will not take damage

Zone Options

There are also zone options that can be set/adjusted in the same way you would set a flag.

Option - Values - Description

  • name - "Zone Name" - Set the zone name

  • id - "ID number" - Set the zone ID

  • location - "here" or "x y z" - By using the value "here" the zone location will move to your position, otherwise set the position manually by typing the co-ordinates (x y z)

  • radius - Number amount - Set the radius of the zone (if using a sphere shaped zone)

  • size - "width height length" - Set the size of the zone (for use when creating rectangle zones. Be sure to type the width, height and length as numbers representing the size you wish the zone to be

  • rotation - "y rotation" or no value - Rotate a rectangle zone to the Y value specified, or if no value is given it will be the direction you are facing

  • radiation - Number amount - Add radiation to this zone

  • safezone - true/false - Set's the zone as a safe zone the same as the compound, where weapon can't be drawn and player to player damage can not be dealt

  • enter_message - "Any message in quotation marks" - Set a message to display to players when they enter the zone

  • leave_message - "Any message in quotation marks" - Set a message to display to players when they leave the zone

  • ejectspawns - "Spawnfile name" - Designate a spawnfile to eject players to as an alternative to teleporting them outside of the zone

  • permission - "Permission name" - Assign a permission to this zone to prevent players without the permission entering it

  • enabled - true/false - Enable or disable this zone

  • parentid - "Zone ID" - Set a parent zone

Example zone creation for an admin house:

/zone_add
/zone nobuild true nodeploy true name "Admin House" undestr true

Here you can see we have created a new zone, named it "Admin House" and set the nobuild, nodeploy and undest flags to true. This will stop players from building, deploying items and damaging buildings in the zone.

Parent/Child zones

By default, smaller zones inside other zones inherit the flags from the larger zone, aswell as the flags assigned to the smaller zone.

To work around this you can assign a parent zone ID to the smaller zone by using the command "/zone parentid <zoneid>".

The plugin will still register the player as being inside both zones, but all the flags from the parent zone (the larger outer zone) will be disabled for that player when they enter the child zone (the smaller zone inside the outer zone).

If you are using this feature and still want certain flags from the parent zone applied to the player, zimply apply those flags to the child zone also.

Configuration

{
  "Autolight Options": {
    "Time to turn lights on": 18.0,
    "Time to turn lights off": 6.0,
    "Lights require fuel to activate automatically": true
  },
  "Notification Options": {
    "Display notifications via PopupNotifications": false,
    "Chat prefix": "[Zone Manager] :",
    "Chat color (hex)": "#d85540"
  },
  "NPC players can deal player damage in zones with PvpGod flag": false,
  "Allow decay damage in zones with Undestr flag": false,
  "Version": {
    "Major": 3,
    "Minor": 0,
    "Patch": 0
  }
}

Developer API

(bool) CreateOrUpdateZone(string ZoneID, string[] args, Vector3 position = default(Vector3)) // Create or Update a Zone from an external plugin
// Parameter 1: is the Zone ID that you want (can be a name)
// Parameter 2: are the options as you would put them in /zone ex:
// args[0] = "name"
// args[1] = "Jail"
// args[2] = "eject"
// args[3] = "true"
// args[4] = "enter_message"
// args[5] = "Welcome to the jail"
// args[6] = "radius"
// args[7] = "120"
// Parameter 3 (optional): is to set or edit the location of the zone
// Returns true if the zone is valid, else returns false if it was saved but not created (only reason would be that no position for the zone was set)
(bool) EraseZone(string ZoneID) // Erase a zone by ZoneID or name.
// Returns true if the zone was deleted or false if the zone doesn't exist
(List<BasePlayer>) GetPlayersInZone(string ZoneID) // Get the list of players in the specified zone
(List<BaseEntity>) GetEntitiesInZone(string ZoneID) // Get the list of entities in the specified zone
(bool) IsPlayerInZone(string ZoneID, BasePlayer player) // Returns true if the player is in the specified zone, else returns false
(bool) IsEntityInZone(string ZoneID, BaseEntity entity) // Returns true if the entity is in the specified zone, else returns false
(bool) AddPlayerToZoneKeepinlist(string ZoneID, BasePlayer player) // Will "jail" the player to the specified zone and keep them from leaving. If the player is not already in the zone they will automatically be teleported to the zone.
// Make sure that if you have the zone flag "eject" set to true that you add the player to the zone whitelist before forcing them inside!
// Returns true if all went accordingly or false if the zone does not exist
(bool) RemovePlayerFromZoneKeepinlist(string ZoneID, BasePlayer player) // Will allow previously "jailed" players to leave the zone. This will not teleport the player out of the zone.
// Returns true if all went accordingly or false if the zone does not exist
(void) SetZoneStatus(string zoneID, bool active) // Set the zone with the specified ID as enabled or disabled
(object) GetZoneRadius(string zoneID) // Returns the radius (float), or null if the zone does not exist.
(object) GetZoneSize(string zoneID) // Returns the size (Vector3), or null if the zone does not exist.
(object) GetZoneName(string zoneID) // Returns the zone name (string), or null if the zone does not exist.
(object) CheckZoneID(string zoneID) // Returns the zone ID (string) if it exists, or null if the zone does not exist.
(object) GetZoneIDs() // Returns the a string[] or zone ID's, or null if no zones exist.
(Vector3) GetZoneLocation(string zoneID) // Returns the position of the specified zone, or Vector3.zero if the zone does not exist.
(Dictionary<string, string>) ZoneFieldList(string zoneID) // Returns the zone with the specified ID's zone definition. This includes all the fields and data that make the zone what it is
(bool) HasFlag(string zoneId, string flagString) // Returns true if the zone with the specified ID has the specified flag, else returns false
(void) AddFlag(string zoneId, string flagString) // Adds the specified flag to the zone with the specified ID
(void) RemoveFlag(string zoneId, string flagString) // Removes the specified flag from the zone with specified ID
// Disabled flags are temporary. They do not persist through reloads
(bool) HasDisabledFlag(string zoneId, string flagString) // Returns true if the zone with the specified ID has the specified flag disabled, else returns false
(void) AddDisabledFlag(string zoneId, string flagString) // Adds the specified disabled flag to the zone with the specified ID
(void) RemoveDisabledFlag(string zoneId, string flagString) // Removes the specified disabled flag from the zone with specified ID
(bool) EntityHasFlag(BaseEntity entity, string flagString) // Returns true if the entity is in any zone with the specified flag, else returns false
(bool) PlayerHasFlag(BasePlayer player, string flagString) // Returns true if the player is in any zone with the specified flag, else returns false
(string[]) GetPlayerZoneIDs(BasePlayer player) // Returns a string[] of IDs for zones the specified player is currently in, or null if none found
(string[]) GetEntityZoneIDs(BaseEntity entity) // Returns a string[] of IDs for zones the specified entity is currently in, or null if none found

Hooks

void OnEnterZone(string ZoneID, BasePlayer player) // Called when a player enters a zone
{
}
void OnExitZone(string ZoneID, BasePlayer player) // Called when a player leaves a zone
{
}
void OnEntityEnterZone(string ZoneID, BaseEntity entity) // Called when a entity enters a zone
{
}
void OnEntityExitZone(string ZoneID, BaseEntity entity) // Called when a entity leaves a zone
{
}

MIT License


Copyright (c) 2019 k1lly0u


Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:


The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.


THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.