Hook clarificationSolved

I appreciate this is still in development and that a large part of the game is P2P so what we can do is limited, but I wanted to just clarify the situation with hooks.

I can see that a number of them have been added and I was wondering whether all of these are confirmed/expected to be working right now? I'm having my plugin simply output a message to test some of them but it doesn't appear to be called - so far only the connected/disconnected hooks are being triggered.

Which hook are you trying to test exactly?

For example:

OnDoorUsed(Door door, Humanoid character) - Expected: called when a player opens a door. Result: no call
OnItemAddedToInventory(List<ItemDrop.ItemData> inventory, ItemDrop.ItemData item) - Expected: called when an item is added to a players inventory. Result: no call
OnSmelterSmelt(Smelter smelter, Smelter.ItemConversion conversion, int stack) - Expected: called when an item is output from a Smelter. Result: no call
OnCritterSpawn(UnityEngine.GameObject gameobj) - Expected: called when a monster spawns. Result: no call
OnPlayerConnected(ZNetPeer peer) - Expected: called when a player connects to the server. Result - called
OnPlayerDisconnected(ZNetPeer peer) - Expected: called when a player disconnects from the server. Result - called

And simply using ZLog to output a message when its called (i.e. ZLog.Log("OnSmelterSmelt");).

The first 4 should not have been added, they were added by one of our team members that wasn't aware those were hooked in client code.

Yep, no problem, as suspected. Thanks for the clarification.

Hi, is there a list of current hooks that I can use. I can see the ones you said would work above are not there and are slightly different from the hooks mentioned in the docs.

Example, uMod equiv to

void OnUserConnected(IPlayer player)
{
    Puts($"{player.Name} ({player.Id}) connected from {player.Address}");

    if (player.IsAdmin)
    {
        Puts($"{player.Name} ({player.Id}) is admin");
    }

    Puts($"{player.Name} is {(player.IsBanned ? "banned" : "not banned")}");

    server.Broadcast($"Welcome {player.Name} to {server.Name}!");
}​

 

7yp6m7JohhsaCC3.jpg markmozza

Hi, is there a list of current hooks that I can use. I can see the ones you said would work above are not there and are slightly different from the hooks mentioned in the docs.

Example, uMod equiv to

void OnUserConnected(IPlayer player)
{
    Puts($"{player.Name} ({player.Id}) connected from {player.Address}");

    if (player.IsAdmin)
    {
        Puts($"{player.Name} ({player.Id}) is admin");
    }

    Puts($"{player.Name} is {(player.IsBanned ? "banned" : "not banned")}");

    server.Broadcast($"Welcome {player.Name} to {server.Name}!");
}​

https://umod.org/guides/games/valheim-hooks

What is in the Docs applies to Oxide, not uMod. All OnUser* hooks are replaced with OnPlayer*.
9TY9f32Zn6zidA5.jpg markmozza

Link is dead.

Try now.

Wow! Way more like it :D cheers

Could you please update the link, otherwise it doesn't work

CryZeR
Is it possible to check for the use of console commands? Let's say a person tries to enter a command using F5
Not really, only for about 4 commands that the server actually receives.

Is it possible to do this in the future? Or is it only handled on the client side of the game? And then cheaters spoil the game very much

Locked automatically