Also, why check if the damage <= 1.0? What if people want to lower damage with this with 0.5(half damage)?
I'd personally remove that altogether and have it just multiply the damage. Your cvars already limit it to a min of 0.0, so no need to check < 0.0 either. As for disabling, 1.0 is already 'disabled' really since it won't change the damage at all, and having it just multiply the damage by 1 seems faster than specifically checking for it just to return as normal.
Next point, I'd suggest checking and storing the attacker's class at the start rather than having to do it for each class.
Further, You could change the class checks into a switch for faster computing.
Actually, if you change the cvars a bit...
You know what? I'm rambling on a bit, let me just show an example, eh? :)
PHP Code:
new Handle:cvarEnabled; new Handle:cvarAdminOnly; new Handle:cvarClass[10];
new Float:dmgmult = GetConVarFloat(cvarClass[TF2_GetPlayerClass(attacker)]); damage *= dmgmult; return Plugin_Changed; }
Edit: Hiding this long post.
ReFlexPoison
07-10-2012 05:17
Re: [TF2] Class Damage Modifier
Do like the suggestions, and I'll probably do that in the next update if the plugin is even worth it. I just threw this together in a few minutes and posted it in the thought of soldiers being under-powered in vsh and ff2.
And btw, the version cvar is so you can't change it, simple as that.
ReFlexPoison
07-12-2012 01:22
Re: [TF2] Class Damage Modifier
Version 1.1.0 Released
Changes:
* Now supports negating damage.
* Add reset server command.
* Add team only cvar.
* Deleted unnecessary code.
SyluxLockjaw100
07-21-2012 22:43
Re: [TF2] Class Damage Modifier
Nice plugin,now I can have fun with bots with this plugin. Could you also disable damage modifier to self? This plugins makes rocket jumping lose too much HP...
ReFlexPoison
03-01-2013 19:52
Re: [TF2] Class Damage Modifier
Version 1.2.0 Released
Changes:
> Fixed version CVar
> No longer changes self damage
> Rewrote and renamed
Tylerst
03-01-2013 20:40
Re: [TF2] Class Damage Multiplier
I went back and spoiler'd my first post since it was rather long and isn't relevant anymore.