Need to freeze player's Z while allowing clearpedtasks

Hi there guys,

We originally had an issue where dead players would be invisible to players coming into the area(ems roleplayers) so we put clearpedtasks on a 20 sec loop for the dead player which solved that issue.

It created a new issue however. Some players are falling through the map because of clearpedtasks (it’s a well known exploit that you can emote your way through walls and I think this is the same.)

Is there some native I can use to freeze a players z coord and keep them from going through the map while still allowing the ped to be able to clearpedtasks so they don’t go invisible?

Thoughts are welcome!

Have tried this one

https://runtime.fivem.net/doc/natives/#_0x428CA6DBD1094446
?

I did find that but was wary of using because of the ultra-helpful comment attached to it:

No, this should be called SET_ENTITY_KINEMATIC. It does more than just “freeze” it’s position.
^Rockstar Devs named it like that, Now cry about it.

It’s very hard to know what it does and I’m having problems finding it used elsewhere to gain any useful information from it.

There is no troubles with this native, it work fine when the player is alive, it just freeze the position not the ped body, so the player can move as normal but can’t go anywhere(look bad).But with a dead body it should do exactly what you need.

hey im new to all this how do I set players to clearpedtasks on a loop when they die