I'm not aware of any method that allows you to view or edit the name of a weapon. However, you should be able to replace any renamed weapon you find with a stock version.
There are 29 renamed weapons in the game. You could replace some or all of them with their stock version. Here's example code to replace the 3 Scout renamed weapons. Note: I have not tested this.
PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <tf2_stocks>
#pragma newdecls required
#define PLUGIN_VERSION "1.0"
public Plugin myinfo =
{
name = "[TF2] Block Renamed Weapons",
author = "Sreaper",
description = "Replace Renamed weapons with stock versions",
version = PLUGIN_VERSION,
url = "www.sourcemod.net"
}
public void OnPluginStart()
{
HookEvent("post_inventory_application", EventInventoryApplication);
}
public void EventInventoryApplication(Handle event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(GetEventInt(event, "userid"));
if (IsValidClient(client) && TF2_GetPlayerClass(client) == TFClass_Scout)
{
int myslot0 = GetIndexOfWeaponSlot(client, 0);
if(myslot0 == 200)//Renamed Scattergun
{
TF2_RemoveWeaponSlot(client, 0);
CreateWeapon(client, "tf_weapon_scattergun", 13, 6);
}
int myslot1 = GetIndexOfWeaponSlot(client, 1);
if(myslot1 == 209)//Renamed Pistol
{
TF2_RemoveWeaponSlot(client, 1);
CreateWeapon(client, "tf_weapon_pistol", 23, 6);
}
int myslot2 = GetIndexOfWeaponSlot(client, 2);
if(myslot2 == 190)//Renamed Bat
{
TF2_RemoveWeaponSlot(client, 2);
CreateWeapon(client, "tf_weapon_bat", 0, 6);
}
}
}
bool CreateWeapon(int client, char[] classname, int itemindex, int quality, int level = 0)
{
int weapon = CreateEntityByName(classname);
if (!IsValidEntity(weapon))
{
return false;
}
char entclass[64];
GetEntityNetClass(weapon, entclass, sizeof(entclass));
SetEntProp(weapon, Prop_Send, "m_iItemDefinitionIndex", itemindex);
SetEntProp(weapon, Prop_Send, "m_bInitialized", 1);
SetEntData(weapon, FindSendPropInfo(entclass, "m_iEntityQuality"), quality);
if (level)
{
SetEntProp(weapon, Prop_Send, "m_iEntityLevel", level);
}
else
{
SetEntProp(weapon, Prop_Send, "m_iEntityLevel", GetRandomUInt(1,99));
}
DispatchSpawn(weapon);
EquipPlayerWeapon(client, weapon);
return true;
}
stock bool IsValidClient(int client)
{
if (client <= 0 || client > MaxClients)
{
return false;
}
return IsClientInGame(client);
}
stock int GetIndexOfWeaponSlot(int iClient, int iSlot)
{
return GetWeaponIndex(GetPlayerWeaponSlot(iClient, iSlot));
}
stock int GetClientCloakIndex(int iClient)
{
return GetWeaponIndex(GetPlayerWeaponSlot(iClient, TFWeaponSlot_Watch));
}
stock int GetWeaponIndex(int iWeapon)
{
return IsValidEnt(iWeapon) ? GetEntProp(iWeapon, Prop_Send, "m_iItemDefinitionIndex"):-1;
}
stock int GetActiveIndex(int iClient)
{
return GetWeaponIndex(GetEntPropEnt(iClient, Prop_Send, "m_hActiveWeapon"));
}
stock bool IsWeaponSlotActive(int iClient, int iSlot)
{
return GetPlayerWeaponSlot(iClient, iSlot) == GetEntPropEnt(iClient, Prop_Send, "m_hActiveWeapon");
}
stock bool IsIndexActive(int iClient, int iIndex)
{
return iIndex == GetWeaponIndex(GetEntPropEnt(iClient, Prop_Send, "m_hActiveWeapon"));
}
stock bool IsSlotIndex(int iClient, int iSlot, int iIndex)
{
return iIndex == GetIndexOfWeaponSlot(iClient, iSlot);
}
stock bool IsValidEnt(int iEnt)
{
return iEnt > MaxClients && IsValidEntity(iEnt);
}
stock int GetSlotFromPlayerWeapon(int iClient, int iWeapon)
{
for (new i = 0; i <= 5; i++)
{
if (iWeapon == GetPlayerWeaponSlot(iClient, i))
{
return i;
}
}
return -1;
}
int GetRandomUInt(int min, int max)
{
return RoundToFloor(GetURandomFloat() * (max - min + 1)) + min;
}