View Single Post
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 12-03-2022 , 09:31   Re: [L4D2]Another method used to get the m_strMapSetScriptName of a melee weapon
Reply With Quote #4

The ID's change every map start, so don't cache them for other maps.

Left4DHooks provides the native
PHP Code:
/**
 * @brief Retrieve the index for a given melee weapon from the Melee Weapon Database.
 * @remarks Index updated on OnMapStart - suggest using RequestFrame to find index.
 * @remarks Index can change depending on available melee weapons each map.
 *
 * @param weaponName     Weapon to lookup index id for
 *
 * @return                The index id. Returns -1 if no match is found or melee unavailable.
 */
// L4D2 only.
native int L4D2_GetMeleeWeaponIndex(const char[] weaponName); 
__________________
Silvers is offline