Skip to content

Using setElementHealth on a dead ped makes it invincible #414

@ArranTuna

Description

@ArranTuna

Describe the bug
The only way to respawn a ped is with setElementHealth, yet after calling setElementHealth on a dead ped, the server returns true for isPedDead. You can't damage the ped any more even though ped.health == 100.

To Reproduce

crun setElementPosition(localPlayer, 1968, -2033, 13)
srun a = createPed(0, 1967, -2025, 13)
-- Kill the ped
srun isPedDead(a) -- true
srun setElementHealth(a, 100)
srun isPedDead(a) -- true (should be false)
-- Shoot the ped, it won't take damage

Expected behaviour
@qaisjp said:

Setting the health of a ped to a health > 0 should respawn the ped.

Additional context
Do this after calling setElementHealth: setElementSyncer(a, true) and the ped will be able to take damage again, but onPedWasted isn't triggered.

From https://bugs.mtasa.com/view.php?id=8790

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingsync

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions