From 2b183c2c2af97bf37ff5d2d722a1a45f0a0b6f8c Mon Sep 17 00:00:00 2001 From: Lordmau5 Date: Mon, 23 Mar 2020 00:13:49 +0100 Subject: [PATCH] Add "antiBlow" resource --- antiBlow/client.lua | 31 +++++++++++++++++++++++++++++++ antiBlow/meta.xml | 6 ++++++ antiBlow/server.lua | 20 ++++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 antiBlow/client.lua create mode 100644 antiBlow/meta.xml create mode 100644 antiBlow/server.lua 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 +