diff --git a/antiBlow/client.lua b/antiBlow/client.lua new file mode 100644 index 0000000..57d4432 --- /dev/null +++ b/antiBlow/client.lua @@ -0,0 +1,31 @@ +local ghostMode = false + +local function triggerVisualExplosion(vehicle) + createEffect('explosion_medium', vehicle.position.x, vehicle.position.y, vehicle.position.z, 0, 0, 0) + local sound = playSFX3D('genrl', 45, 4, vehicle.position.x, vehicle.position.y, vehicle.position.z) + if sound then + sound.volume = 1 + end +end + +local function onClientExplosion(x, y, z, theType) + if not ghostMode then + return + end + + if theType < 4 or theType > 5 then -- Not a vehicle explosion + return + end + + if source.type == 'player' then + cancelEvent() + triggerVisualExplosion(source) + end +end +addEventHandler('onClientExplosion', root, onClientExplosion) + +local function onMapStarting(_ghostMode) + ghostMode = _ghostMode +end +addEvent('antiBlow:onMapStarting', true) +addEventHandler('antiBlow:onMapStarting', resourceRoot, onMapStarting) diff --git a/antiBlow/meta.xml b/antiBlow/meta.xml new file mode 100644 index 0000000..36abd34 --- /dev/null +++ b/antiBlow/meta.xml @@ -0,0 +1,6 @@ + + + true +