Jump to content

make an object disapear with a gun


Emile

Recommended Posts

Hello,

I would like to have a script that would make the object disapear when we shoot at it. I tried with

  
function Hit(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement) 
    if weapon == 31 then 
    if (getElementModel(hitElement) == 2021) then 
    destroyElement(hitElement) 
    end 
    end 
    end 
     
addEventHandler("onClientPlayerWeaponFire", getLocalPlayer(), Hit) 

but it doesnt work.

Thanks

Link to comment
  
 function Hit(weapon, _, _, _, _, _, hitElement) 
    if weapon == 31 then 
        if ( getElementType ( hitElement ) == "object" ) and ( getElementModel ( hitElement ) == 2021 ) then 
        destroyElement(hitElement) 
        end 
    end 
end 
addEventHandler("onClientPlayerWeaponFire", localPlayer, Hit) 
  

or

  
function Hit(weapon, _, _, _, _, _, hitElement) 
if weapon == 31 and getElementType ( hitElement ) == "object" ) and ( getElementModel ( hitElement ) == 2021 ) then 
    destroyElement(hitElement) 
end 
addEventHandler("onClientPlayerWeaponFire", localPlayer, Hit) 
  

not sure of them.

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