Raised This Month: $ Target: $400
 0% 

Plugin that Blocks damage from enemies?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
dust2
Member
Join Date: Jun 2016
Old 10-01-2016 , 07:23   Plugin that Blocks damage from enemies?
Reply With Quote #1

Is there a plugin that would block any damage from enemies but still wouldn't enable godmode or falldamage?

All answers are appreciated!
dust2 is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 10-01-2016 , 09:08   Re: Plugin that Blocks damage from enemies?
Reply With Quote #2

If You need only enemies can't harm the player
PHP Code:
#include <sourcemod>
#include <sdkhooks>

public void OnPluginStart()
{
    for(
int i 1<= MaxClientsi++)
    {
        if(
IsClientInGame(i)) SDKHook(iSDKHook_OnTakeDamageEvent_OnTakeDamage);
    }
}

public 
void OnClientPutInServer(int client)
{
    
SDKHook(clientSDKHook_OnTakeDamageEvent_OnTakeDamage);
}

public 
void OnClientDisconnect(int client)
{
    
SDKUnhook(clientSDKHook_OnTakeDamageEvent_OnTakeDamage);
}

public 
Action Event_OnTakeDamage(int victimint &attackerint &inflictorfloat &damageint &damagetype)
{
    if(
victim != attacker && victim <= MaxClients && attacker <= MaxClients && IsClientInGame(victim) && IsClientInGame(attacker) && GetClientTeam(victim) == GetClientTeam(attacker))
    {
        
damage 0.0;
        return 
Plugin_Handled;
    }
    return 
Plugin_Continue;

__________________
Grey83 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 09:48.


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