View Single Post
SM9
Veteran Member
Join Date: Sep 2013
Location: United Kingdom
Old 10-15-2018 , 14:06   Re: [CSGO] Blocking Left knife
Reply With Quote #13

This version works perfectly without any client side prediction issues, It also has no need for comparing classnames or definition indexes therefore is future proof and will work with any knife valve ever adds to the game.

PHP Code:
#include <sdktools>
#include <cstrike>

public Plugin myinfo 
{
    
name "Block Left Knife"
    
author "Bara, [Updated by The Killer [NL], SM9();]",
    
description "Block Left Knife"
    
version "2.4"
    
url "www.bara.in, www.upvotegaming.com"
}

public 
Action OnPlayerRunCmd(int iClientint iButtonsint iImpulsefloat vVelocity[3], float vAngles[3], int iWeapon)
{
    if (!
IsClientInGame(iClient) || !IsPlayerAlive(iClient)) {
        return 
Plugin_Continue;
    }
    
    
int iKnife GetPlayerWeaponSlot(iClientCS_SLOT_KNIFE);
    
    if(
iKnife == -|| !IsValidEntity(iKnife)) {
        return 
Plugin_Continue;
    }
    
    
SetEntPropFloat(iKnifeProp_Send"m_flNextPrimaryAttack"GetGameTime() + 1.0);
    
    if(
iKnife != iWeapon) {
        return 
Plugin_Continue;
    }
    
    
iButtons &= ~IN_ATTACK;
    
    return 
Plugin_Changed;

Attached Files
File Type: sp Get Plugin or Get Source (blockleftknifeupkiller.sp - 266 views - 837 Bytes)
SM9 is offline