Jump to content

Damage projectile


-Doc-

Recommended Posts

Posted
function damage(attacker, weapon, loss, x, y, z, tyre) 
    if (weapon == 21 and getElementModel(source) == 432 then  
        setElementHealth(source,getElementHealth(source) - 250)  
        cancelEvent() 
    end 
end 
addEventHandler("onClientVehicleDamage", root, damage) 

try this

Raino will take 25% heath when you fire with projectile id 21

Posted
function damage(attacker, weapon, loss, x, y, z, tyre) 
    if (weapon == 21 and getElementModel(source) == 432 then  
        setElementHealth(source,getElementHealth(source) - 250)  
        cancelEvent() 
    end 
end 
addEventHandler("onClientVehicleDamage", root, damage) 

try this

Raino will take 25% heath when you fire with projectile id 21

forum and i used it+not working

its from

Posted

sorry there was a missing ")" in the script

and it should work, i posted this same example long back and it worked for him.

function damage(attacker, weapon, loss, x, y, z, tyre) 
    if (weapon == 21 and getElementModel(source) == 432) then 
        setElementHealth(source,getElementHealth(source) - 250) 
        cancelEvent() 
    end 
end 
addEventHandler("onClientVehicleDamage", root, damage) 

to find rthe actual id of the weapon try this

outputDebugString("Test: weaponid: " .. tostring(weapon)) 

or alternatively you can use the id 51 (It's the explostion id)

same issue

viewtopic.php?f=91&t=86150&start=15#p780074

Posted
not working :twisted:

Kidding?

It works fine for me and everyone else

Post the code which you are using

im not kidding and its server or client

function damage(attacker, weapon, loss, x, y, z, tyre) 
    if (weapon == 21 and getElementModel(source) == 432) then 
        setElementHealth(source,getElementHealth(source) - 250) 
        --outputDebugString("Test: weaponid: " .. tostring(weapon)) 
        cancelEvent() 
    end 
end 
addEventHandler("onClientVehicleDamage", root, damage) 

Posted
not working :twisted:

Kidding?

It works fine for me and everyone else

Post the code which you are using

im not kidding and its server or client

function damage(attacker, weapon, loss, x, y, z, tyre) 
    if (weapon == 21 and getElementModel(source) == 432) then 
        setElementHealth(source,getElementHealth(source) - 250) 
        --outputDebugString("Test: weaponid: " .. tostring(weapon)) 
        cancelEvent() 
    end 
end 
addEventHandler("onClientVehicleDamage", root, damage) 

It's client

Posted

i tried to change the weapon id which is 31(m4) , and changed the damage to -1000, and the rhino gets a 1 hit by m4 and it works , but if i use 51 or 21, doesnt work , nothing happens.

Posted
i tried to change the weapon id which is 31(m4) , and changed the damage to -1000, and the rhino gets a 1 hit by m4 and it works , but if i use 51 or 21, doesnt work , nothing happens.

51 is explosion Id

Just try to explode something near the vehicle.

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