View Single Post
emvaized
Junior Member
Join Date: Aug 2021
Old 09-15-2021 , 22:20   Re: [CSGO] Axe and hammer pick up
Reply With Quote #22

Quote:
Originally Posted by Papero View Post
This will make you pickup all the new melee weapons.
Note that this is intended to be used with mp_drop_knife_enable set to 1, or you won't be able to drop your knife to pickup a dropped axe/wrench/hammer.
PHP Code:
public void OnPluginStart()
{
    
//Lateload
    
for (int i 1<= MaxClientsi++) if (IsClientInGame(i)) OnClientPutInServer(i);
}

public 
void OnClientPutInServer(int client)
{
    
SDKHook(clientSDKHook_WeaponCanUseHook_WeaponCanUse);
}

public 
Action Hook_WeaponCanUse(int clientint weapon)
{
    
char classname[64];
    
GetEntityClassname(weaponclassnamesizeof classname);
    
    if (
StrEqual(classname"weapon_melee") && !(HasWeapon(client"weapon_melee") || HasWeapon(client"weapon_knife")))
        
EquipPlayerWeapon(clientweapon);
}

stock bool HasWeapon(int client, const char[] classname)
{
    
int index;
    
int weapon;
    
char sName[64];
    
    while((
weapon GetNextWeapon(clientindex)) != -1)
    {
        
GetEdictClassname(weaponsNamesizeof(sName));
        if (
StrEqual(sNameclassname))
            return 
true;
    }
    return 
false;
}

stock int GetNextWeapon(int clientint &weaponIndex)
{
    static 
int weaponsOffset = -1;
    if (
weaponsOffset == -1)
        
weaponsOffset FindDataMapInfo(client"m_hMyWeapons");
    
    
int offset weaponsOffset + (weaponIndex 4);
    
    
int weapon;
    while (
weaponIndex 48
    {
        
weaponIndex++;
        
        
weapon GetEntDataEnt2(clientoffset);
        
        if (
IsValidEdict(weapon)) 
            return 
weapon;
        
        
offset += 4;
    }
    
    return -
1;

I've attached another plugin, if you'd like to play with the breaching charges throwing more than 3 at the same time, just use sm_breaches and it will fill you breach charge amount.
Is it something on my server, or it doesn't work with bots? They still couldn't grab the melee weapons, while living players can

Last edited by emvaized; 09-15-2021 at 22:21. Reason: Clarification
emvaized is offline