Hero192 Posted January 19, 2016 Posted January 19, 2016 Hey all, I want to make the silenced gun take 5HPs on each shoot , How to do that?
Castillo Posted January 19, 2016 Posted January 19, 2016 Cancel the original damage ( onClientPlayerDamage + cancelEvent ) and use setElementHealth.
Hero192 Posted January 19, 2016 Author Posted January 19, 2016 Is something like that correct? function silencedDamageSystem(attacker, weapon, _, loss) if attacker and getElementType(attacker) == "player" and weapon == 23 then cancelEvent() local damage = getElementHealth(localPlayer)+loss-5 if damage > 0 then setElementHealth(localPlayer, damage) end end end addEventHandler("onClientPlayerDamage", localPlayer,silencedDamageSystem)
Mega9 Posted January 19, 2016 Posted January 19, 2016 Or just change the weapon's 'damage' property using setWeaponProperty
Hero192 Posted January 19, 2016 Author Posted January 19, 2016 Or just change the weapon's 'damage' property using setWeaponProperty I know this function but I don't know which parametre should I use to change the damage and Also may I know which way is better this way or solidesnake's way?
Castillo Posted January 19, 2016 Posted January 19, 2016 setWeaponProperty will change the properties for all the players in the server, which means that if you change the silenced pistol damage, it'll be for everyone.
Hero192 Posted January 19, 2016 Author Posted January 19, 2016 setWeaponProperty will change the properties for all the players in the server, which means that if you change the silenced pistol damage, it'll be for everyone. That's exactly what I want, Can I know which property I've to use in this situation to edit the silenced pistol's damage?
Mega9 Posted January 19, 2016 Posted January 19, 2016 setWeaponProperty ("silenced", "poor", "damage", xx) xx would be float/int of the new damage value Don't forget other weapon skills (pro & std).
Hero192 Posted January 19, 2016 Author Posted January 19, 2016 setWeaponProperty ("silenced", "poor", "damage", xx) xx would be float/int of the new damage value Don't forget other weapon skills (pro & std). Okay, so 5HPs would be like that? setWeaponProperty ("silenced", "poor", "damage", 5)
Hero192 Posted January 19, 2016 Author Posted January 19, 2016 Last question, What's the usage of this property weapon_range ?
tosfera Posted January 19, 2016 Posted January 19, 2016 Last question, What's the usage of this property weapon_range ? I would assume that's the distance of the gun's reach. Think about a rocket, the distance it takes before it explodes. Same goes for a simple gun, to limit the range it can reach.
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