Raised This Month: $100 Target: $400
 25% 

Variable Friendly Fire


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Condition-Zero        Category:   Server Management        Approver:   Exolent[jNr] (178)
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 10-27-2009 , 06:53   Variable Friendly Fire
Reply With Quote #1

Variable Friendly Fire
Version 2.5


Description:
This plugin allows you to use Friendly Fire and not have to worry about accidental Team Kills. It multiplies the amount of damage done to a teammate using a variable such as 1.0 which is 100% or 0.25 which is 25% damage. This should work with any team kill punish plugin you want to run on your server. I have tested this with both humans and CZ bots.

Tested in CZ.

NOTE: In your plugins ini file add variable-friendlyfire.amxx at the top for the file. Other wise it wont overwrite the original client command ff in nextmap.sma

Cvars:
  • mp_friendlyfire - The percentage you want the damage to be brought down to. 0.50 is 50% and 1.0 is 100%. 1.0 deals the same amount to a teammate as it would an enemy. 0 turns off the plugin and friendly fire all together.
  • mp_mirrordamage - The percentage you want the mirror damage to be brought down to. 0.50 is 50% and 1.0 is 100%. 1.0 deals the same amount of mirror damage as if attacking an enemy. 0 turns off mirror damage.
  • vf_mirrordamage - Decides if you hurt the original victim when mirror damage is turned on. 1 = hurt victim 0 = dont hurt victim. <Default: 0>
  • vf_nades - This is to ignore grenades when multipling damage for TK. <Default: 0>
Servers:
  • For a list of servers running this plugin Click here
Console Cmds:
  • amx_friendlyfire - Sets the value of "mp_friendlyfire" (Requires ADMIN_RCON)
  • amx_mirrordamage - Sets the value of "mp_mirrordamage" (Requires ADMIN_RCON)
Credits:
  • Snow - For registering bots in ham.
  • Schmurgel1983 - For figuring out the correct multiplier.
  • Bibu - For fixing the bomb Explosion
  • DumNut101 - For alerting me to an issue with the options vs outcome
  • Apollyon - For alerting me of an issue within my release thread. KING TYPO STRIKES AGAIN
Change log:


1.0
Initial Release

1.1
Removed Global Toggle
Checks if Friendly fire is active(if not plugin dosent run)
Checks if valid player

1.2
Fixed to what Connor said.. Thanks Again mang

1.3
Restricted the use of this to 0.0 - 1.0 which means 0.0 is no damage and 1.0 is full damage as if on the other team.

1.4
Changed damage deduction so that it takes it from full damage not the already lower damage.
PHP Code:
SetHamParamFloat(4, (damage ) * flFFRatio); 
1.5
Removed Cstrike specific code.
Using floatclam() instead of the ration

1.6
Removed my cvar and use mp_friendlyfire
Make sure you set mp_friendlyfire to the decimal you would like damage reduced buy
And place that value in your amx modx config...
mp_friendlyfire 0.25 = 75% damage reduction

1.7
Changed the Damage multiplier from 3 to 2.86

1.8
vf_nades "0"
Created a new cvar to include nades or ignore them. (set to 1 allows the engine to normally handle grenades according to its own math)

2.0
Added 2 new cvars
Added 2 new console commands
Added custom say commands to display the status of friendlyfire and mirrordamage.
Works for both Say and Say_Team
For Friendly fire use: /ff or ff
For Mirror Damage use: /md or md

2.1
Small bug fix. When mp_mirrordamage was set to anything between 0-1 it wouldnt take damage unless it was 1.
Added fcvar

2.2
Fixed the Cvars
Recoded the Player Hurt Section to be more readable.
Made the plugin ignore C4 explosions.

2.3
Fixed say message

2.4
Small Bug Fixes
Changed to use czbot supoort with rage module

