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;
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!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); }
Cheers!
Need some help modifying a few plugins
Discussion in 'Rust Development' started by ThatGuy 8, Feb 21, 2018.
-
If you are getting that error it means you haven't set the variable "player".
-
-
Wulf Community Admin
-
I know this is a complete novice question, we've all got to start somewhere though sadly haha! -
Wulf Community Admin
-
-
Wulf Community Admin