Jump to content

1 Screenshot

  • 20.9k
  • 157
  • 105.12 kB
This area is intended for discussion and questions. Please use the support area for reporting issues or getting help.

Recommended Comments



Yac Vaguer

Posted

is it possible to add a cost per build in some custom currency? For example to build a base it will cost 5RP or 500 of economy or 1000 scrap besides the materials. 

 

walkinrey

Posted

On 2/8/2025 at 11:19 PM, Yac Vaguer said:

is it possible to add a cost per build in some custom currency? For example to build a base it will cost 5RP or 500 of economy or 1000 scrap besides the materials. 

 

nice idea, i will take a look what we can do about it

  • Love 1
Yac Vaguer

Posted (edited)

 I made a small plugin that use the command `/bob` (for bob the constructor) to show you which base you can actually build based on your permissions. If you feel it you can include it on your plugin 

  

using System.Collections.Generic;
using Newtonsoft.Json;
using Oxide.Core;
using Oxide.Core.Plugins;
using Rust;

namespace Oxide.Plugins
{
    [Info("Bob", "Yac Vaguer", "1.0.0")]
    [Description("Shows available bases for a player based on their permissions when using /bob")]
    public class Bob : RustPlugin
    {
        private PluginConfig config;

        private void Init()
        {
            foreach (var baseEntry in config.Bases)
            {
                if (!permission.PermissionExists(baseEntry.Permission, this))
                    permission.RegisterPermission(baseEntry.Permission, this);
            }
        }

        protected override void LoadDefaultConfig()
        {
            config = new PluginConfig()
            {
                Bases = new List<BaseEntry>
                {
                    new BaseEntry { Name = "Small Base", Permission = "personalbuilder.smallbase" },
                    new BaseEntry
                    {
                        Name = "Medium Base",
                        Permission = "personalbuilder.mediumbase",
                    },
                    new BaseEntry { Name = "Large Base", Permission = "personalbuilder.largebase" },
                },
            };
            PrintWarning("Generating new configuration file for PersonalBuilder.");
            SaveConfig();
        }

        protected override void LoadConfig()
        {
            base.LoadConfig();
            try
            {
                config = Config.ReadObject<PluginConfig>();
                if (config == null)
                {
                    LoadDefaultConfig();
                }
            }
            catch
            {
                PrintError("Could not load configuration, using defaults.");
                LoadDefaultConfig();
            }
        }

        protected override void SaveConfig() => Config.WriteObject(config, true);

        [ChatCommand("bob")]
        private void BobCommand(BasePlayer player, string command, string[] args)
        {
            List<string> availableBases = new List<string>();

            foreach (var baseEntry in config.Bases)
            {
                if (permission.UserHasPermission(player.UserIDString, baseEntry.Permission))
                {
                    availableBases.Add($"- <color=#3399FF>{baseEntry.Name}</color>");
                }
            }

            if (availableBases.Count == 0)
            {
                SendReply(player, "Sorry, you don't have permission to build any base.");
            }
            else
            {
                string message =
                    "You can build the following bases:\n" + string.Join("\n", availableBases);
                SendReply(player, message);
            }
        }

        private class PluginConfig
        {
            [JsonProperty("Bases")]
            public List<BaseEntry> Bases { get; set; }
        }

        private class BaseEntry
        {
            [JsonProperty("Name")]
            public string Name { get; set; }

            [JsonProperty("Permission")]
            public string Permission { get; set; }
        }
    }
}

 

7373.png

Edited by Yac Vaguer
leonard

Posted

where do u fine the  file to put  that info  so i can get my builder to work 

walkinrey

Posted

On 2/12/2025 at 8:18 PM, Yac Vaguer said:

 I made a small plugin that use the command `/bob` (for bob the constructor) to show you which base you can actually build based on your permissions. If you feel it you can include it on your plugin 

  

using System.Collections.Generic;
using Newtonsoft.Json;
using Oxide.Core;
using Oxide.Core.Plugins;
using Rust;

namespace Oxide.Plugins
{
    [Info("Bob", "Yac Vaguer", "1.0.0")]
    [Description("Shows available bases for a player based on their permissions when using /bob")]
    public class Bob : RustPlugin
    {
        private PluginConfig config;

        private void Init()
        {
            foreach (var baseEntry in config.Bases)
            {
                if (!permission.PermissionExists(baseEntry.Permission, this))
                    permission.RegisterPermission(baseEntry.Permission, this);
            }
        }

        protected override void LoadDefaultConfig()
        {
            config = new PluginConfig()
            {
                Bases = new List<BaseEntry>
                {
                    new BaseEntry { Name = "Small Base", Permission = "personalbuilder.smallbase" },
                    new BaseEntry
                    {
                        Name = "Medium Base",
                        Permission = "personalbuilder.mediumbase",
                    },
                    new BaseEntry { Name = "Large Base", Permission = "personalbuilder.largebase" },
                },
            };
            PrintWarning("Generating new configuration file for PersonalBuilder.");
            SaveConfig();
        }

        protected override void LoadConfig()
        {
            base.LoadConfig();
            try
            {
                config = Config.ReadObject<PluginConfig>();
                if (config == null)
                {
                    LoadDefaultConfig();
                }
            }
            catch
            {
                PrintError("Could not load configuration, using defaults.");
                LoadDefaultConfig();
            }
        }

        protected override void SaveConfig() => Config.WriteObject(config, true);

        [ChatCommand("bob")]
        private void BobCommand(BasePlayer player, string command, string[] args)
        {
            List<string> availableBases = new List<string>();

            foreach (var baseEntry in config.Bases)
            {
                if (permission.UserHasPermission(player.UserIDString, baseEntry.Permission))
                {
                    availableBases.Add($"- <color=#3399FF>{baseEntry.Name}</color>");
                }
            }

            if (availableBases.Count == 0)
            {
                SendReply(player, "Sorry, you don't have permission to build any base.");
            }
            else
            {
                string message =
                    "You can build the following bases:\n" + string.Join("\n", availableBases);
                SendReply(player, message);
            }
        }

        private class PluginConfig
        {
            [JsonProperty("Bases")]
            public List<BaseEntry> Bases { get; set; }
        }

        private class BaseEntry
        {
            [JsonProperty("Name")]
            public string Name { get; set; }

            [JsonProperty("Permission")]
            public string Permission { get; set; }
        }
    }
}

 

7373.png

very nice!! will be added in next update

walkinrey

Posted

On 2/12/2025 at 10:12 PM, leonard said:

where do u fine the  file to put  that info  so i can get my builder to work 

hi, what file exactly? copypaste building file should be in oxide/data/copypaste

leonard

Posted

my builder is still not build any base  

walkinrey

Posted

can i see your config file and contents of your copypaste data folder? you can send me it in pm or discord

AG93Racing

Posted

can this bot also do floor stacking?

walkinrey

Posted

8 hours ago, AG93Racing said:

can this bot also do floor stacking?

i think yes, check by pasting the building using CopyPaste plugin

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Like 2
  • Confused 1
  • Love 2

User Feedback

1.6m

Downloads

Total number of downloads.

7.7k

Customers

Total customers served.

115.2k

Files Sold

Total number of files sold.

2.3m

Payments Processed

Total payments processed.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.