Raised This Month: $ Target: $400
 0% 

Damage friend fire


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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