EvoGT Posted February 26, 2013 Share Posted February 26, 2013 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
PaiN^ Posted February 26, 2013 Share Posted February 26, 2013 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
Castillo Posted February 26, 2013 Share Posted February 26, 2013 Second argument of: "onClientPlayerWeaponFire" isn't the hitElement. Link to comment
EvoGT Posted February 26, 2013 Author Share Posted February 26, 2013 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
Castillo Posted February 26, 2013 Share Posted February 26, 2013 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
iPrestege Posted February 26, 2013 Share Posted February 26, 2013 OnClientPlayerWeaponFire hitElement: an element which was hit by a shot. Link to comment
EvoGT Posted February 26, 2013 Author Share Posted February 26, 2013 Solidsnake, do you understand what im trying to do ? Link to comment
Castillo Posted February 26, 2013 Share Posted February 26, 2013 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
Max+ Posted February 26, 2013 Share Posted February 26, 2013 Solid what this Event Use For ? https://wiki.multitheftauto.com/wiki/OnClientWeaponFire maybe it well help him ? Link to comment
EvoGT Posted February 26, 2013 Author Share Posted February 26, 2013 Solid, dont work it doesn't makes car hp lower Link to comment
EvoGT Posted February 26, 2013 Author Share Posted February 26, 2013 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
Max+ Posted February 26, 2013 Share Posted February 26, 2013 if you want to lower every time then it's hard but i have idea ! replace setElements with BlowVehilce ? Link to comment
Castillo Posted February 26, 2013 Share Posted February 26, 2013 Solid, dont work it doesn't makes car hp lower It works here, you must put it as client side on meta.xml. Link to comment
EvoGT Posted February 26, 2013 Author Share Posted February 26, 2013 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
EvoGT Posted February 26, 2013 Author Share Posted February 26, 2013 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
EvoGT Posted February 26, 2013 Author Share Posted February 26, 2013 Post your meta.xml. "Solidsnake" name="helpme" version="1.0.0" type="script"/> Link to comment
Castillo Posted February 26, 2013 Share Posted February 26, 2013 Should work, I destroyed a vehicle with just a few shoots. Remember that you must use the M4. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now