1. Hi all,

    I'm trying to make some changes to a few existing plugins.

    I would like one plugin to print to console when a player has used the command. So I have used Puts(player.displayName + "has used command") - This is not working, what is it I am missing? I am receiving the same error message The name `player' does not exist in the current context. I'm sure it's something insanely simple to fix and something I will kick myself for.

    The other issue I am having is, there's a plugin I have is a player will need to guess the number in order to win a set prize. Is there a specific command I can use which will add a quantity to this? Please see below;

    Code:
                if (isLotteryRunning && guessedNumber == winningNumber)
                {
                    PrintToChat(player.displayName + " has won the lottery!");
                    Puts(player.displayName + " has won the lottery!");
                    GivePlayerGift(player, "gears");
                    GivePlayerGift(player, "metal pipe");
                    GivePlayerGift(player, "scrap");
                    GivePlayerGift(player, "scrap");
                    GivePlayerGift(player, "scrap");
                    GivePlayerGift(player, "scrap");
                    GivePlayerGift(player, "scrap");
                    isLotteryRunning = false;
                    nextLotteryTime = Time.time + lotteryRate;
                    guessedPlayerIds.Clear();
                }        void GivePlayerGift(BasePlayer player, string gift)
         
            {
                Item item = ItemManager.CreateByItemID(ItemManager.FindItemDefinition(gift).itemid);
                player.GiveItem(item);
            }
    I am still very new at this and am trying to learn simple methods by making small changes to already existing plugins - if anyone has any other learning techniques, they would be greatly appreciated!

    Cheers!
     
  2. If you are getting that error it means you haven't set the variable "player".
     
  3. I've tried that but it's still giving me errors? :/
     
  4. Wulf

    Wulf Community Admin

    You'd need to provide more details; such as the actual errors and code portions where erroring.
     
  5. I may be mistaken on where to put the variable "player", would this go something like this "void OnPlayerInput(BasePlayer player, InputState input, player);"

    I know this is a complete novice question, we've all got to start somewhere though sadly haha!
     
  6. Wulf

    Wulf Community Admin

    The "player" in your example would come from that hook. It has to come from somewhere, an in that case that hook OnPlayerInput is called by Oxide and the arguments for that hook (you can't just toss anything in here) is where you'd get some of what can be used inside the hook. So if you used OnPlayerInput with those arguments, then "player" would be accessible inside of it as that is the name of the variable there.
     
  7. Where can I find the hooks that are compatible with oxide, rust and unity?
     
  8. Wulf

    Wulf Community Admin

    "Hooks" are what Oxide provides and can all be found under our Docs at the top of the page; they are not from Rust or Unity.