1. Hey.

    I'm making a plugin for an event and I need to check every second what players are in a zone between to points.

    Say you have PointA at 100, 100, 100 and PointB at -100, 0, -100. I need to be able to check what players are in that region every second so I can award them points.

    I've tried searching around but I can't find anything so I hope you can help.

    Thanks, PsychoTea
     
  2. If the region can be a sphere you could use Zone manager.
     
  3. Yes this plugin was made for exactly those situations ^^
    If you need exemples on how to implement it you have all the plugins that require it: (Hotel, EventManager, etc)
    And you can ask here i'll gladly help ;)
    [DOUBLEPOST=1441091137][/DOUBLEPOST]ZoneManager can be used just to detect players in zone, No need to set any options ;)
     
  4. use Vector3.Distance(pos1, pos2)
     
  5. Ah ok, could you give me a few examples of how to use it please?
     
  6. I can give you an example about Vector3.Distance ...
    if(Vector3.Distance(player.transform.position, target.transform.position) < radius)
    {
    //Your stuff
    }
     
  7. Ah I see. That's working around a center point. I will try that, thanks.

    EDIT: although how would I check which players are in that zone every second? ZoneManager has an event for it...
     
  8. pain this is not the best way to do it ^^ especially if you have a lot of players

    i'll make you something when i can
     
  9. Don't worry, I've got that, I just have 2 questions.

    1) Here is my code:
    Code:
            void Unload()
            {
                ZoneManager.Call("EraseZone", "hill1");
                ZoneManager.Call("EraseZone", "hill2");
                ZoneManager.Call("EraseZone", "hill3");
                ZoneManager.Call("EraseZone", "hill4");
                ZoneManager.Call("EraseZone", "hill5");
                ZoneManager.Call("EraseZone", "KingSpawn");
            }
    For some reason, I get the error:
    Code:
    [Error] Failed to call hook 'Unload' on plugin 'KingoftheHill v1.0.0' (NullReferenceException: Object reference not set to an instance of an object)
    Do you know how I could fix that?

    2) When specifying a zone via the commands of your plugin, it creates a red circle around the circunference of the zone. Is there a way I can use that in my plugin for when you're creating a zone? Eg a hook or even the source code to do it?

    Thanks, PsychoTea (Ben)
     
  10. thats how Im using it in my Portals :p