SA-MP Forums Archive
OnPlayerDeath bug? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: OnPlayerDeath bug? (/showthread.php?tid=122075)



OnPlayerDeath bug? - Jason321 - 20.01.2010

Hey guys, usually when I encounter a problem I am able to search and find the answer. However, I have searched for a while on how to fix this and none of the search results have helped me My problem is that when a player is killed, he appears to remain alive or "stuck" on very low health. The player appears dead to the players around them but their body will be stuck on the ground. The following video demonstrates my problem.

[url=http://www.youtube.com/watch?v=FWpxUeEUjTQ]

Here's my OnPlayerDeath if that helps.

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
       SendDeathMessage(killerid, playerid, reason);
       return 1;
}
So what exactly is causing this problem? I'm grateful for any help and advice offered, thanks


Re: OnPlayerDeath bug? - [HiC]TheKiller - 20.01.2010

You sure it's not a filterscript? Also, debug it and see if the players health is actually 0.


Re: OnPlayerDeath bug? - KnooL - 20.01.2010

Do you use something that edits the weapon damage ? Cause I saw it on our server with the same bug.


Re: OnPlayerDeath bug? - Jason321 - 20.01.2010

Are you saying a filterscript could be causing the issue? I did some tests without having any filterscripts loaded and I still have this problem. I'm sorry but could you explain further what you mean by this?
Quote:

Also, debug it and see if the players health is actually 0.

Quote:
Originally Posted by KnooL
Do you use something that edits the weapon damage ? Cause I saw it on our server with the same bug.
As far as I know, nope.


Re: OnPlayerDeath bug? - KnooL - 20.01.2010

Quote:
Originally Posted by Jason321
Are you saying a filterscript could be causing the issue? I did some tests without having any filterscripts loaded and I still have this problem. I'm sorry but could you explain further what you mean by this?
Quote:

Also, debug it and see if the players health is actually 0.

Quote:
Originally Posted by KnooL
Do you use something that edits the weapon damage ? Cause I saw it on our server with the same bug.
As far as I know, nope.
pawn Код:
Float:Health
GetPlayerHealth(playerid,health);
printf("[ID:%d] has %d health left on death",playerid,health);
I don't know if this works, I'm not a pro scripter though


Re: OnPlayerDeath bug? - Correlli - 20.01.2010

Quote:
Originally Posted by KnooL
pawn Код:
Float:Health
GetPlayerHealth(playerid,health);
printf("[ID:%d] has %d health left on death",playerid,health);
I don't know if this works, I'm not a pro scripter though
health is a float value, so you should use %f, not %d

pawn Код:
new
    Float:health;
GetPlayerHealth(playerid, health);
printf("[ID:%i] has %f health left on death", playerid, health);



Re: OnPlayerDeath bug? - [HiC]TheKiller - 20.01.2010

Quote:
Originally Posted by Jason321
Are you saying a filterscript could be causing the issue? I did some tests without having any filterscripts loaded and I still have this problem. I'm sorry but could you explain further what you mean by this?
Quote:

Also, debug it and see if the players health is actually 0.

Quote:
Originally Posted by KnooL
Do you use something that edits the weapon damage ? Cause I saw it on our server with the same bug.
As far as I know, nope.
pawn Код:
public OnGameModeInit()
{
  SetTimer("HealthCheck", 1000, true);
}

forward HealthCheck();

public HealthCheck()
{
  new Float:Health;
  for(new i; i<MAX_PLAYERS; i++)
  {
    if(IsPlayerConnected(i))
    {
     
      GetPlayerHealth(i, Health);
      printf("ID: %d Health: %f", i, Health);
    }
  }
  return 1;
}
That would be good for debugging the players health, just check the console.


Re: OnPlayerDeath bug? - KnooL - 20.01.2010

why not on playerdeath?


Re: OnPlayerDeath bug? - [HiC]TheKiller - 20.01.2010

Quote:
Originally Posted by KnooL
why not on playerdeath?
Because the player may not even be dead?


Re: OnPlayerDeath bug? - Jason321 - 20.01.2010

Hey, thanks for all the comments and help guys, appreciate it so far. This is what the log tells me when the glitch occurs.

[16:39:30] ID: 1 Health: 1.000000