Raised This Month: $51 Target: $400
 12% 

A complete ban Knife for counter-terrorists only


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MayroN
Senior Member
Join Date: Aug 2017
Location: Kyiv
Old 03-01-2019 , 13:05   A complete ban Knife for counter-terrorists only
Reply With Quote #1

Tell me how to Automatically deny a knife in General,the special Forces, that he would be with the new Spawn hasn't even shown up?Here in this Code, the Knife can only be manually thrown and it starts when you spawn.
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

#define PLUGIN    "Knife Drop"
#define AUTHOR    "Alucard"
#define VERSION    "1.0"

new p_Type

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_cvar("knife_drop"VERSION,FCVAR_SERVER|FCVAR_SPONLY)
    
    
RegisterHam(Ham_CS_Item_CanDrop"weapon_knife""KnifeDrop")
    
    
register_clcmd("drop""HookCmdDrop")
    
    
p_Type register_cvar("kd_type""1")
}

public 
KnifeDrop(ent)
{
    if(
get_pcvar_num(p_Type) == 1)    
        
SetHamReturnInteger(1)
    
    return 
HAM_SUPERCEDE
}

public 
HookCmdDrop(id)
{    
    if(
get_user_team(id) == && get_user_weapon(id) == CSW_KNIFE)
    {
        if(
get_pcvar_num(p_Type) == 1)
        {            
            
ham_strip_weapon(id"weapon_knife")
            return 
PLUGIN_HANDLED
        
}
    }
    return 
PLUGIN_CONTINUE
}

stock ham_strip_weapon(id,weapon[])
{
    if(!
equal(weapon,"weapon_",7) ) return 0
    
    
new wId get_weaponid(weapon)
    if(!
wId) return 0
    
    
new wEnt
    
while( (wEnt engfunc(EngFunc_FindEntityByString,wEnt,"classname",weapon) ) && pev(wEnt,pev_owner) != id) {}
    if(!
wEnt) return 0
    
    
if(get_user_weapon(id) == wIdExecuteHamB(Ham_Weapon_RetireWeapon,wEnt)
    
    if(!
ExecuteHamB(Ham_RemovePlayerItem,id,wEnt) ) return 0
    ExecuteHamB
(Ham_Item_Kill,wEnt)
    
    
set_pev(id,pev_weapons,pev(id,pev_weapons) & ~(1<<wId) )
    
    return 
1

MayroN is offline
Send a message via ICQ to MayroN Send a message via Skype™ to MayroN
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 23:03.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode