Just check for DMG_SLASH instead of adding bunch of knife names to check. Also I like to check for late load before running loop.
PHP Code:
#pragma semicolon 1
#pragma newdecls required
#include <sourcemod>
#include <sdkhooks>
#include <sdktools>
bool g_bLateLoad;
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max) {
g_bLateLoad = late;
return APLRes_Success;
}
public void OnPluginStart() {
if (g_bLateLoad) {
for (int i = 1; i <= MaxClients; i++) {
if (!IsClientInGame(i)) {
continue;
}
SDKHook(i, SDKHook_OnTakeDamage, OnTakeDamage);
}
}
}
public void OnClientPostAdminCheck(int client) {
if (client > 0 && client <= MaxClients) {
SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
}
}
public Action OnTakeDamage(int victim, int &attacker, int &inflictor, float &damage, int &damagetype) {
if (IsClientInGame(victim) && IsPlayerAlive(victim) && victim != attacker) {
if (damagetype & DMG_SLASH) {
return Plugin_Handled;
}
}
return Plugin_Continue;
}