I'm in the process of making a plugin that requires players to read a note, if they read the note, I want to get it's contents, if the contents contain a substring, I want to execute a command, delete the note, and a bunch of other stuff.
I've used the search function, looked over the docs, and found nothing
1. Is it possible to catch when a player is spectating a note?
2. Is it possible to get the contents of the note they are spectating?
Solved Detecting when a player reads a note?
Discussion in 'Rust Development' started by sheepiiHD, Apr 13, 2018.
-
I don't think there is a way to detect when player opens a note, as for reading it, I would use this
Code:[ChatCommand("note")] void noteCMD(BasePlayer player, string command, string[] args) { if (!player.IsAdmin) return; var item = player.GetActiveItem(); if (item == null) return; if (item.info.shortname != "note") { SendReply(player, "Item is not a note"); return; } string text = (string.IsNullOrEmpty(item.text) ? "No text in note" : item.text); SendReply(player, "Text in note: " + text); }
-
Oxide API for Rust
Maybe this has something to do with it.
First you validate it, to make sure it's a note, then you signify an action? -
-
Ah, sorry. I'm new to Rust development. I think what I'm going to do is initiate it on OnItemRemovedFromContainer and OnItemPickup. Thank you