View Single Post
`666
AlliedModders Donor
Join Date: Jan 2006
Old 05-14-2022 , 04:07   Re: No knife damage? [CS:GO]
Reply With Quote #10

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 myselfbool latechar[] errorint err_max) {
    
g_bLateLoad late;
    return 
APLRes_Success;
}

public 
void OnPluginStart() {
    if (
g_bLateLoad) {
        for (
int i 1<= MaxClientsi++) {
            if (!
IsClientInGame(i)) {
                continue;
            }
            
SDKHook(iSDKHook_OnTakeDamageOnTakeDamage);
        }
    }
}

public 
void OnClientPostAdminCheck(int client) {
    if (
client && client <= MaxClients) {
        
SDKHook(clientSDKHook_OnTakeDamageOnTakeDamage);
    }
}

public 
Action OnTakeDamage(int victimint &attackerint &inflictorfloat &damageint &damagetype) {
    if (
IsClientInGame(victim) && IsPlayerAlive(victim) && victim != attacker) {
        if (
damagetype DMG_SLASH) {
            return 
Plugin_Handled;
        }
    }
    return 
Plugin_Continue;

`666 is offline