AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [Any] Mirror Damage [12.01.2013] (https://forums.alliedmods.net/showthread.php?t=205374)

neatek 01-10-2013 02:11

[Any] Mirror Damage [12.01.2013]
 
2 Attachment(s)
~ Mirror Damage UPDATED 12.01.13
Prevent friendlyfire damage, and returns it back to attacker.

Installation:
put MirrorDamage.smx into addons/sourcemod/plugins/

Cvars:
sm_mirrordamage_version - Version of plugin
sm_mirrordamage_multiplier - Amount of damage to inflict to attacker (Def: 0.7)
sm_mirrordamage_slap - Slap attacker?! or just subtraction health (Def: 0)
sm_mirrordamage_annonce - Type in chat about friendlyfire?! (Def: 0) Example: "NEATEK attacked a teammate"

Requiments:
SDKHooks

Counter-Strike: Source (works fine)
Counter-Strike: Global offensive (must works)
Team Fortrees 2 (must works)

Changelog:
1.1rc: // not tested
  1. added: CS:GO support // Sheepdude ty for tips.
  2. added: cvar: sm_mirrordamage_annonce
  3. added: cvar: sm_mirrordamage_slap
  4. fixed: damage from yourself // Sheepdude ty for tips.
  5. added: support for load plugin in middle of game // Sheepdude ty for tips.
1.0rc: // works
  1. plugin created .

Sreaper 01-10-2013 02:27

Re: [Any] Mirror Damage (sdkhooks)
 
There is another mirror damage plugin. Though that one has issues where the victim could get killed as well as the attacker.

Is that corrected in this one? What are the differences?

neatek 01-10-2013 02:30

Re: [Any] Mirror Damage (sdkhooks)
 
Quote:

Originally Posted by Sreaper (Post 1870717)
There is another mirror damage plugin. Though that one has issues where the victim could get killed as well as the attacker.

Is that corrected in this one? What are the differences?

I just did SDKHooks version. Yes, it fixed.

Quote:

Originally Posted by Sreaper (Post 1870717)
What are the differences?

This is much easier than that.

Sreaper 01-10-2013 02:31

Re: [Any] Mirror Damage (sdkhooks)
 
Great. Would you mind adding an sm_mirrordamage <client> command then? :3

neatek 01-10-2013 02:33

Re: [Any] Mirror Damage (sdkhooks)
 
Quote:

Originally Posted by Sreaper (Post 1870719)
Great. Would you mind adding an sm_mirrordamage <client> command then? :3

For what this command? Plugin applies to all players.

Sreaper 01-10-2013 02:36

Re: [Any] Mirror Damage (sdkhooks)
 
Quote:

Originally Posted by neatek (Post 1870720)
For what this command? Plugin applies to all players.

Nevermind don't worry about it. Though the plugin should probably be renamed "Return Friendly Fire" or something similar since it's specific to friendly fire.

Nice plugin nonetheless!

ecca 01-10-2013 10:51

Re: [Any] Mirror Damage (sdkhooks)
 
Could be good for anti tk. Anyway you could fix this bit.

PHP Code:

if(!victim)
        return 
Plugin_Continue;
    if(!
attacker)
        return 
Plugin_Continue;
    if(!
IsClientInGame(attacker))
        return 
Plugin_Continue;
    if(!
IsClientInGame(inflictor))
        return 
Plugin_Continue

to

PHP Code:

if(!victim || !attacker || !IsClientInGame(attacker) || !IsClientInGame(inflictor))
{
    return 
Plugin_Continue;



neatek 01-10-2013 10:53

Re: [Any] Mirror Damage (sdkhooks)
 
Quote:

Originally Posted by ecca (Post 1870889)
PHP Code:

if(!victim || !attacker || !IsClientInGame(attacker) || !IsClientInGame(inflictor))
{
    return 
Plugin_Continue;



This is was in my plugin, but i prefer to:
PHP Code:

    if(!victim)
        return 
Plugin_Continue;
    if(!
attacker)
        return 
Plugin_Continue;
    if(!
IsClientInGame(attacker))
        return 
Plugin_Continue;
    if(!
IsClientInGame(inflictor))
        return 
Plugin_Continue

this isnt error...

Sheepdude 01-10-2013 15:23

Re: [Any] Mirror Damage (sdkhooks)
 
1. SDKHooks is better, since the victim won't die as well. I like ecca's conditional statement format better, but since it's the same logic it doesn't really make a difference.

2. However, the attacker might not necessarily be a player, so before you check IsClientInGame(attacker), make sure attacker <= MaxClients.

3. Aside from using SDKHooks to avoid killing the victim, this plugin isn't significantly different from MadHamster's Reflect Team Damage plugin. I would recommend adding some extra features, such as convars that can slap or give verbal warnings to team attackers.

4. Also, a player can damage themself, such as with a nade. As it stands, the plugin will double the damage a player inflicts on themself, so make sure that attacker != victim.

5. For compatibility with CS:GO, you cannot use ForcePlayerSuicide directly in the OnTakeDamage function, or else it will cause srcds.exe to crash. Instead, you need to create a timer, such as:

Code:

if(mirrordamage < 0)
{
        CreateTimer(0.0, SlayTimer, attacker);
}

public Action:SlayTimer(Handle:timer, any:client)
{
        ForcePlayerSuicide(client);
}

6. You should also iterate through and hook clients in OnPluginStart or AskPluginLoad2, in case the plugin loaded late (after clients have already been put in the server).

neatek 01-10-2013 19:42

Re: [Any] Mirror Damage (sdkhooks)
 
Sheepdude, oh, thank you, it very helpful! :)
I will take your advice note.

healasuk 01-10-2013 22:41

Re: [Any] Mirror Damage (sdkhooks)
 
So say if you had the mod "tripmines" and a teamate blows up a tripmine beside you. Will it only kill the person to who blew the tripmine up?

Skyy 01-10-2013 23:53

Re: [Any] Mirror Damage (sdkhooks)
 
it depends on who the owner of that mine is. If the damage isn't owned by the player who activated it, the player won't be punished for it.

neatek 01-11-2013 15:41

Re: [Any] Mirror Damage (sdkhooks)
 
Sheepdude,
can you check it and give me some tips? // updated 12.01. (1.1rc)

AlfredSpain 03-25-2013 06:29

Re: [Any] Mirror Damage [12.01.2013]
 
I think it would be a good idea to add a new cvar so that when you shoot a teammate to harm him and you too.

Right now only cause you harm yourself.

Doc-Holiday 03-25-2013 08:37

Re: Re: [Any] Mirror Damage (sdkhooks)
 
Quote:

Originally Posted by Sheepdude (Post 1871076)
6. You should also iterate through and hook clients in OnPluginStart or AskPluginLoad2, in case the plugin loaded late (after clients have already been put in the server).

So using OnClientAuthorized() isn't a good idea? Just asking because I do this in about 10 different plugins

eric0279 03-25-2013 09:55

Re: [Any] Mirror Damage [12.01.2013]
 
Hello,
Work's for L4D2 ?

AlfredSpain 05-04-2013 19:24

Re: [Any] Mirror Damage [12.01.2013]
 
headshot = instant kill?

m22b 09-14-2013 13:36

Re: [Any] Mirror Damage [12.01.2013]
 
works with cs:go ? :)

neatek 09-14-2013 14:06

Re: [Any] Mirror Damage [12.01.2013]
 
Quote:

Originally Posted by m22b (Post 2034595)
works with cs:go ? :)

