I used to implement such plugins a while ago.
All you need is to hook chat messages, block them, form new messages with prepended weapon type and send it further:
Код
public Action OnClientSayCommand(int client, const char[] command, const char[] sArgs)
{
if(sArgs[0] != '!')
return Plugin_Continue;
int len = strlen(sArgs[1]);
decl String:newcmd[128] = "say123";
FakeClientCommand(client, newcmd); //that's only an idea
return Plugin_Handled; // here you block original command
}
Get client weapon:
https://sm.alliedmods.net/new-api/clients/GetClientWeapon
If you want it to be shown only once, you can hook the most relevant event and iterate through all alive players via for loop in it.
to hook an event: https://sm.alliedmods.net/new-api/events/HookEvent
a list of events: https://wiki.alliedmods.net/Game_Events_(Source)