|
Junior Member
|
09-15-2021
, 22:20
Re: [CSGO] Axe and hammer pick up
|
#22
|
Quote:
Originally Posted by Papero
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; i <= MaxClients; i++) if (IsClientInGame(i)) OnClientPutInServer(i); }
public void OnClientPutInServer(int client) { SDKHook(client, SDKHook_WeaponCanUse, Hook_WeaponCanUse); }
public Action Hook_WeaponCanUse(int client, int weapon) { char classname[64]; GetEntityClassname(weapon, classname, sizeof classname); if (StrEqual(classname, "weapon_melee") && !(HasWeapon(client, "weapon_melee") || HasWeapon(client, "weapon_knife"))) EquipPlayerWeapon(client, weapon); }
stock bool HasWeapon(int client, const char[] classname) { int index; int weapon; char sName[64]; while((weapon = GetNextWeapon(client, index)) != -1) { GetEdictClassname(weapon, sName, sizeof(sName)); if (StrEqual(sName, classname)) return true; } return false; }
stock int GetNextWeapon(int client, int &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(client, offset); 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
|
|
|
|