Jump to content

Damage to rhino?


Recommended Posts

Hello , i've been trying to make rhino be damaged by RPGs or explosions and such, but it's hard to do it. 

'on ID S.W.A.T tank explosions work, they do the damage, but for the rhino idk why it doesn't. I didn't restrict any Weapon IDs for now to check if it really works. but still explosions do not work on rhino despite the event. 

local armoredVehicles = { [432] = true, [601] = true }

function warMachineDamage(attacker, weapon, loss, x, y, z, tire)
	local model = getElementModel(source)
    if weapon and armoredVehicles[model] then 
        cancelEvent()
		triggerServerEvent ("damageWarMachine", source, source, attacker, weapon, bodypart )
    end
end
addEventHandler("onClientVehicleDamage", root, warMachineDamage)

 

Server:

addEvent( "damageWarMachine", true )
function damageWarMachine( vehicle, attacker, weapon, bodypart)
	local vehicleHealth = getElementHealth(vehicle)
	setElementHealth(vehicle, vehicleHealth - 500 )
end 
addEventHandler( "damageWarMachine", root, damageWarMachine )

Does anyone know a workaround this?

Like

maybe use onClientExplosion? and maybe onClientPlayerWeaponFire then define the weapon and the hitElement then trigger the event?

Edited by Bean666
Link to post
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...