Jump to content
Message added by 0xF,

Any questions? Join the discord https://discord.gg/8nztXhvgDe

1 Screenshot

  • 29.8k
  • 160
  • 10.12 kB
This area is intended for discussion and questions. Please use the support area for reporting issues or getting help.

Recommended Comments

Magnumk

Posted (edited)

I needed to change the command section to be able to sell this item from shop.

 

#region Commands
[ConsoleCommand("give.echest")]
void GiveExplosiveChest(ConsoleSystem.Arg arg)
{
    if (arg.Args == null || arg.Args.Length < 1)
    {
        Puts("Usage: give.echest <SteamID>");
        return;
    }

    ulong steamId;
    if (!ulong.TryParse(arg.Args[0], out steamId))
    {
        Puts("Invalid SteamID provided.");
        return;
    }

    BasePlayer targetPlayer = BasePlayer.FindByID(steamId);
    if (targetPlayer == null)
    {
        Puts($"No player found with SteamID {steamId}.");
        return;
    }

    BasePlayer commandExecutor = arg.Player();

    // Check if the command is executed from the server console
    if (commandExecutor == null)
    {
        targetPlayer.inventory.GiveItem(ItemManager.Create(ItemManager.FindItemDefinition("box.wooden"), 1, config.SkinId));
        return;
    }

    // If executed by an in-game player, check for permissions
    if (commandExecutor.IsAdmin || commandExecutor.IPlayer.HasPermission("explosivechest.give"))
        targetPlayer.inventory.GiveItem(ItemManager.Create(ItemManager.FindItemDefinition("box.wooden"), 1, config.SkinId));
    else
        Puts("You don't have permission to execute this command.");
}


[ConsoleCommand("give.echest.large")]
void GiveExplosiveChestLarge(ConsoleSystem.Arg arg)
{
    if (arg.Args == null || arg.Args.Length < 1)
    {
        Puts("Usage: give.echest.large <SteamID>");
        return;
    }

    ulong steamId;
    if (!ulong.TryParse(arg.Args[0], out steamId))
    {
        Puts("Invalid SteamID provided.");
        return;
    }

    BasePlayer targetPlayer = BasePlayer.FindByID(steamId);
    if (targetPlayer == null)
    {
        Puts($"No player found with SteamID {steamId}.");
        return;
    }

    BasePlayer commandExecutor = arg.Player();

    // Check if the command is executed from the server console
    if (commandExecutor == null)
    {
        targetPlayer.inventory.GiveItem(ItemManager.Create(ItemManager.FindItemDefinition("box.wooden.large"), 1, config.SkinId));
        return;
    }

    // If executed by an in-game player, check for permissions
    if (commandExecutor.IsAdmin || commandExecutor.IPlayer.HasPermission("explosivechest.give"))
        targetPlayer.inventory.GiveItem(ItemManager.Create(ItemManager.FindItemDefinition("box.wooden.large"), 1, config.SkinId));
    else
        Puts("You don't have permission to execute this command.");
}

#endregion

Edited by Magnumk
0xF

Posted

6 hours ago, Magnumk said:

I needed to change the command section to be able to sell this item from shop.
 

...

Hello, thank you for your interest in the plugin, this plugin has no particular purpose, just a plugin for fun, but I'm glad you found it useful.

  • Like 1

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

User Feedback

1.6m

Downloads

Total number of downloads.

7.7k

Customers

Total customers served.

115.3k

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.