Making sure someone is dead? - 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: Making sure someone is dead? (
/showthread.php?tid=263479)
Making sure someone is dead? -
TaMeD - 22.06.2011
Alright, so I've made a system where if someone hits something while driving, and their vehicle takes damage, then they take a portion of damage too. However, I'm having some trouble with this. When the person's health gets to 0/-999.9, they don't properly die. Can someone please tell me how I can ensure they die.
Here's a snippet of relevant code
pawn Код:
if(damageAmount > 0.0)
{
new Float:tmpFloat;
GetPlayerHealth(i, tmpFloat);
SetPlayerHealth(i, floatsub(tmpFloat, damageAmount));
if((tmpFloat - damageAmount) <= 0.0) SetPlayerHealth(i, -999.99);
else SetPlayerHealth(i, floatsub(tmpFloat, damageAmount));
}
Re: Making sure someone is dead? -
iggy1 - 22.06.2011
You could try dropping them from height, that usually works.
pawn Код:
if(damageAmount > 0.0)
{
new Float:tmpFloat;
GetPlayerHealth(i, tmpFloat);
SetPlayerHealth(i, floatsub(tmpFloat, damageAmount));
if((tmpFloat - damageAmount) <= 0.0)
{
new Float:x, Float:y, Float:z;
SetPlayerHealth(i, -99999);
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, x ,y, z + 10.0);
}
else SetPlayerHealth(i, floatsub(tmpFloat, damageAmount));
}