13.06.2017, 23:52
So, when a players health is equal to or less than 25 and he takes damage - he will be put into Brutal M mode. Brutal M is the first stage of the death.
The second stage is dead mode, which when a player is in BrutalM mode and he takes damage again - he will go into Dead mode.
The issue is, if a player is being shot at by an M4/AK (automatic weapons), when he goes into BrutalM mode he will instantly go into Dead mode due to the fact he is being sprayed at. I was wondering if it's possible to maybe add a timer, or even a way to prevent the player taking damage for about 5 seconds. Thanks in advanced.
PHP код:
public OnPlayerDamage(&playerid, &Float:amount, &issuerid, &weapon, &bodypart)
{
new DeathB;
new DeathS[128];
new Float:PlayerHealth;
GetPlayerHealth(playerid, PlayerHealth);
if(amount > PlayerHealth) {
SetPlayerHealth(playerid, 24);
return 0;
}
if (PlayerHealth - amount <= 25)
{
if(Character[playerid][BrutalM] == 0)
{
GetPlayerPos(playerid, BMPos[playerid][0], BMPos[playerid][1], BMPos[playerid][2]);
Character[playerid][BrutalM] = 1;
Character[playerid][CanAccept] = 0;
LegHit[playerid] = 0;
format(DTextS, sizeof(DTextS), "(( %s is currently injured, type /damages %i for more info. ))", GetName(playerid), playerid);
label[playerid] = Create3DTextLabel(DTextS, COLOR_RED, BMPos[playerid][0], BMPos[playerid][1], BMPos[playerid][2], 10.0, 0);
Attach3DTextLabelToPlayer(label[playerid], playerid, 0, 0, 0.7);
PHP код:
if(Character[playerid][BrutalM] == 1)
GetPlayerPos(playerid, DPos2[playerid][0], DPos2[playerid][1], DPos2[playerid][2]);
Delete3DTextLabel(label[playerid]);
label2[playerid] = Create3DTextLabel("(( THIS PLAYER IS NOW DEAD ))", COLOR_RED, DPos2[playerid][0], DPos2[playerid][1], DPos2[playerid][2], 10.0, 0);
Attach3DTextLabelToPlayer(label2[playerid], playerid, 0, 0, 0.7);
Character[playerid][Dead] = 1;
Character[playerid][BrutalM] = 0;
SCM(playerid, COLOR_YELLOW, ">> You are now dead. You can use /respawnme after 60 seconds to respawn.");
Character[playerid][CanSpawn] = 0;
KillTimer(DeathT);
RespawnT = 60;
RespawnEx = SetTimer("RespawnTimer", 999, true);
RTimer = SetTimerEx("RespawnTimer2", 60000, false, "i", playerid);
}