Explosion Damage
#1

Is there a way to adjust the amount of damage an explosion gives(CreateExplosion)?
Reply
#2

https://sampwiki.blast.hk/wiki/Explosion_List, There are various samp explosions, You can try it some is too large or some small,
OR
A best way to adjust explosion damage is using this include
https://sampforum.blast.hk/showthread.php?tid=225350
Код:
CreateExplosionEx(playerid, Float:x, Float:y, Float:z, Float:radius, Float:maxdamage, type=EXPLOSION_TYPE_MEDIUM, reason=51, playsound=true)
Reply
#3

Quote:
Originally Posted by FuNkYTheGreat
Посмотреть сообщение
https://sampwiki.blast.hk/wiki/Explosion_List, There are various samp explosions, You can try it some is too large or some small,
OR
A best way to adjust explosion damage is using this include
https://sampforum.blast.hk/showthread.php?tid=225350
Код:
CreateExplosionEx(playerid, Float:x, Float:y, Float:z, Float:radius, Float:maxdamage, type=EXPLOSION_TYPE_MEDIUM, reason=51, playsound=true)
What is the playerid used for if the xyz are sent too?
I want the command to operate create an explosion on the given xyz's not on the location of a player.
Reply
#4

PHP код:
stock CreateExplosionForPlayerEx(playeridtypeFloat:radiusFloat:damage)
{
    new 
Float:XFloat:YFloat:ZFloat:healthFloat:armour;
    
GetPlayerHealth(playeridhealth);
    
SetPlayerHealth(playerid100);
    
GetPlayerPos(playeridXYZ);
    
CreateExplosion(XYZtyperadius);
    
SetPlayerHealth(playeridhealth-damage);
    return 
1;

PHP код:
stock GetPlayerNameEx(playerid)
{
    new 
name[MAX_PLAYER_NAME];
    
GetPlayerName(playeridnamesizeof(name));
    return 
name;
}
stock CreateExplosionEx(typeFloat:XFloat:YFloat:ZFloat:radiusFloat:damage)
{
    new 
Float:healthstring[144], stringf[256], Float:XxFloat:YyFloat:Zz;
    foreach(new 
Player)
    {
        
GetPlayerHealth(ihealth);    
        
CreateExplosion(XYZtyperadius);
        if(
IsPlayerInRangeOfPoint(iradiusXYZ// if there are any players in the region of the explosion it will deduct X (from the damage float) amount of health from their current health.
        
{
                        
GetPlayerPos(iXxYyZz);
            
SetPlayerHealth(i100);
            
SetPlayerHealth(ihealth-damage);
            
format(string144"[explosion] %s was effected by an explosion at (X: %d) (Y: %i) (Z: %d)."GetPlayerNameEx(i), XxYyZz);
            
printf(string);
        }
        else if(!
IsPlayerInRangeOfPoint(iradiusXYZ)
        {
            
format(string144"[explosion] %s was not effected by an explosion."GetPlayerNameEx(i));
            
printf(string);
            if(
health == healthSetPlayerHealth(ihealth);
        }
    return 
1;

Spent some time making this for you, xd. Word of warning, the "CreateExplosionEx" is probably unoptimized code and could be edited for it to become optimized. i'm not the best at PAWN and still learning. If you want to replace the "player was not effected by an explosion" just edit "else if(!IsPlayerInRangeOfPoint(i, radius, X, Y, Z)" and make it "else if(!IsPlayerInRangeOfPoint(i, radius, X, Y, Z) return 1;".

This wont work with armour but with a few IQ points you can easily make it work with armour using the health system already implemented. Also, this is untested code. I can only imagine that the first one will work properly.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)