SA-MP Forums Archive
Player Protection. Like Protection when entering checkpoint. and interior. - 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: Player Protection. Like Protection when entering checkpoint. and interior. (/showthread.php?tid=72250)



Player Protection. Like Protection when entering checkpoint. and interior. - stevestelford - 07.04.2009

Heya Guys i want it so that players have protection only in 24/7 shops and Gun Shops. I have set
AllowInteriorWeapons(1); which allows but i want players to be protected too.

Also i wanted to know how to set protection when a player enters a checkpoint.

Cheers Guys.


Re: Player Protection. Like Protection when entering checkpoint. and interior. - miokie - 07.04.2009

Use a timer that resets your health to 100 or something every 500ms or so and use a area checker...


Re: Player Protection. Like Protection when entering checkpoint. and interior. - DaRealShazz - 08.06.2012

Don't use above method.

pawn Code:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
   
    if(GetPlayerInterior(playerid) != 0)
    {
        new Float:health;
        GetPlayerHealth(playerid,health);
        SetPlayerHealth(playerid, health+amount);
    }
    else if(IsPlayerInCheckpoint(playerid))
    {
        new Float:health;
        GetPlayerHealth(playerid,health);
        SetPlayerHealth(playerid, health+amount);
    }
    return 1;
}