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)
+--- Thread: Bleeding system (/showthread.php?tid=309597)



Bleeding system - viddo - 08.01.2012

Hello, i wanted to make the players loses health automatically after his hp goes under 20 who can help me with it?


Re: Bleeding system - viddo - 10.01.2012

any ideas?


Re: Bleeding system - Konstantinos - 10.01.2012

OnPlayerUpdate check player's health. If his health is under 20 set a timer, every 1 second set his health down
https://sampwiki.blast.hk/wiki/SetTimerEx


Re: Bleeding system - Shadoww5 - 10.01.2012

PHP код:
public OnGameModeInit()
{
    
SetTimer("LifeCheck"30000true);
    return 
1;
}

public 
LifeCheck()
{
    for(new 
iGetMaxPlayers(); i++)
    {
        if(
IsPlayerConnected(i))
        {
            new 
Float:health;
            
GetPlayerHealth(ihealth);
            
SetPlayerHealth(ihealth-1);
        }
    }
    return 
1;