[GENERAL] Script to disable vehicle explosion damage in GM arenas
Hey,
This script disables vehicle explosion damage when another vehicle explodes next to your vehicle, your vehicle will not get damaged and pushed by explosions that caused by other players.
You can use this client-side script in your maps, I would be happy to see it implemented in all GhostMode rooms.
https://www.youtube.com/watch?v=0v6gIIlcugU
Code:
--- source is attacker, localPlayer is targetPlayer ---
function disableVehExplosionDmg(x, y, z, theType)
--- check if targetPlayer is in a vehicle ---
local veh = getPedOccupiedVehicle(localPlayer)
--- return if attacker is targetPlayer, so player will see his own explosion and get affected of it ---
if source == localPlayer then return end
--- get targetPlayer's vehicle position ---
local pX, pY, pZ = getElementPosition(veh)
--- if explosion type is (Car/Car Quick/Boat/Heli) ---
if (theType == 4 or theType == 5 or theType == 6 or theType == 7) then
--- check distance between targetPlayer and explosion, if vehicle is near to explosion then cancel explosion for targetPlayer ---
if getDistanceBetweenPoints3D(pX, pY, pZ, x, y, z) <= getElementRadius(veh)+4 then
cancelEvent()
end
end
end
addEventHandler("onClientExplosion", root, disableVehExplosionDmg)
Re: [GENERAL] Script to disable vehicle explosion damage in GM arenas
It Will be very useful (͡° ͜ʖ ͡°) + keep it up