Jump to content

Vehicle Damage


Resulcan

Recommended Posts

function checkVulnerability(theVehicle)
   if isVehicleDamageProof(theVehicle) then
            outputChatBox("Bu araç hasara karşı savunmasız değil", source)
   else
            outputChatBox("Bu araç hasara karşı savunmasız", source)
   end
end
addEventHandler ( "onPlayerVehicleEnter", getRootElement(), checkVulnerability )
  
setVehicleDamageProof(handleVehicleDamage, true)

function handleVehicleDamage(attacker, weapon, loss, x, y, z, tire)
    if (weapon and getElementModel(source) == 409) then
        -- A weapon was used and the vehicle model ID is that of the SWAT tank so cancel the damage.
        cancelEvent()
    end
end
addEventHandler("onClientVehicleDamage", root, handleVehicleDamage)

function checkVulnerability(theVehicle)
   if isVehicleDamageProof(theVehicle) then
            outputChatBox("This vehicle is not vulnerable to damage", source)
   else
            outputChatBox("This vehicle is vulnerable to damage", source)
   end
end
addEventHandler ( "onPlayerVehicleEnter", getRootElement(), checkVulnerability )

function stopMinigunDamage ( attacker, weapon, bodypart )
    if (weapon and getElementModel(source) == 409) then
        cancelEvent() --cancel the event
    end
end
addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), stopMinigunDamage )

 

 

 

Player Death When Shooting a Player in a Car

 

 

Link to post

Try like this 

addEventHandler("onClientPlayerDamage", localPlayer, function(attacker, weapon, bodypart)
    local veh = getPedOccupiedVehicle(source); --Check if player is in vehicle
	if veh and getElementModel(veh) == 409 then
		cancelEvent(); -- cancel if the player is in vehicle 409
	end
end);

 

Link to post
On 30/09/2020 at 19:37, Tekken said:

Try like this 


addEventHandler("onClientPlayerDamage", localPlayer, function(attacker, weapon, bodypart)
    local veh = getPedOccupiedVehicle(source); --Check if player is in vehicle
	if veh and getElementModel(veh) == 409 then
		cancelEvent(); -- cancel if the player is in vehicle 409
	end
end);

 

player Is happening :(

 

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...