SA-MP Forums Archive
Setplayerhealth to 0 - 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: Setplayerhealth to 0 (/showthread.php?tid=425317)



Setplayerhealth to 0 - ZizPower7610 - 25.03.2013

I want the player that enters this building so when he tries to attack others his health will go down to 0 percent and he dies. "this is a non dm office thats why"

Код:
		else if(IsPlayerInRangeOfPoint(playerid, 3.0, 2015.5587,1106.1138,10.8203)) // Office Near Italian Mafia
        {
            TextDrawShowForPlayer(playerid,officemessage);
            SetPlayerPos(playerid, 290.85040283203, -73.214797973633, 1006.8);
            SetPlayerInterior(playerid, 1);
        }



Re: Setplayerhealth to 0 - Apenmeeuw - 25.03.2013

Create a variable

pawn Код:
// ontop of script under includes
new bool:IsInOfficeBuilding[MAX_PLAYERS];

//  In the code you provided
IsInOfficeBuilding[playerid] = true;
// now use onplayergivedamage to check if he is in the building, if so he will die.
// also use IsInOfficeBuilding[playerid] = false; when he exits the building.