SA-MP Forums Archive
OnPlayerSpawn - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP (https://sampforum.blast.hk/forumdisplay.php?fid=3)
+--- Forum: Bug Reports (https://sampforum.blast.hk/forumdisplay.php?fid=20)
+--- Thread: OnPlayerSpawn (/showthread.php?tid=275220)



OnPlayerSpawn - Macluawn - 08.08.2011

in OnPlayerSpawn callback, getplayerhealth returns 0


Re: OnPlayerSpawn - Karagon - 08.08.2011

Maybe it's because it's called in such a fast way that health isn't really registered? I'll run some tests when I get the time later today to see.... But, as far as I know, You just spawned. Health might not have had time to set. (The float in the script)

Edit:

I did it, running a timer for 100 milliseconds. On the time of spawn, the player's health is in fact, 0. But, soon after, it's 100. SA-MP bug, :P

Code:
[17:50:43] Health: 0.000000
[17:50:43] Health: 0.000000
[17:50:43] Health: 0.000000
[17:50:43] Health: 0.000000
[17:50:43] Health: 0.000000
[17:50:44] Health: 0.000000
[17:50:44] Health: 0.000000
[17:50:44] Health: 0.000000
[17:50:44] Health: 0.000000
[17:50:44] Health: 0.000000
[17:50:44] Health: 0.000000
[17:50:44] Health: 0.000000
[17:50:44] Health: 0.000000
[17:50:44] Health: 0.000000
[17:50:45] Health: 0.000000
[17:50:45] Health: 0.000000
[17:50:45] Health: 0.000000
[17:50:45] Health: 0.000000
[17:50:45] Health: 0.000000
[17:50:45] Health: 0.000000
[17:50:46] Health: 0.000000
[17:50:46] Health: 0.000000
[17:50:46] Spawned 


[17:50:46] Health: 100.000000
[17:50:46] Health: 100.000000