Skip to content

EmptyPlayerInventory

Takes every item the player holds - or all but what they wear.

SetPlayerInventory with an empty list: everything the records hold of the player’s bag is taken. With keepWorn the clothing, armour and weapons they wear (GetPlayerEquipment) stay on them and only the rest goes. The money stays - take it with GivePlayerMoney (GivePlayerMoney(pid, -GetPlayerMoney(pid))).

EmptyPlayerInventory(pid [, keepWorn])
Parameter Type
pid number the player
keepWorn boolean true leaves what they wear on them (optional)

boolean - false when not connected

-- a hardcore server: everything stays on the corpse, the player comes back with nothing
function OnPlayerCorpse(pid, corpse)
SetCorpseItems(corpse, GetPlayerInventory(pid))
EmptyPlayerInventory(pid)
GivePlayerMoney(pid, -GetPlayerMoney(pid))
end

SetPlayerInventory · OnPlayerCorpse · GivePlayerMoney · the Items and inventory group of the index