SA-MP Forums Archive
How to make players health decrease by 10 - 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: How to make players health decrease by 10 (/showthread.php?tid=363581)



How to make players health decrease by 10 - ShawtyyMacJunior - 28.07.2012

I dont want to setplayers health to 10 i want it to reduce by 10 if they pickup a pickup. How could i do that


Re: How to make players health decrease by 10 - Larceny - 28.07.2012

pawn Код:
//OnPlayerPickupPickUp
{
    new Float:fHealth;
    GetPlayerHealth(playerid, fHealth);
    SetPlayerHealth(playerid, fHealth - 10);
}



Re: How to make players health decrease by 10 - SuperViper - 28.07.2012

pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == THE_ID_OF_YOUR_PICKUP)
    {
        new Float: playersHealth;
        GetPlayerHealth(playerid, playersHealth);
        SetPlayerHealth(playerid, playersHealth - 10);
    }

    return 1;
}