Add "antiBlow" resource
This commit is contained in:
parent
9f2630a8ce
commit
2b183c2c2a
31
antiBlow/client.lua
Normal file
31
antiBlow/client.lua
Normal file
@ -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)
|
6
antiBlow/meta.xml
Normal file
6
antiBlow/meta.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<meta>
|
||||
<info author="Lordmau5" name="Antiblow - No explode, many visual, wow kill" type="misc" version="0.0.2" />
|
||||
<oop>true</oop>
|
||||
<script src="client.lua" type="client" />
|
||||
<script src="server.lua" type="server" />
|
||||
</meta>
|
20
antiBlow/server.lua
Normal file
20
antiBlow/server.lua
Normal file
@ -0,0 +1,20 @@
|
||||
local ghostMode = false
|
||||
|
||||
local function onMapStarting(mapInfo, mapOptions, gameOptions)
|
||||
ghostMode = mapOptions.ghostmode
|
||||
|
||||
triggerClientEvent('antiBlow:onMapStarting', resourceRoot, ghostMode)
|
||||
end
|
||||
addEvent('onMapStarting', true)
|
||||
addEventHandler('onMapStarting', root, onMapStarting)
|
||||
|
||||
local function onPlayerJoin()
|
||||
triggerClientEvent(source, 'antiBlow:onMapStarting', resourceRoot, ghostMode)
|
||||
end
|
||||
addEventHandler('onPlayerJoin', resourceRoot, onPlayerJoin)
|
||||
|
||||
local function onRequestKillPlayer() -- source: player
|
||||
triggerEvent('onRequestKillPlayer', source)
|
||||
end
|
||||
addEvent('antiBlow:onRequestKillPlayer', true)
|
||||
addEventHandler('antiBlow:onRequestKillPlayer', resourceRoot, onRequestKillPlayer)
|
Loading…
Reference in New Issue
Block a user