Jump to content

car damaging


botshara

Recommended Posts

Posted

-- client side

function antiCarDM() 
if weapon == 0 and getElementType(hitElement)=="vehicle" then   
outputChatBox("(( CAR DM IS NOT ALLOWED ))", thePlayer, 255,0,0 ) 
cancelEvent() 
end 
end 
addEventHandler("onClientPlayerWeaponFire", getRootElement(), antiCarDM) 

script doesnt work..

And someone can please answer me what need write between function brackets. I cant understand it :oops:

Posted

Try this:

function antiCarDM(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement) 
    if getElementType(hitElement)=="vehicle" then   
        outputChatBox("(( CAR DM IS NOT ALLOWED ))", 255, 0, 0) 
        cancelEvent() 
    end 
end 
addEventHandler("onClientPlayerWeaponFire", localPlayer, antiCarDM) 

Please do not PM me with scripting related question nor support, use the forums instead.

  • Moderators
Posted
addEventHandler("onClientVehicleDamage", root, 
function (attacker,weapon) 
    if attacker == localPlayer then 
        outputChatBox("(( CAR DM IS NOT ALLOWED ))", 255,0,0 ) 
    end 
    if attacker then 
        cancelEvent() 
    end 
end) 

It is clientside and that("onClientPlayerWeaponFire") event can't be cancelled.

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted
addEventHandler("onClientVehicleDamage", root, 
function (attacker,weapon) 
    if attacker == localPlayer then 
        outputChatBox("(( CAR DM IS NOT ALLOWED ))", 255,0,0 ) 
    end 
    if attacker then 
        cancelEvent() 
    end 
end) 

It is clientside and that("onClientPlayerWeaponFire") event can't be cancelled.

It works, but how set it only work to fist ?

Posted

Check if weapon is equal to 0.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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