1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#pragma semicolon 1
#include <sourcemod>
#include <sdkhooks>
#pragma newdecls required
public Plugin myinfo =
{
name = "No Knife Damage",
author = "Bara",
description = "",
version = "1.0.0",
url = "git.tf/Bara"
}
public void OnPluginStart()
{
for(int i = 1; i <= MaxClients; i++)
if(IsClientInGame(i))
SDKHook(i, SDKHook_TraceAttack, OnTraceAttack);
}
public void OnClientPutInServer(int client)
{
SDKHook(client, SDKHook_TraceAttack, OnTraceAttack);
}
public Action OnTraceAttack(int victim, int &attacker, int &inflictor, float &damage, int &damagetype, int &ammotype, int hitbox, int hitgroup)
{
if(IsClientInGame(attacker))
{
char sWeapon[32];
GetClientWeapon(attacker, sWeapon, sizeof(sWeapon));
if(StrContains(sWeapon, "knife", false) != -1 || StrContains(sWeapon, "bayonet", false) != -1)
return Plugin_Handled;
}
return Plugin_Continue;
}
|