Jump to content

visual damage


botshara

Recommended Posts

Check this:
function handleVehicleDamage(_, weapon, _, _, _, _, _) 
    if ( weapon == 0 ) then -- If the weapon == fist then 
        cancelEvent( ) 
    end 
end 
addEventHandler("onClientVehicleDamage", root, handleVehicleDamage) 

Nop, I have this script, with this cant damage car physically (when black smokes go out from motor and cant start motor), but I want make script which cant damage car visually when hitting by hand. Works like anti-DM script for roleplay server

Link to comment

A car doesn't have physically damage -.- You mean the health or the damage proof...

function handleVehicleDamage(_, weapon, _, _, _, _, _) 
    local health = getElementHealth( source ) 
    if ( weapon == 0 ) then -- If the weapon == fist then 
        setElementHealth( source, tonumber( health ) ) 
        cancelEvent( ) 
    end 
end 
addEventHandler("onClientVehicleDamage", root, handleVehicleDamage) 

Link to comment

Try this

  tablea = {1,2,3,4,5,6} 
  
  function preventDamage() 
    for i,v in pairs(tablea) do 
    setVehiclePanelState(source,v,0) 
    end 
      
    addEventHandler("onVehicleDamage", getRootElement(), preventDamage) 

When the vehicle is damaged, it automaticly fixes all panels. But vehicle health can still drain

Link to comment

Oh yeh, I forgot about that at the time.

Here's an example following @Walids

      
      
      function preventDamage() 
        for i=0,6 do 
        setVehiclePanelState(source,v,0) 
        end 
          
        addEventHandler("onVehicleDamage", getRootElement(), preventDamage) 

Link to comment

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...