This should work, but the way the player will hold the weapon will be appropriately to the actual weapon he is using.
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#define VERSION "1.0"
new const SZ_PRECACHE[] = "models/p_m4a1.mdl";
new g_szAllocedPModel
public plugin_precache()
{
precache_model(SZ_PRECACHE);
}
public plugin_init()
{
register_clcmd("wpn", "Cmd_WpnModelChange");
g_szAllocedPModel = engfunc(EngFunc_AllocString, SZ_PRECACHE);
}
public Cmd_WpnModelChange(id)
{
if(read_argc() != 2)
{
return PLUGIN_HANDLED;
}
new arg[32];
read_argv(1, arg, charsmax(arg));
new tar = cmd_target(id, arg, CMDTARGET_ALLOW_SELF | CMDTARGET_ONLY_ALIVE);
if(!tar)
{
return PLUGIN_HANDLED;
}
new pModel[22];
pev(tar, pev_weaponmodel2, pModel, charsmax(pModel));
if(!equal(pModel, SZ_PRECACHE))
{
set_pev(tar, pev_weaponmodel, g_szAllocedPModel);
}
return PLUGIN_HANDLED;
}
Type in console: wpn <target name>.
I.E: wpn Dores
And see if his gun looks like a M4A1.
Notes: Might cause weird things as invisibility of the weapon from different view angles.
This code is just an example.
__________________