Please test it and post the reply here. Thank you.

friagram 09-14-2013 15:59

Re: [Any] Mirror Damage [12.01.2013]
 
You could do something like, scale the damage by hit, or add a doubling w/forgiveness model quite easily...
I commissioned something like this for someone, just set a base damage, and store time of last ff hit and number of hits in an array, and if last time > threshold, increment the count, hit them with multiplier.. So you can do like

10
20
40

Then if they stop for say 30s.. It starts over. At 10.
Also, give a warning in the hook ith like hinttext on the first multiplier.

snelvuur 09-20-2013 15:23

[Any] Mirror Damage [12.01.2013]
 
Could you add a random option?

So say a attacker has a 50/50% chance of either killing the player or getting killed.

neatek 09-25-2013 19:01

Re: [Any] Mirror Damage [12.01.2013]
 
Quote:

Originally Posted by friagram (Post 2034728)
You could do something like, scale the damage by hit, or add a doubling w/forgiveness model quite easily...
I commissioned something like this for someone, just set a base damage, and store time of last ff hit and number of hits in an array, and if last time > threshold, increment the count, hit them with multiplier.. So you can do like

10
20
40

Then if they stop for say 30s.. It starts over. At 10.
Also, give a warning in the hook ith like hinttext on the first multiplier.

maybe add this multiplier for round without checking time... every round multiplier will reset.
nice idea. and hinttext will be great)

Quote:

Originally Posted by snelvuur (Post 2038094)
Could you add a random option?

So say a attacker has a 50/50% chance of either killing the player or getting killed.

yes, ofc i can add it... next update will be soon.

indungi 01-12-2014 11:03

Re: [Any] Mirror Damage [12.01.2013]
 
Quote:

Originally Posted by neatek (Post 2034627)
Please test it and post the reply here. Thank you.

Is not working, tested few minutes ago.

pjzzz 11-10-2014 09:58

Re: [Any] Mirror Damage [12.01.2013]
 
Is this plugin still working?
Does it exclude bots?
Need something like this for Insurgency 2014

Neuro Toxin 11-13-2014 17:54

Re: [Any] Mirror Damage [12.01.2013]
 
https://forums.alliedmods.net/showthread.php?t=237011

This can do the same as this plugin.

If u need it to skip processing for bots leave a request and ill do it tonight for you

Kaniff 03-03-2015 13:26

Re: [Any] Mirror Damage [12.01.2013]
 
For some reason, when I use this it enables friendly fire. Even though when I type in "FF" in-game it tells me friendly fire is disabled? Any ideas? Thanks.

edit:

Used diff plug in. This one is messed up I think.

radicalzz 04-05-2015 12:08

Re: [Any] Mirror Damage [12.01.2013]
 
Is it possible to change so that teamdamage to the head only give back damage, not kill the shooter right away?

TiTz 03-26-2020 11:42

Re: [Any] Mirror Damage [12.01.2013]
 
Hi,
I know this a very old thread - but I'm hoping someone out there may take an interest and may help.
the plugin works for L4D1 apart from the cfg is not created - so i have to add the settings to the source code.

But I don't know enough about code to add a few more features.

the three features that would really enhance the plugin:

1. Instead of being killed - the player to be incapped. for L4D1

2. Also the the attackers ID to be printed to screen.

3. Also a CVAR for setting the amount of damage the attacker reflected damage vs the attacked player damage - EG: set attacker to recieve 10% damage and Attacked 1% or whatevers required.

Even even if 1 & 2 of the requests get made ... that would be great ... as the third would be much more complex.

Regards

TiTz


All times are GMT -4. The time now is 20:07.

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