This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Return Friendly-Fire Damage


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Fun Stuff       
crazy.cipry
Member
Join Date: Dec 2008
Location: Romania
Old 08-22-2010 , 10:12   Return Friendly-Fire Damage
Reply With Quote #1

Return Friendly-Fire Damage
by Ciprian ( me )


Description
This plugin returns the damage made by a teammate if the mp_friendlyfire cvar is set to 1.
Cvars
  • amx_rffd_mode
    • 1 - activated / 0 - deactivated
    • Default: 1

Requirements
  • AMX MOD X v1.8.1 or higher !
  • hamsandwich module activated

Current Version: 1.0
Attached Files
File Type: sma Get Plugin or Get Source (return_ff_damage.sma - 1238 views - 948 Bytes)

Last edited by crazy.cipry; 08-22-2010 at 18:20.
crazy.cipry is offline
eD.
Senior Member
Join Date: Oct 2009
Old 08-22-2010 , 11:12   Re: Return Friendly-Fire Damage
Reply With Quote #2

Nice.
eD. is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 08-22-2010 , 11:35   Re: Return Friendly-Fire Damage
Reply With Quote #3

There is cvar in cs mp_mirrordamage, which should do same thing but it doesnt, so i think you could use this cvar
__________________
xPaw is offline
RedRobster
Veteran Member
Join Date: Apr 2010
Location: Your Closet
Old 08-22-2010 , 11:57   Re: Return Friendly-Fire Damage
Reply With Quote #4

Instead of get_cvar_num() is get_cvar_pointer() a better way?
RedRobster is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 08-22-2010 , 12:11   Re: Return Friendly-Fire Damage
Reply With Quote #5

Well, I just tested the "mp_mirrordamage" cvar and doesn't seem to work, I tested with podbot in CS tough.

About the code, remove the "are_teammates()" stock and just place the condition in the other if(), you're using it once so it doesn't require a stock.
Also, "g_Enabled & g_FriendlyFire", you forgot a "&" there.
__________________

Last edited by Hunter-Digital; 08-22-2010 at 12:15.
Hunter-Digital is offline
crazy.cipry
Member
Join Date: Dec 2008
Location: Romania
Old 08-22-2010 , 12:34   Re: Return Friendly-Fire Damage
Reply With Quote #6

Quote:
Originally Posted by Hunter-Digital View Post
Well, I just tested the "mp_mirrordamage" cvar and doesn't seem to work, I tested with podbot in CS tough.

About the code, remove the "are_teammates()" stock and just place the condition in the other if(), you're using it once so it doesn't require a stock.
Also, "g_Enabled & g_FriendlyFire", you forgot a "&" there.
I don't know if I understood well, did you mean like this:
Code:
if ( condition 1 && 2 ) {
if ( condition 3 )
{ ... }
}
?

And why should I use && instead of &? If one of the conditions is false it won't 'enter' in the if :-?

Last edited by crazy.cipry; 08-22-2010 at 12:58.
crazy.cipry is offline
RedRobster
Veteran Member
Join Date: Apr 2010
Location: Your Closet
Old 08-22-2010 , 12:39   Re: Return Friendly-Fire Damage
Reply With Quote #7

Also, if mp_mirrordamage doesn't work, why not just use that as the base cvar?
RedRobster is offline
DaxProxy
Senior Member
Join Date: Sep 2007
Old 08-22-2010 , 13:23   Re: Return Friendly-Fire Damage
Reply With Quote #8

Quote:
Originally Posted by RedRobster View Post
Also, if mp_mirrordamage doesn't work, why not just use that as the base cvar?
Also, you might want to add option so that if friendly is taking damage, he'll only recieve half damage, but team attacker recieves full damage he has done to friendly...if you get my point.
Some games have this system...and it's fairly good.
Another nice option would be, so that you cant do friendly damage, instead you damage yourself when trying to damage friendlies...
So you wont piss off your teammates when you accidentally shoot them, but you'll recieve penalty for being so careless...
__________________

Want ApolloRP for Counter-Strike? Show your support: http://forums.alliedmods.net/showthr...39#post1264739
DaxProxy is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 08-22-2010 , 14:05   Re: Return Friendly-Fire Damage
Reply With Quote #9

Quote:
Originally Posted by crazy.cipry View Post
I don't know if I understood well, did you mean like this:
Code:
if ( condition 1 && 2 ) {
if ( condition 3 )
{ ... }
}
?

And why should I use && instead of &? If one of the conditions is false it won't 'enter' in the if :-?
No, I mean:
Code:
if(g_Enabled && g_FriendlyFire && get_user_team(i_Victim) == get_user_team(i_Attacker))
{
    // ...
}
You don't need 2 or more if's and you don't need to return the same thing in both cases... as a matter of fact, you don't need to return anything if you're not returning something else in the process.
Code:
public fwEventTakeDmg ( i_Victim, i_Inflictor, i_Attacker, Float:Damage, i_DamageBits )
{
    if ( g_Enabled && g_FriendlyFire && get_user_team( i_Victim ) == get_user_team( i_Attacker ) )
        SetHamParamEntity ( 1, i_Attacker ); 
}
You're also checking mp_friendlyfire wrong... configs are executed long after plugin_init() so is a big chance FF is off when you check and it's on after that and also it's a variable, it may change any time.
You'll need to use pcvars to hook the variable's value.

And you mean you need "OR" ? That's || not &... but you don't need either here.
& is "bitwise and", read here: http://wiki.amxmodx.org/Pawn_Tutorial#Expressions


Quote:
Originally Posted by DaxProxy View Post
Another nice option would be, so that you cant do friendly damage, instead you damage yourself when trying to damage friendlies...
So you wont piss off your teammates when you accidentally shoot them, but you'll recieve penalty for being so careless...
That's what this plugin actually does, it redirects the damage back to you, the teammate is not harmed.
__________________

Last edited by Hunter-Digital; 08-22-2010 at 14:13.
Hunter-Digital is offline
crazy.cipry
Member
Join Date: Dec 2008
Location: Romania
Old 08-22-2010 , 15:50   Re: Return Friendly-Fire Damage
Reply With Quote #10

Quote:
Originally Posted by Hunter-Digital View Post
Code:
public fwEventTakeDmg ( i_Victim, i_Inflictor, i_Attacker, Float:Damage, i_DamageBits )
{
    if ( g_Enabled && g_FriendlyFire && get_user_team( i_Victim ) == get_user_team( i_Attacker ) )
        SetHamParamEntity ( 1, i_Attacker ); 
}
If I don't put a return HAM_IGNORED in the 'if' the plugin doesn't work and I can't find out why, even if after the 'if' ( lol how it sounds like ) ) follows a return HAM_IGNORED;
crazy.cipry is offline
Reply



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 03:53.


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