Jump to content

Will it work ?


EvoGT

Recommended Posts

I found something interesting in resources.

https://community.multitheftauto.com/ind ... ls&id=1259

This makes all cars undestroyable

And when i use this

https://community.multitheftauto.com/ind ... ls&id=5711

i cant destroy cars.

its good

And i found this :

    function onClientPlayerWeaponFireFunc(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement ) 
        if (weapon == 31 and hitElement and getElementType(hitElement)=="vehicle") then -- If the weapon is a M4 and the element hit is a vehicle 
              if getElementHealth(hitElement) >= 1000 then return end -- If the vehicle health is 1000%, don't heal it. 
              setElementHealth(hitElement, getElementHealth(hitElement)+100) -- Set the vehicle health +100%. 
        end 
    end 
    addEventHandler ( "onClientPlayerWeaponFire", getLocalPlayer(), onClientPlayerWeaponFireFunc ) 

    addEventHandler("onResourceStart",resourceRoot, 
    function () 
        setWeaponProperty(31, "pro", "damage", 0) 
    end) 

its a heal gun

it is possible to make it unheal gun ?

Like if i shot 1 time. it minuses 1 HP from vehicle Health

Smt like this : I shot with gun in car 3 times. And car has 997 HP.

It would be great way.

And this: if getElementHealth(hitElement) >= 1000

it will work if car has 1000 HP ? is it possible to make it work on "random" hp, like 997 , 567

Please help .

Link to comment

Client

addEventHandler("onClientPlayerWeaponFire", root, 
    function (weapon, hitElement) 
        if (weapon == 31) and (getElementType(hitElement) == "vehicle") then 
            local health = getElementHealth(hitElement) 
            setElementHealth(hitElement, health + 100) 
        end 
    end 
) 

This will raise the HP of the vehicle that got hit by 100HP (If the weapon ID = 31), You can Change it if you like ...

**Not Tested ..!

Link to comment
Client
addEventHandler("onClientPlayerWeaponFire", root, 
    function (weapon, hitElement) 
        if (weapon == 31) and (getElementType(hitElement) == "vehicle") then 
            local health = getElementHealth(hitElement) 
            setElementHealth(hitElement, health + 100) 
        end 
    end 
) 

This will raise the HP of the vehicle that got hit by 100HP (If the weapon ID = 31), You can Change it if you like ...

**Not Tested ..!

Will it give heath for car ?

I need to make that when i shot to car with that gun, it makes car HP lower.

I tryed this script now, dont work : ( and tryed with - 100

Link to comment
Client
addEventHandler("onClientPlayerWeaponFire", root, 
    function (weapon, hitElement) 
        if (weapon == 31) and (getElementType(hitElement) == "vehicle") then 
            local health = getElementHealth(hitElement) 
            setElementHealth(hitElement, health + 100) 
        end 
    end 
) 

This will raise the HP of the vehicle that got hit by 100HP (If the weapon ID = 31), You can Change it if you like ...

**Not Tested ..!

Will it give heath for car ?

I need to make that when i shot to car with that gun, it makes car HP lower.

I tryed this script now, dont work : ( and tryed with - 100

It won't work because of what I said, go check the wiki to see the arguments.

Link to comment
addEventHandler("onClientPlayerWeaponFire", root, 
    function (weapon, _, _, _, _, _, hitElement) 
        if (weapon == 31) and (getElementType(hitElement) == "vehicle") then 
            local health = getElementHealth(hitElement) 
            setElementHealth(hitElement, health - 100) 
        end 
    end 
) 

Try it.

Link to comment

I tryed make it myself and what i made:

function onClientPlayerWeaponFireFunc(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement ) 
         if (weapon == 31) and (getElementType(hitElement) == "vehicle") then       -- if i shot to car.... 
         setElementHealth(hitElement, getElementHealth(hitElement)-100) -- makes car hp lower.. i think.. 
    end 
end 
-- And this for every time player shots to car. 
addEventHandler ( "onClientPlayerWeaponFire", getLocalPlayer(), onClientPlayerWeaponFireFunc ) 

Will it work ?

Link to comment
Solid, dont work :/

it doesn't makes car hp lower :/

It works here, you must put it as client side on meta.xml.

its Client sided. Maybe i know where the failure.

I need to make it when every time shots the car , to make lower, not once. What should i add ?

Link to comment
addEventHandler("onClientPlayerWeaponFire", root, 
    function (weapon, _, _, _, _, _, hitElement) 
        if (weapon == 31) and (getElementType(hitElement) == "vehicle") then 
            local health = getElementHealth(hitElement) 
            setElementHealth(hitElement, health - 100) 
        end 
    end 
) 

Try it.

Tryed , dont work ://

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