[Solved] How can I get the name of the player who destucts a block?

Post Reply
Oltarus
New member
Posts: 4
Joined: Sat May 14, 2022 08:04
In-game: Oltarus

[Solved] How can I get the name of the player who destucts a block?

by Oltarus » Post

Hello!

For a mod I am creating, I need to know the name of the player that destructs a block (the block is part of the mod).

I thought that on_destruct or after_destruct would do the trick, but it only gives me the pos of the block, not informations about the player.

How can I know which player is destroying a block? If possible before it is destroyed.

Thanks in advance!
Last edited by Oltarus on Sat May 21, 2022 05:03, edited 1 time in total.

User avatar
Festus1965
Member
Posts: 4181
Joined: Sun Jan 03, 2016 11:58
GitHub: Festus1965
In-game: Festus1965 Thomas Thailand Explorer
Location: Thailand ChiangMai
Contact:

Re: How can I get the name of the player who destucts a block?

by Festus1965 » Post

when the block is already part of the mod

Code: Select all

minetest.register_node("", [ ...
add there inside a function on_dig ? asking for

Code: Select all

on_dig = function(pos, node, player)
so might get sure the right one ... did it
Human has no future (climate change)
If urgend, you find me in Roblox (as CNXThomas)

Oltarus
New member
Posts: 4
Joined: Sat May 14, 2022 08:04
In-game: Oltarus

Re: How can I get the name of the player who destucts a block?

by Oltarus » Post

I somehow missed on_dig (I'm new to moding). Thanks a lot!

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests