I was wondering if someone could create a plugin that scans players action bars and backpack upon disconnection, notifying through a custom admin message if they logged out with det caps and/or C4?
The message would be something like "player" just logged out with their Det Caps/C4.....What a DOUCHE!!!
Hurtworld Inventory scanning and alerts
Discussion in 'Plugin Requests' started by Sans 2, Mar 17, 2016.
-
Just Iterate through the Inventory of the player session with the OnPlayerDisconnected hook.
-
Unfortunately I have no idea how to even start to create a plugin
-
If you just want it to give a notification, just break the for() loop when it finds what you are looking for.
Using the OnPlayerDisconnected hook is simple. Something like:
Code:void OnPlayerDisconnected(PlayerSession session) { PlayerInventory inv = session.WorldPlayerEntity.GetComponent<PlayerInventory>(); for (var i = 0; i < inv.Items.Length; i++) { if (inv.Items[i] != null) { if(inv.Items[i].Item.ItemId == 144 || inv.Items[i].Item.ItemId == 231) { hurt.BroadcastChat(session.Name+" has Disconnected with C4/Detonator Caps!"); break; } } } }
-
um......That looks wonderful and all, but how do I actually make that work on the server, I don't know how to create the plugin itself
-
I can make it for you. You only need it to display the message?
-
OMG that would be so awesome! I only need it to display the message "player" just logged out with their DetCaps/C4....What a DOUCHE!
-
Since there was a C4Logger for Hurtworld | Oxide already, I edited it instead of making a new plugin for now. I sent you by PM.
If you wish a real Inventory Scanner and Alert for any type of item, tell me. -
Just put that code I wrote into a clean plugin, or existing one. It's all there.
Here. Save this as"DCCheck.cs" and put it in your Plugins folder.
I'm fine with anyone using this code for any plugins.
Code:// Reference: UnityEngine.UI using System; using UnityEngine; namespace Oxide.Plugins { [Info("DCCheck", "Noviets", "1.0.0")] class DCCheck : HurtworldPlugin { void OnPlayerDisconnected(PlayerSession session) { PlayerInventory inv = session.WorldPlayerEntity.GetComponent<PlayerInventory>(); for (var i = 0; i < inv.Items.Length; i++) { if (inv.Items[i] != null) { if(inv.Items[i].Item.ItemId == 144 || inv.Items[i].Item.ItemId == 231) { hurt.BroadcastChat(session.Name+" just logged out with their DetCaps/C4....What a DOUCHE"); break; } } } } } }
-
Wulf Community Admin