12.08.2017, 15:14
Is there a way to adjust the amount of damage an explosion gives(CreateExplosion)?
CreateExplosionEx(playerid, Float:x, Float:y, Float:z, Float:radius, Float:maxdamage, type=EXPLOSION_TYPE_MEDIUM, reason=51, playsound=true)
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) |
stock CreateExplosionForPlayerEx(playerid, type, Float:radius, Float:damage)
{
new Float:X, Float:Y, Float:Z, Float:health, Float:armour;
GetPlayerHealth(playerid, health);
SetPlayerHealth(playerid, 100);
GetPlayerPos(playerid, X, Y, Z);
CreateExplosion(X, Y, Z, type, radius);
SetPlayerHealth(playerid, health-damage);
return 1;
}
stock GetPlayerNameEx(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
return name;
}
stock CreateExplosionEx(type, Float:X, Float:Y, Float:Z, Float:radius, Float:damage)
{
new Float:health, string[144], stringf[256], Float:Xx, Float:Yy, Float:Zz;
foreach(new i : Player)
{
GetPlayerHealth(i, health);
CreateExplosion(X, Y, Z, type, radius);
if(IsPlayerInRangeOfPoint(i, radius, X, Y, Z) // 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(i, Xx, Yy, Zz);
SetPlayerHealth(i, 100);
SetPlayerHealth(i, health-damage);
format(string, 144, "[explosion] %s was effected by an explosion at (X: %d) (Y: %i) (Z: %d).", GetPlayerNameEx(i), Xx, Yy, Zz);
printf(string);
}
else if(!IsPlayerInRangeOfPoint(i, radius, X, Y, Z)
{
format(string, 144, "[explosion] %s was not effected by an explosion.", GetPlayerNameEx(i));
printf(string);
if(health == health) SetPlayerHealth(i, health);
}
return 1;
}