1. Code:
    (bool) isPlayerInZone(string ZoneID, BasePlayer player)
    I'm new.I want to know how to use this code.

    For example i make an zone.
    i want to know If a person in that zone , how he can use a command for example /buy or something like that.

    Code:
    class RPtest : RustPlugin
        {        [ChatCommand("buy")]
            private void ReportCmd(BasePlayer player, string key, string[] args)
            {
                foreach (BasePlayer p in BasePlayer.activePlayerList.Where(x => x.IsAdmin))
                {
                    if(isPlayerInZone(zonejob)==true)
                        SendReply(p, $"{player.displayName} used /buy!");
                }
            }        private bool isPlayerInZone(string ZoneID, BasePlayer player)
            {
                ZoneID = "10946375";
                return;           
            }    }
     
  2. Hi, isPlayerZone return boolean. You need to return true or false ;).

    Edit : Sorry I answered a little quickly :). All you had to do was call isPlayerInZone with the zone and players settings

    If I understood correctly you want to see the players who are can use the buy command?

    You can pass an argument to your buy command like this /buy 012345 this argument will be the area you want to test :).

    Code:
    class RPtest : RustPlugin
        {        [ChatCommand("buy")]
            private void ReportCmd(BasePlayer player, string key, string[] args)
            {
                foreach (BasePlayer p in BasePlayer.activePlayerList.Where(x => x.IsAdmin))
                {
                    if(isPlayerInZone(args[0], p))
                        SendReply(player, $"{p.displayName} used /buy!");
                }
            }
        }

    You can also put the argument hard in your code.

    Code:
                    if(isPlayerInZone("012345", p))
                        SendReply(player, $"{p.displayName} used /buy!");
    I do not test this code I do not guarantee that it works.
     
    Last edited by a moderator: Apr 21, 2018
  3. You should call it. First of all declare reference:
    Code:
    [PluginReference] private Plugin ZoneManager;
    Then in code you can use next:
    Code:
    if ((bool) ZoneManager.Call("isPlayerInZone", zoneName, player))
    {
        Puts("YES");
    }
    else
    {
        Puts("NO");
    }
    You can find arguments that you can send in API description of plugin.

    Live example:
    Code:
            [ChatCommand("buy")]
            private void ReportCmd(BasePlayer player, string key, string[] args)
            {           
                    if ((bool) ZoneManager.Call("isPlayerInZone", "noBuyZone", player))
                    {
                            player.ChatMessage("You can't use /buy in this zone!");
                            return;
                     }
                     // Your code if player is not in zone
            }