2.5
Fixed C4 Explosions using classnames instead of dmg bits due to grenade conflict.
Removed Rage Model Requirement
Rewrote fwdPlayerHurt to make it easier to read and follow.
Added comments for better debugging.
Fixed issues with mirror and friendly fire damages not working correctly.
Attached Files
File Type: txt variable-friendlyfire.txt (1.2 KB, 491 views)
File Type: sma Get Plugin or Get Source (variable-friendly.sma - 1360 views - 4.3 KB)
__________________

Last edited by Doc-Holiday; 10-21-2013 at 11:25.
Doc-Holiday is offline
NGage70
Senior Member
Join Date: Sep 2008
Old 10-27-2009 , 07:03   Re: Variable Friendly Fire
Reply With Quote #2

Nice Plugin =)
__________________
NGage70 is offline
KadiR
Unnecessary Member
Join Date: Aug 2008
Location: Zürich / Switzerland
Old 10-27-2009 , 07:03   Re: Variable Friendly Fire
Reply With Quote #3

cool
KadiR is offline
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 10-27-2009 , 12:09   Re: Variable Friendly Fire
Reply With Quote #4

Some suggestions:

- Why do you need gBotsRegistered? Correct me if I'm wrong but it seems like you need to RegisterHamFromEntity on each bot in the server, doing a bool will prevent all bots joining after the first from getting their forward registered.
- Is the task still needed if you use client_putinserver instead of authorized?
- Check for valid attacker in PlayerHurt (1<=attacker<=maxplayers)
- You could hook round start (finish of freezetime) and Disable the Ham forward if its not needed.
__________________
In Flames we trust!
Nextra is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-27-2009 , 13:15   Re: Variable Friendly Fire
Reply With Quote #5

You need to register one time the first CZ bot, the hook will be available for all entities from this class.
__________________
Arkshine is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 10-27-2009 , 14:02   Re: Variable Friendly Fire
Reply With Quote #6

Quote:
Originally Posted by Nextra View Post
Some suggestions:

- Why do you need gBotsRegistered? Correct me if I'm wrong but it seems like you need to RegisterHamFromEntity on each bot in the server, doing a bool will prevent all bots joining after the first from getting their forward registered.
- Is the task still needed if you use client_putinserver instead of authorized?
- Check for valid attacker in PlayerHurt (1<=attacker<=maxplayers)
- You could hook round start (finish of freezetime) and Disable the Ham forward if its not needed.
reason i dont check for valid attacker is i have yet to run into an error due to finding attcker = 0

ive had it running for almost 32 hours. and played on it for abou 10 of those. lol so no errors yet
__________________
Doc-Holiday is offline
Apollyon
SourceMod Donor
Join Date: Dec 2007
Location: California
Old 10-27-2009 , 14:08   Re: Variable Friendly Fire
Reply With Quote #7

Been waiting for this! I have it running on 2 of my servers, so far. It's working great. No more "accidental" team kills.
__________________
Apollyon is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-27-2009 , 14:29   Re: Variable Friendly Fire
Reply With Quote #8

You don't use fakemeta ;)
__________________
- tired and retired -
ConnorMcLeod is offline
Jon
Veteran Member
Join Date: Dec 2007
Old 10-27-2009 , 14:55   Re: Variable Friendly Fire
Reply With Quote #9

Quote:
This plugin allows you to use Friendly Fire and not have to worry about accidental Team Kills.

I think that's misleading. It makes it sound like the plugin can detect accidental team kills and seperate them from other team kills.

A toggle cvar isn't really needed and you should check the value of mp_friendlyfire.
Jon is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 10-28-2009 , 01:27   Re: Variable Friendly Fire
Reply With Quote #10

Also removeing fm from the includes didn't notice it up there.


Quote:
Originally Posted by Jon View Post
I think that's misleading. It makes it sound like the plugin can detect accidental team kills and seperate them from other team kills.

A toggle cvar isn't really needed and you should check the value of mp_friendlyfire.
[/color][/size]

removing g_Switch

and then doing something like this?

if(get_cvar_pointer(mp_friendlyfire))
{
//the code here
}

so plugin dosent run while ff is off?
__________________
Doc-Holiday is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:46.


Powered by vBulletin®
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Theme made by Freecode