Injury system, not working, OnPlayerTakeDamage. -
Dokins - 15.09.2016
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.
Re: Injury system, not working, OnPlayerTakeDamage. -
GoldenLion - 15.09.2016
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.
Re: Injury system, not working, OnPlayerTakeDamage. -
Dokins - 15.09.2016
Going to revert to OnPlayerUpdate.
Re: Injury system, not working, OnPlayerTakeDamage. -
Shinja - 15.09.2016
Very bad idea
PHP код:
Health -= amout;
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;
}