Jump to content

car damaging


botshara

Recommended Posts

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

Link to comment
  • Moderators

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) 

Link to comment
  • Moderators
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.

Link to comment
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 ?

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