View Single Post
ReFlexPoison
☠☠☠
Join Date: Jul 2011
Location: ☠☠☠
Old 07-19-2012 , 03:47   Re: Any good Team Kill protection for CS:S?
Reply With Quote #6

Quote:
Originally Posted by Hunter S. Thompson View Post
You know, I've looked through your threads and it seems that you're just asking for plugin after plugin. Especially with something that's quite easy to write yourself.

Code:
#pragma semicolon 1

#include <sourcemod>

public OnPluginStart()
{
    HookEvent("player_death", PlayerDeath);
}

public Action:PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    new client = GetClientOfUserId(GetEventInt(event, "userid"));
    new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
    
    decl String:attTeam[128], String:userTeam[128];
    GetTeamName(attacker, attTeam, sizeof(attTeam));
    GetTeamName(client, userTeam, sizeof(userTeam));
    
    if (StrEquals(attTeam, userTeam))
    {
        ForcePlayerSuicide(attacker);
    }
}
Of course, other plugins go into a lot more detail, but this is so very simple.
Hell, why not use SDKHooks and block the damage completely then send damage back to the attacker?
ReFlexPoison is offline