SA-MP Forums Archive
CreateExplosionEx - 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: CreateExplosionEx (/showthread.php?tid=641063)



CreateExplosionEx - Amit1998 - 10.09.2017

Hi,
I'm trying to use the following code in order to ensure a player's death in the explosion.
Код:
CreateExplosionEx(playerid, x,y,z, 1, 250.0);
Previously I used CreateExplosion and it didn't kill the player, it decreased his health to approx 20HP.
I tried using the explosion include where I can edit the damage(250.0 is the damage parameter) but it doesnt decrease health at all.

What seems to be the problem? Thanks.


Re: CreateExplosionEx - silverms - 10.09.2017

idk the problem but I made an system to make the player get the damage u specified
it is this
PHP код:
stock CreateExplosionEx(playerid, Float:x, Float:y, Float:z, typ, Float:rad, Float:h)
{
     
CreateExplosion(x, y, z, typ, rad);
     new 
Float:ph;
    
GetPlayerHealth(playerid, ph);
    
ph = ph - h;
    
SetPlayerHealth(playerid, ph);
} 
Float:h is the how much health u want to take from the player set it to 100 if u want to kill him in game it will be like an real explosion it wont be like it is scripter
I updated it a bit for u so u don't need to put the coordinates u just put the playerid type radius and the taken health
PHP код:
stock CreateExplosionEx(playerid, typ, Float:rad, Float:h)
{
    new 
Float:x, Float:y, Float:z;
    
GetPlayerPos(playerid, x, y, z);
     
CreateExplosion(x, y, z, typ, rad);
     new 
Float:ph;
    
GetPlayerHealth(playerid, ph);
    
ph = ph - h;
    
SetPlayerHealth(playerid, ph);
} 
PS: the radius is how much the spread of the explosion should be