Jump to content

Deleting player corpses after death


smajt

Recommended Posts

Hi, im trying to delete player corpses after they die.
i tried many ways to delete player corpses but it only disappeared to the time i respawned.
now im trying something like this
 

function RemovePlayers(_object)
    local corpse = _object
    if corpse and instanceof(corpse, "IsoDeadBody") then
        local corpseinv=corpse:getContainer()
        local items=corpseinv:getItems()
        local corsquare=corpse:getSquare()
        local itemsarrey={}
        if items then
            for i=1,items:size() do
                local item = items:get(i-1)
                table.insert(itemsarrey,item)
                
            end
        end

        for i=1,#itemsarrey do
            corsquare:AddWorldInventoryItem(itemsarrey[i], ZombRandFloat(0, 0.99), ZombRandFloat(0, 0.99), 0);
            corpseinv:Remove(itemsarrey[i])
        
        end

        corsquare:removeCorpse(corpse, false)
    end
end

Events.OnContainerUpdate.Add(RemovePlayers)

before i was trying to do it in onPlayerDeath event but then it didnt find player body.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...