Custom plugin keeps looping one partSolved
   if (player.inventory.GetAmount(-932201673) == amount)
            {
                player.inventory.Take(null, -932201673, amount);

                if (dice1 > dice2)
                {
                    PrintToChat(player, "<color=#00C715>You won!</color>");
                    player.inventory.GiveItem(ItemManager.CreateByItemID(-932201673, amount * 2));
                }
                else
                {
                    PrintToChat(player, "<color=#C70000>You Lost!</color>");

                }
            }
            else
            {
                 //Loop part
                PrintToChat(player, "<color=#C70000>No Enough Scrap!</color>");
            }
        }
    }
}

Thank you :)

There is no loop in your code. Consider dropping the full plugin.
using System;

namespace Oxide.Plugins
{
    [Info("Gambling Plugin that uses Scrap as currency", "RealAR16", "0.2")]
    public class Gamble : RustPlugin
    {
        [ChatCommand("gamble")]
        private void GambleCommand(BasePlayer player, string command, string[] args)
        {
            Random rnd = new Random();

            int dice1 = rnd.Next(1, 7);
            int dice2 = rnd.Next(1, 7);

            if (args.Length < 1)
            {
                PrintToChat(player, "Enter Amount");
                return;
            }

            var amount = default(int);

            if (!int.TryParse(args[0], out amount))
            {
                PrintToChat(player, "Enter Amount");
                return;
            }

            if (player.inventory.GetAmount(-932201673) == amount)
            {
                player.inventory.Take(null, -932201673, amount);

                if (dice1 > dice2)
                {
                    PrintToChat(player, "<color=#00C715>You won!</color>");
                    player.inventory.GiveItem(ItemManager.CreateByItemID(-932201673, amount * 2));
                }
                else
                {
                    PrintToChat(player, "<color=#C70000>You Lost!</color>");

                }
            }
            else
            {
                PrintToChat(player, "<color=#C70000>No Enough Scrap!</color>");
            }
        }
    }
}

It's super simple code but im just a noob when it comes to c# and oxide so i want to learn more about oxide/umod

What is looping about it? There is no loop there.
5c2d88ae4ea06.jpg Wulf
What is looping about it? There is no loop there.

Yea it was pretty late for me when i posted it :D theres something else wrong with it. Keeps printing no enough scrap part.

Add some debug output to see what GetAmount and amount are at that point.
Tbh i have no clue how to get debug output from plugin/class library.
Can't even find anything about it lol.
CrazyBeast
Tbh i have no clue how to get debug output from plugin/class library.
Can't even find anything about it lol.

Since you are not developing the assembly itself, just a class for it, the only way you can get 'debug output' is to make some messages at the points you need (Puts(string), PrintWarning(string) etc.)

Wow im stupid... 
if (player.inventory.GetAmount(-932201673) == amount)​
means that it would be like this /gamble "Amount Of items in your inventory" so when you have 3 scraps in your inventory and do /gamble 3 it will execute dice part but if you do  /gamble 4 it just gives you no enough scrap
It should be like this
if (player.inventory.GetAmount(-932201673) < amount)
            {
                PrintToChat(player, "No Enough Scrap!");
            }
            else if (dice1 > dice2)
                {
                    PrintToChat(player, "You won!");
                    player.inventory.GiveItem(ItemManager.CreateByItemID(-932201673, amount * 2));
                }
                else
                {
                    PrintToChat(player, "You Lost!");
                    player.inventory.Take(null, -932201673, amount);
                }
            }
        }
    }​
Locked automatically