14.06.2017, 18:25
Why is this running both of the modes immediately? It should put him in BrutalM, and then when he takes damage again it should put him in Dead.
PHP Code:
public OnPlayerDamage(&playerid, &Float:amount, &issuerid, &weapon, &bodypart)
{
new DeathB;
new DeathS[128];
new Float:PlayerHealth;
GetPlayerHealth(playerid, PlayerHealth);
if(amount > PlayerHealth) {
SetPlayerHealth(playerid, 16);
return 0;
}
if (PlayerHealth - amount <= 15)
{
if(Character[playerid][BrutalM] == 0 && issuerid != INVALID_PLAYER_ID)
{
SetTimerEx("BrutalMDamageTimer",10000,1,"i",playerid);
GetPlayerPos(playerid, BMPos[playerid][0], BMPos[playerid][1], BMPos[playerid][2]);
God[playerid] = 1;
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);
if(Character[playerid][Level] <= 10)
{
DeathB = RandomEx(100, 500);
GivePlayerMoney(playerid, -DeathB);
format(DeathS, sizeof(DeathS), "EMT: Your Medical bills are $%i.", DeathB);
SCM(playerid, COLOR_LIGHTPINK, DeathS);
SCM(playerid, COLOR_LIGHTRED, "You were brutally wounded, now if a medic or anyone else doesn't save you, you'll die.");
SCM(playerid, COLOR_LIGHTRED, "To accept death type /acceptdeath");
}
else if(Character[playerid][Level] <= 20 && Character[playerid][Level] > 10)
{
DeathB = RandomEx(100, 750);
GivePlayerMoney(playerid, -DeathB);
format(DeathS, sizeof(DeathS), "EMT: Your Medical bills are $%i.", DeathB);
SCM(playerid, COLOR_LIGHTPINK, DeathS);
SCM(playerid, COLOR_LIGHTRED, "You were brutally wounded, now if a medic or anyone else doesn't save you, you'll die.");
SCM(playerid, COLOR_LIGHTRED, "To accept death type /acceptdeath");
}
else if(Character[playerid][Level] <= 30 && Character[playerid][Level] > 20)
{
DeathB = RandomEx(100, 1250);
GivePlayerMoney(playerid, -DeathB);
format(DeathS, sizeof(DeathS), "EMT: Your Medical bills are $%i.", DeathB);
SCM(playerid, COLOR_LIGHTPINK, DeathS);
SCM(playerid, COLOR_LIGHTRED, "You were brutally wounded, now if a medic or anyone else doesn't save you, you'll die.");
SCM(playerid, COLOR_LIGHTRED, "To accept death type /acceptdeath");
}
else if(Character[playerid][Level] > 30)
{
DeathB = RandomEx(100, 1500);
GivePlayerMoney(playerid, -DeathB);
format(DeathS, sizeof(DeathS), "EMT: Your Medical bills are $%i.", DeathB);
SCM(playerid, COLOR_LIGHTPINK, DeathS);
SCM(playerid, COLOR_LIGHTRED, "You were brutally wounded, now if a medic or anyone else doesn't save you, you'll die.");
SCM(playerid, COLOR_LIGHTRED, "To accept death type /acceptdeath");
return 0;
}
}
else if(Character[playerid][BrutalM] == 1 && issuerid != INVALID_PLAYER_ID) // Here is where he should take damage to go into dead mode
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);
}