Raised This Month: $ Target: $400
 0% 

Damage friend fire


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
wEEk
Senior Member
Join Date: Sep 2012
Old 05-01-2016 , 01:23   Damage friend fire
Reply With Quote #1

Hello, I wish you could Toggle friendly fire but none cause any damaged a Player Is Possible ? , In any case only of the effect of beating and to draw blood
__________________
Aprendiendo de nadie
wEEk is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-01-2016 , 02:46   Re: Damage friend fire
Reply With Quote #2

What?
__________________
fysiks is offline
safetymoose
Senior Member
Join Date: Feb 2015
Old 05-01-2016 , 02:52   Re: Damage friend fire
Reply With Quote #3

Sure you can, just hook Ham_TakeDamage, check player's teams and return HAM_SUPERCEDE to block the damage.

Something like:
PHP Code:
#include <hamsandwich>
#include <cstrike>

// Plugin init
public plugin_init()
{
           
// Hook Ham_TakeDamage
           
Register_Ham(Ham_TakeDamage"player""fw_TakeDamage")
}

// Ham Take Damage Forward
public fw_TakeDamage(victiminflictorattackerFloat:damagedamage_type)
{
           
// Non-player damage or self damage
           
if (victim == attacker || !is_user_alive(attacker))
                 return 
HAM_IGNORED

           
// Check if they are from the same team and block damage
           
if (cs_get_user_team(attacker) == cs_get_user_team(victim))
                return 
HAM_SUPERCEDE

           
return HAM_IGNORED


Last edited by safetymoose; 05-01-2016 at 02:54.
safetymoose is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 05-01-2016 , 04:03   Re: Damage friend fire
Reply With Quote #4

Week , do you think it were more realistic to add aso some slap efect, i mean that player knows that he is being hit by teammate. I think it would be awesome
siriusmd99 is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 05-01-2016 , 06:20   Re: Damage friend fire
Reply With Quote #5

I think he wants only effects to take place (blood, punch, pain sound), but only block the damage.

That's why, Safetymoose, instead of completely blocking the TakeDamage call with HAM_SUPERCEDE, null the damage. I guess that should work.
PHP Code:
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>

#pragma semicolon 1

new PLUGIN[]  = "";
new 
AUTHOR[]  = "";
new 
VERSION[] = "0.00";

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
RegisterHam(Ham_TakeDamage"player""Player_TakeDamage"false);
}

public 
Player_TakeDamage(thisiInflictoriAttackerFloatfDamagebitsDamageType)
{
    if(
iAttacker != this && is_user_alive(iAttacker) && cs_get_user_team(iAttacker) == cs_get_user_team(this))
    {
        
SetHamParamFloat(40.0);
        return 
HAM_HANDLED;
    }
    
    return 
HAM_IGNORED;


Last edited by klippy; 05-01-2016 at 06:20.
klippy 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 18:34.


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