OnPlayerLootBody
A player wants to search a dead player’s body - return false to refuse.
Nothing has opened yet. Otherwise the game’s own loot window opens on what the dead player carries ([combat] loot_bodies:
everything, or everything but what they wear, and the purse) and whatever the searcher takes is gone from the dead player;
the respawn waits while the search is open. victim is -1 for a body that stayed after its player respawned and left the
server ([combat] corpse_seconds). With loot_bodies = "none" nobody is asked: bodies cannot be searched at all.
Syntax
Section titled “Syntax”function OnPlayerLootBody(pid, victim) -- ...end| Parameter | Type | |
|---|---|---|
pid |
number | the searcher |
victim |
number | whose body it is; -1 = its player has left |
Returns
Section titled “Returns”false refuses; anything else lets them search
Example
Section titled “Example”-- only the killer and the dead player's own team may search the bodylocal killers = {}function OnPlayerDeath(pid, attacker) killers[pid] = attacker endfunction OnPlayerLootBody(pid, victim) if victim < 0 then return true end return killers[victim] == pid or GetPlayerTeam(pid) == GetPlayerTeam(victim)endSee also
Section titled “See also”OnPlayerDeath · OnPlayerOpenContainer · OnPlayerCorpse · the Combat group of the index
