Simply put, OVERRIDE_CLASSNAME hasn't worked in the TF2Items_OnGiveNamedItem callback for some time.
For instance, I tried this a while back in Huntsman Hell:
PHP Code:
public Action:TF2Items_OnGiveNamedItem(client, String:classname[], iItemDefinitionIndex, &Handle:hItem)
{
static Handle:item = INVALID_HANDLE;
if (!GetConVarBool(g_Cvar_Enabled))
{
return Plugin_Continue;
}
if (item != INVALID_HANDLE)
{
CloseHandle(item);
item = INVALID_HANDLE;
}
// Give the player a Huntsman instead of a Sniper Rifle
if (StrEqual(classname, "tf_weapon_sniperrifle") || StrEqual(classname, "tf_weapon_sniperrifle_decap"))
{
item = TF2Items_CreateItem(OVERRIDE_ALL);
TF2Items_SetClassname(item, "tf_weapon_compound_bow");
TF2Items_SetItemIndex(item, 56);
TF2Items_SetLevel(item, 10);
TF2Items_SetQuality(item, 6);
TF2Items_SetNumAttributes(item, 2);
TF2Items_SetAttribute(item, 0, 37, 0.5);
TF2Items_SetAttribute(item, 1, 328, 1.0);
hItem = item;
return Plugin_Changed;
}
// Other logic omitted for replacing SMGs and blocking sniper shields
return Plugin_Continue;
What this should have done is give the player a Huntsman instead of a Sniper Rifle. What it actually does is not give the player a primary weapon at all. At least it doesn't on Linux.
This has been broken for quite some time now... is there any fix for this on the horizon?
__________________