health bar
#1

I have a personalized health bar, the question is: What callback should I use to update the new bar? 'OnPlayerUpdate', 'OnPlayerTakeDamage' or 'OnPlayerGiveDmage'?
Reply
#2

OnPlayerTakeDamage
Reply
#3

Quote:
Originally Posted by Kasichok
Посмотреть сообщение
OnPlayerTakeDamage
When a player falls from a height and is injured or explodes with the '/ burn' command, is the callback also called?
Reply
#4

Quote:
Originally Posted by Volumen
Посмотреть сообщение
When a player falls from a height and is injured or explodes with the '/ burn' command, is the callback also called?
Yes, it is.
Reply
#5

By the way, should you set some variable on the server side to store the health of each player, and avoid the cheaters?

Something like this:

PHP код:
//OnPlayerConnect
Player_Info[playerid][player_Health] = 100.0;
SetPlayerHealth(playeridPlayer_Info[playerid][player_Health]);
//OnPlayerTakeDamage
Player_Info[playerid][player_Health] -= amount;
if(
Player_Info[playerid][player_Health] <= 0.0)
{
SetPlayerHealth(playerid0.0);
}
//Command /kill
CMD:kill(playeridparams[])
{
        
Player_Info[playerid][player_Health] = 0.0;
    
SetPlayerHealth(playeridPlayer_Info[playerid][player_Health]);
    return 
1;
}
//Command /health
CMD:health(playeridparams[])
{
    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;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)