SA-MP Forums Archive
Bleeding system - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Bleeding system (/showthread.php?tid=193457)



Bleeding system - Lars_Frederiksen - 26.11.2010

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!");
                    }
                }
            }



Re: Bleeding system - Siim - 26.11.2010

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?


Re: Bleeding system - 0ne - 26.11.2010

No the line won't cause he gets the playerhealth .


Re: Bleeding system - Mike Garber - 26.11.2010

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