PDA

View Full Version : Few questions about life (JK I mean OnplayerDeath)


TokicMajstor
29/03/2019, 11:07 PM
Just to ask few questions:
1. When player dies, on most od servers, he falls of floor like animation for falling, and that should be default thing. But on my server when player dies he can walk for like 2 seconds with 0 hp and then OnPlayerSpawn is called. How can I fix that, a should there be too the "blood pool" or dead pool on the place where he dies, because there isn't anything. Is fixes.inc fixing that, I think it is but not sure-- but why that needs to be fixed if it's in samp default
2. Why, sometimes, very rarely, but still happens, when player dies he spawns in grove street with cigarette and bottle in his hands, and he gets CJ running style?

NaS
30/03/2019, 12:08 AM
Do you set any animation in OnPlayerDeath? From my experience that can lead to the issues you described.
Most servers that have a custom dying animation don't actually let the player die, they basically just freeze them and apply an anim, then use a timer for respawning (health is completely server sided in that case).
Not sure about fixes.inc, but you could try weapon-config which also does that.

solstice_
30/03/2019, 12:34 AM
Most servers that have a custom dying animation don't actually let the player die, they basically just freeze them and apply an anim, then use a timer for respawning (health is completely server sided in that case).

Yeah, and a lot of servers don't even use OnPlayerDeath for their death system. They are maybe just applying an animation OnPlayerTakeDamage when their health is like 4, which I did on my server.

JesterlJoker
30/03/2019, 11:26 AM
but you could try weapon-config which also does that.
I agree with NaS, and also you can use
OnPlayerStateChange (https://wiki.sa-mp.com/wiki/OnPlayerStateChange) can also be manipulated using

if(newstate == PLAYER_STATE_WASTED){
// Your code here

It just needs some tweaking, I used this before along with OnPlayerDeath and OnPlayerSpawn... I just can't remember how I made it work.. Since now I'm already learning how to use weapon-config OnDeath something

Sasino97
30/03/2019, 09:01 PM
In addition to what others said, I want to mention that some previous systems consisted in letting the player die normally, then respawn in their death position with a frozen injurrd animation.