17.02.2019, 18:42
I have a personalized health bar, the question is: What callback should I use to update the new bar? 'OnPlayerUpdate', 'OnPlayerTakeDamage' or 'OnPlayerGiveDmage'?
//OnPlayerConnect
Player_Info[playerid][player_Health] = 100.0;
SetPlayerHealth(playerid, Player_Info[playerid][player_Health]);
//OnPlayerTakeDamage
Player_Info[playerid][player_Health] -= amount;
if(Player_Info[playerid][player_Health] <= 0.0)
{
SetPlayerHealth(playerid, 0.0);
}
//Command /kill
CMD:kill(playerid, params[])
{
Player_Info[playerid][player_Health] = 0.0;
SetPlayerHealth(playerid, Player_Info[playerid][player_Health]);
return 1;
}
//Command /health
CMD:health(playerid, params[])
{
if(sscanf(params, "df", params[0], params[1])) return SendClientMessage(playerid,-1, "/health <playerid> <health>");
Player_Info[params[0]][player_Health] = params[1];
SetPlayerHealth(params[0], params[1]);
return 1;
}