Health doesn't decrease - 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)
+--- Thread: Health doesn't decrease (
/showthread.php?tid=378622)
Health doesn't decrease -
HighFlyer - 18.09.2012
Hi there,
I have made a Health field in a MySQL database to store player's health. However, once it's loaded, and when player's health should go down, it doesn't - or at least the healthbar textdraw returns to full.
I have this OnPlayerUpdate:
Код:
if(health != Player[playerid][Health])
{
SetPlayerHealth(playerid, Player[playerid][Health]);
}
The rest of the health defines just load it and make it a 100 whenever required, for instance on HospitalRelease.
Re: Health doesn't decrease -
ProjectGANTON - 18.09.2012
You have to do that when a player lost hp, these will be updated on [Health].
Else the player health will be [Health] for ever.
AW: Health doesn't decrease -
s3rserii - 18.09.2012
Код:
GetPlayerHealth(playerid,health);
if(health != Player[playerid][Health])
{
Player[playerid][Health] = health;
}
Re: Health doesn't decrease -
HighFlyer - 18.09.2012
Which callback would be the best for this kind of stuff? OnPlayerTakeDamage? :P
EDIT: Didn't see your post s3rserii, I'll try that, cheers.
AW: Health doesn't decrease -
s3rserii - 18.09.2012
OnPlayerUpdate?
it call every secon i think
Re: Health doesn't decrease -
HighFlyer - 18.09.2012
Yeah, that fixed it, thanks. I was thinking of a more complicated way, but I guess this simple change worked.
AW: Health doesn't decrease -
s3rserii - 18.09.2012
fine,
you must first get the hp "GetPlayerHealth(playerid,health);"