Bleeding system
#1

Here's my code. and my problem I'm having is, when some players log in, it will say "You are bleeding!" and then kill them. Doesn't make any sense to me. So maybe one of you guys can help.

pawn Код:
new string[256];
    for(new j = 0; j<MAX_PLAYERS; j++)
    {
        if(IsPlayerConnected(j))
        {
            if(PlayerInfo[j][pToughPerk] == 1 && PlayerInfo[j][pAdmin] == 0)
            {
                if(gPlayerLogged[j] == 1)
                {
                    new Float:health;
                    GetPlayerHealth(j, health);
                    if(health < 45)
                    {
                        GetPlayerHealth(j, health);
                        SetPlayerHealth(j, health - 5.0);
                        SendClientMessage(j, COLOR_RED, "You are bleeding!");
                    }
                }
            }
            else if(PlayerInfo[j][pToughPerk] == 2 && PlayerInfo[j][pAdmin] == 0)
            {
                if(gPlayerLogged[j] == 1)
                {
                    new Float:health;
                    GetPlayerHealth(j, health);
                    if(health < 35)
                    {
                        GetPlayerHealth(j, health);
                        SetPlayerHealth(j, health - 3.0);
                        SendClientMessage(j, COLOR_RED, "You are bleeding!");
                    }
                }
            }
            else if(PlayerInfo[j][pToughPerk] == 3 && PlayerInfo[j][pAdmin] == 0)
            {
                if(gPlayerLogged[j] == 1)
                {
                    new Float:health;
                    GetPlayerHealth(j, health);
                    if(health < 25)
                    {
                        GetPlayerHealth(j, health);
                        SetPlayerHealth(j, health - 2.0);
                        SendClientMessage(j, COLOR_RED, "You are bleeding!");
                    }
                }
            }
            else
            {
                if(gPlayerLogged[j] == 1 && PlayerInfo[j][pAdmin] == 0)
                {
                    new Float:health;
                    GetPlayerHealth(j, health);
                    if(health < 55)
                    {
                        GetPlayerHealth(j, health);
                        SetPlayerHealth(j, health - 7.0);
                        SendClientMessage(j, COLOR_RED, "You are bleeding!");
                    }
                }
            }
Reply
#2

SetPlayerHealth(j, health - 5.0);
This line will set the players health below 0 ,but i think you want it to take 5 HP away?
Reply
#3

No the line won't cause he gets the playerhealth .
Reply
#4

1. Try to put'em together like SetPlayerHealth(j,health-7);
2. Show us your SetTimer(ex) line, how fast is your timer going?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)