Here's an example :
1
2
3
4
2
3
4
addhook("hit","OnHit")
function OnHit(id,source)
	parse("explosion " ..player(id,"x") .." " ..player(id,"y") .." 50 20 "..source)
end
it made my game crash
Scripts
Explosion on player with hit hook spam
Explosion on player with hit hook spam
1

addhook("hit","OnHit")
function OnHit(id,source)
	parse("explosion " ..player(id,"x") .." " ..player(id,"y") .." 50 20 "..source)
end
spawn the explosion without damage and cause damage manually. This might not be what you want though because maybe you want to damage everything and not just that single player.
Better: Check the parameters of the
hit hook. A simple check would be:function OnHit(id,source, weapon)
if weapon~=251 then
parse("explosion " ..player(id,"x") .." " ..player(id,"y") .." 50 20 "..source)
end
end
hit
DC: so i did as you said ,it worked yes .But now the explosion only sometimes do damage.
still the same .Guess it can't be fixed
omg: the explosion is surely triggering the hook repeatedly, it doesn't mean the player can't be damaged due to a game bug (paraphrased: hook works, damage doesn't)addhook("hit","onExplosionHitOnce")
function onExplosionHitOnce(id, source, weapon, hpdmg, armordmg, rawdmg)
if weapon == 251 then
msg("Explosion registered! Player ID: ".. id .." Source: ".. source .." Weapon ID: ".. weapon)
msg("HP dmg: ".. hpdmg .." Armor dmg: ".. armordmg .." Raw: ".. rawdmg)
freehook("hit","onExplosionHitOnce")
end
end
VADemon: With the freehook it works well
. But Once
1
