SA-MP Forums Archive
SetPlayerHealth - 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: SetPlayerHealth (/showthread.php?tid=537049)



SetPlayerHealth - vannesenn - 13.09.2014

I saw one big bug in function 'SetPlayerHealth', I can't normally add Health...

Example

Code:
				new Float:_new_pHP = _REHEALTH_VALUE + _pHP;
				SetPlayerHealth(_playerid, _new_pHP);

				new Float:_n_pHP;
				GetPlayerHealth(_playerid, _n_pHP);
				va_SendClientMessage(_playerid, -1, "- Rehealthan si || Stari Health %.2f - Novi Health %.2f(Stvarni %.2f)", _pHP, _new_pHP, _n_pHP);
This code doesn't work, why?


Re: SetPlayerHealth - Pottus - 13.09.2014

My take on it is that the player needs to send an update before the server updates it's internal variable. Best thing to do in cases like this is create your own server sided variables.