Git Product home page Git Product logo

zones's Introduction

ZONES - by Bobblehead

WARNING: If you edit any of these files, make them use a different namespace. Multiple scripts may depend on this library so modifying it can break other scripts. If you have a universially beneficial change, please consider making a pull request. :)

Purpose:

For easy in-game designation of persistent polygonal zones which are used by any script. https://www.youtube.com/watch?v=Cht0jQBcVL8

Installation:

  • This is a shared file so include it in any shared environment. Also include ent_zone_point and weapon_zone_designator as a shared ent and weapon.
  • You should not put this file directly in lua/autorun.

How to Use:

  • All zones are saved in zones.List as tables.

  • Zone creation is handled with weapon_zone_designator and ent_zone_point, but can be in code as well.

  • When a zone is created, changed, or removed all zones are synced to clients. When clients join they are also synced.

  • Any extra details can be saved to a zone. Everything is written to a txt file and is persistent to the map.

  • Since multiple scripts might use the zones system, don't assume that every zone is related to your script.

  • To register a zone class, use zones.RegisterClass(class, color); use a unique string like "Scriptname Room".

  • When a new zone is created, the "OnZoneCreated" hook is called serverside.

  • When a player edits a zone's properties, the "ShowZoneOptions" hook is called clientside.

  • Use zones.FindByClass() to find all zones which are of a given class.

  • Use ply:GetCurrentZone() to find the zone that a player is standing in.

Enjoy! ~Bobblehead

zones's People

Contributors

luabee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

zones's Issues

does this still work?

Please provide a complete addon example of the zones, i seem to be getting lots of errors

[ERROR] lua/includes/modules/draw.lua:85: bad argument #3 to 'SetTextColor' (number expected, got nil)

  1. SetTextColor - [C]:-1
  2. SimpleText - lua/includes/modules/draw.lua:85
  3. DrawScreen - addons/trigger_zones/lua/weapons/weapon_zone_designator.lua:799
  4. unknown - addons/trigger_zones/lua/weapons/weapon_zone_designator.lua:849

Lua ERROR

[zones-master] addons/zones-master/lua/weapons/weapon_zone_designator.lua:123: attempt to call method 'GetCurrentZone' (a nil value)

  1. unknown - addons/zones-master/lua/weapons/weapon_zone_designator.lua:123

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.