EvoGT Posted February 26, 2013 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 .
PaiN^ Posted February 26, 2013 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 ..! " Keep Thinking Different . " - Steve Jops -------------------- Don't send me PMs asking for help, I Won't reply !
Castillo Posted February 26, 2013 Posted February 26, 2013 Second argument of: "onClientPlayerWeaponFire" isn't the hitElement. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
EvoGT Posted February 26, 2013 Author 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
Castillo Posted February 26, 2013 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. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
iPrestege Posted February 26, 2013 Posted February 26, 2013 OnClientPlayerWeaponFire hitElement: an element which was hit by a shot.
EvoGT Posted February 26, 2013 Author Posted February 26, 2013 Solidsnake, do you understand what im trying to do ?
Castillo Posted February 26, 2013 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. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Max+ Posted February 26, 2013 Posted February 26, 2013 Solid what this Event Use For ? https://wiki.multitheftauto.com/wiki/OnClientWeaponFire maybe it well help him ? - New , Kill System - New, GameMode Intro - Leve / Exp System - New nametag showing style - New , Hud For Players - Skin Selection from SA-MP - Money System / Buy Weapons - Drop Weapons - New, Flood System - New , Group Assign - Gun license For Weapons - Random Rule System For Money
EvoGT Posted February 26, 2013 Author Posted February 26, 2013 Solid, dont work it doesn't makes car hp lower
EvoGT Posted February 26, 2013 Author 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 ?
Max+ Posted February 26, 2013 Posted February 26, 2013 if you want to lower every time then it's hard but i have idea ! replace setElements with BlowVehilce ? - New , Kill System - New, GameMode Intro - Leve / Exp System - New nametag showing style - New , Hud For Players - Skin Selection from SA-MP - Money System / Buy Weapons - Drop Weapons - New, Flood System - New , Group Assign - Gun license For Weapons - Random Rule System For Money
Castillo Posted February 26, 2013 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. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
EvoGT Posted February 26, 2013 Author 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 ?
EvoGT Posted February 26, 2013 Author 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 ://
Castillo Posted February 26, 2013 Posted February 26, 2013 Post your meta.xml. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
EvoGT Posted February 26, 2013 Author Posted February 26, 2013 Post your meta.xml. "Solidsnake" name="helpme" version="1.0.0" type="script"/>
Castillo Posted February 26, 2013 Posted February 26, 2013 Should work, I destroyed a vehicle with just a few shoots. Remember that you must use the M4. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
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