I'm working on some code for a plugin that swaps out any rocket launchers the soldier may be carrying, into an Original. For a Quake-style Rocket Arena Game Type... The only problem is, if someone is carrying the Stock Rocket Launcher (not renamed or Strange), it will get stripped entirely from them, being stuck with only a secondary and melee. If you have any other type of RL equipped, such as the direct hit, or a renamed stock RL, it works fine.
Here is my code:
PHP Code:
public Action:TF2Items_OnGiveNamedItem(client, String:classname[], iItemDefinitionIndex, &Handle:hItem)
{
if(IsValidClient(client))
{
if(StrEqual(classname, "tf_weapon_rocketlauncher", false) && GetConVarBool(cv_quake))
{
PrintToChat(client, "[StrikerMod] Quake Mode is on - Switching to Original");
new Handle:hWeapon = TF2Items_CreateItem(OVERRIDE_ALL|FORCE_GENERATION);
TF2Items_SetClassname(Handle:hWeapon, "tf_weapon_rocketlauncher");
TF2Items_SetItemIndex(Handle:hWeapon, 513);
TF2Items_SetLevel(Handle:hWeapon, 99);
TF2Items_SetQuality(Handle:hWeapon, 9);
TF2Items_SetNumAttributes(Handle:hWeapon, 4);
TF2Items_SetAttribute(Handle:hWeapon, 0, 58, 1.25);
TF2Items_SetAttribute(Handle:hWeapon, 1, 103, 1.5);
TF2Items_SetAttribute(Handle:hWeapon, 2, 135, 0.8);
TF2Items_SetAttribute(Handle:hWeapon, 3, 289, 1.0);
hItem = hWeapon;
return Plugin_Changed;
}
}
return Plugin_Continue;
}