OnPlayerButcher
A player wants to butcher a dead animal - return false to refuse.
Fires when a player within reach holds the game’s “Butcher” on a carcass you made butcherable (SetActorButcher).
Nothing has happened yet. Return false and nothing happens, without a word; return a text after the false and their
chat shows it. Otherwise their game butchers it - the animation, then the game’s own meat to take from the carcass - and the
others see them at it.
Syntax
Section titled “Syntax”function OnPlayerButcher(pid, id) -- ...end| Parameter | Type | |
|---|---|---|
pid |
number | the player |
id |
number | the carcass |
Returns
Section titled “Returns”false refuses saying nothing, false, "text" refuses and tells the player that text; anything else lets them
Example
Section titled “Example”-- only the hunter who brought it down butchers itfunction OnActorDeath(id, killer) if killer >= 0 then SetEntityData(id, "hunter", killer) end SetActorButcher(id, true)endfunction OnPlayerButcher(pid, id) local hunter = GetEntityData(id, "hunter") if hunter and hunter ~= pid then return false, "This kill belongs to " .. GetPlayerName(hunter) .. "." endendSee also
Section titled “See also”SetActorButcher · IsActorButchered · OnPlayerLootActor · the NPC actors group of the index
