OnPlayerLootActor
A player wants to search a dead actor’s or animal’s body - return false to refuse.
Fires for a body that holds what the mode put on it (SetActorLoot) when a player within reach uses the game’s loot
prompt on it. Nothing has opened yet. Return false and nothing opens, without a word; return a text after the false
and their chat shows it (return false, "The hunter's mark is on it."). Otherwise the game’s own search screen opens on the
body’s list, and what they take is theirs (the list loses it). One player searches a body at a time.
Syntax
Section titled “Syntax”function OnPlayerLootActor(pid, id) -- ...end| Parameter | Type | |
|---|---|---|
pid |
number | the player |
id |
number | the dead actor or animal |
Returns
Section titled “Returns”false refuses saying nothing, false, "text" refuses and tells the player that text; anything else lets them search
Example
Section titled “Example”-- only the hunter who brought the deer down may skin itfunction OnActorDeath(id, killer) if killer >= 0 then SetEntityData(id, "hunter", killer) endendfunction OnPlayerLootActor(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”SetActorLoot · GetActorLoot · OnActorDeath · the NPC actors group of the index
