Not running damage
#1

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(playeridPlayerHealth);
    if(
amount PlayerHealth) {
    
SetPlayerHealth(playerid16);
    return 
0;
    }
    if (
PlayerHealth amount <= 15)
        {
        if(
Character[playerid][BrutalM] == && issuerid != INVALID_PLAYER_ID)
           {
            
SetTimerEx("BrutalMDamageTimer",10000,1,"i",playerid);
            
GetPlayerPos(playeridBMPos[playerid][0], BMPos[playerid][1], BMPos[playerid][2]);
            
God[playerid] = 1;
            
Character[playerid][BrutalM] = 1;
            
Character[playerid][CanAccept] = 0;
            
LegHit[playerid] = 0;
            
format(DTextSsizeof(DTextS), "(( %s is currently injured, type /damages %i for more info. ))"GetName(playerid), playerid);
            
label[playerid] = Create3DTextLabel(DTextSCOLOR_REDBMPos[playerid][0], BMPos[playerid][1], BMPos[playerid][2], 10.00);
            
Attach3DTextLabelToPlayer(label[playerid], playerid000.7);
            if(
Character[playerid][Level] <= 10)
            {
                
DeathB RandomEx(100500);
                
GivePlayerMoney(playerid, -DeathB);
                
format(DeathSsizeof(DeathS), "EMT: Your Medical bills are $%i."DeathB);
                
SCM(playeridCOLOR_LIGHTPINKDeathS);
                
SCM(playeridCOLOR_LIGHTRED"You were brutally wounded, now if a medic or anyone else doesn't save you, you'll die.");
                
SCM(playeridCOLOR_LIGHTRED"To accept death type /acceptdeath");
            }
            else if(
Character[playerid][Level] <= 20 && Character[playerid][Level] > 10)
            {
                
DeathB RandomEx(100750);
                
GivePlayerMoney(playerid, -DeathB);
                
format(DeathSsizeof(DeathS), "EMT: Your Medical bills are $%i."DeathB);
                
SCM(playeridCOLOR_LIGHTPINKDeathS);
                
SCM(playeridCOLOR_LIGHTRED"You were brutally wounded, now if a medic or anyone else doesn't save you, you'll die.");
                
SCM(playeridCOLOR_LIGHTRED"To accept death type /acceptdeath");
            }
            else if(
Character[playerid][Level] <= 30 && Character[playerid][Level] > 20
                 {
                
DeathB RandomEx(1001250);
                
GivePlayerMoney(playerid, -DeathB);
                
format(DeathSsizeof(DeathS), "EMT: Your Medical bills are $%i."DeathB);
                
SCM(playeridCOLOR_LIGHTPINKDeathS);
                
SCM(playeridCOLOR_LIGHTRED"You were brutally wounded, now if a medic or anyone else doesn't save you, you'll die.");
                
SCM(playeridCOLOR_LIGHTRED"To accept death type /acceptdeath");
            }
            else if(
Character[playerid][Level] > 30)
            {
                
DeathB RandomEx(1001500);
                
GivePlayerMoney(playerid, -DeathB);
                
format(DeathSsizeof(DeathS), "EMT: Your Medical bills are $%i."DeathB);
                
SCM(playeridCOLOR_LIGHTPINKDeathS);
                
SCM(playeridCOLOR_LIGHTRED"You were brutally wounded, now if a medic or anyone else doesn't save you, you'll die.");
                
SCM(playeridCOLOR_LIGHTRED"To accept death type /acceptdeath");
                return 
0;
            }
        }
            else if(
Character[playerid][BrutalM] == && issuerid != INVALID_PLAYER_ID// Here is where he should take damage to go into dead mode
                
GetPlayerPos(playeridDPos2[playerid][0], DPos2[playerid][1], DPos2[playerid][2]);
            
Delete3DTextLabel(label[playerid]);
            
label2[playerid] = Create3DTextLabel("(( THIS PLAYER IS NOW DEAD ))"COLOR_REDDPos2[playerid][0], DPos2[playerid][1], DPos2[playerid][2], 10.00);
            
Attach3DTextLabelToPlayer(label2[playerid], playerid000.7);
            
Character[playerid][Dead] = 1;
            
Character[playerid][BrutalM] = 0;
            
SCM(playeridCOLOR_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"999true);
            
RTimer SetTimerEx("RespawnTimer2"60000false"i"playerid);
    } 
Reply
#2

Why do you have like 4 different timers when you could do this easily?

You're just giving yourself more work.

http://forum.sa-mp.com/showthread.ph...80#post3890580
Why didn't this work?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)