Hero192 Posted January 19, 2016 Share Posted January 19, 2016 Hey all, I want to make the silenced gun take 5HPs on each shoot , How to do that? Link to comment
Castillo Posted January 19, 2016 Share Posted January 19, 2016 Cancel the original damage ( onClientPlayerDamage + cancelEvent ) and use setElementHealth. Link to comment
Hero192 Posted January 19, 2016 Author Share 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) Link to comment
Mega9 Posted January 19, 2016 Share Posted January 19, 2016 Or just change the weapon's 'damage' property using setWeaponProperty Link to comment
Hero192 Posted January 19, 2016 Author Share 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? Link to comment
Castillo Posted January 19, 2016 Share 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. Link to comment
Hero192 Posted January 19, 2016 Author Share 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? Link to comment
Mega9 Posted January 19, 2016 Share 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). Link to comment
Hero192 Posted January 19, 2016 Author Share 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) Link to comment
Hero192 Posted January 19, 2016 Author Share Posted January 19, 2016 Last question, What's the usage of this property weapon_range ? Link to comment
tosfera Posted January 19, 2016 Share 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. 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