Health doesn't decrease
#1

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.
Reply
#2

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.
Reply
#3

Код:
GetPlayerHealth(playerid,health);
if(health != Player[playerid][Health])
{
	Player[playerid][Health] = health;
}
Reply
#4

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.
Reply
#5

OnPlayerUpdate?
it call every secon i think
Reply
#6

Yeah, that fixed it, thanks. I was thinking of a more complicated way, but I guess this simple change worked.
Reply
#7

fine,
you must first get the hp "GetPlayerHealth(playerid,health);"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)