Injury system, not working, OnPlayerTakeDamage.
#1

Nothing happens until the player reaches 0 hp.
pawn Код:
if(LoggedIn[playerid] == 1 && Health <= 35 && KnockedOut[playerid] == 0 && GetPlayerState(playerid) != 9)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            RemovePlayerFromVehicle(playerid);
            ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0,1);
            TogglePlayerControllable(playerid, 0);
        }
            KnockedOut[playerid] = 1;
        TogglePlayerControllable(playerid, 0);
            ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0,1);
        SendClientMessage(playerid, COLOUR_REALRED, "You have been knocked out, unless someone revives you, you may die.");
        format(string, sizeof(string), "* %s has lost consciousness due to their injuries *", GetNameEx(playerid));
        ProxDetector(30.0, playerid, string, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE);
        return 1;
    }
Under OnPlayerTakeDamage.
Reply
#2

What about OnPlayerUpdate? Also if you get player's health under OnPlayerTakeDamage, then it will get the health before the default damage will be applied so it will only work right now if you are below 35 health and get shot from a weapon with a low damage.
Reply
#3

Going to revert to OnPlayerUpdate.
Reply
#4

Very bad idea
PHP код:
Health -= amout;
if(
LoggedIn[playerid] == && Health <= 35 && KnockedOut[playerid] == && GetPlayerState(playerid) != 9)
    {
        if(
IsPlayerInAnyVehicle(playerid))
        {
            
RemovePlayerFromVehicle(playerid);
              
ApplyAnimation(playerid"CRACK""crckdeth2"4.010000,1);
              
TogglePlayerControllable(playerid0);
        }
            
KnockedOut[playerid] = 1;
        
TogglePlayerControllable(playerid0);
            
ApplyAnimation(playerid"CRACK""crckdeth2"4.010000,1);
        
SendClientMessage(playeridCOLOUR_REALRED"You have been knocked out, unless someone revives you, you may die.");
        
format(stringsizeof(string), "* %s has lost consciousness due to their injuries *"GetNameEx(playerid));
        
ProxDetector(30.0playeridstringCOLOUR_PURPLECOLOUR_PURPLECOLOUR_PURPLECOLOUR_PURPLECOLOUR_PURPLE);
        return 
1;
    } 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)