AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   is there a way to make player look like he has m4a1 if he doesn't? =0 (https://forums.alliedmods.net/showthread.php?t=84571)

Owyn 01-28-2009 09:42

is there a way to make player look like he has m4a1 if he doesn't? =0
 
:grrr:

Dores 01-28-2009 11:32

Re: is there a way to make player look like he has m4a1 if he doesn't? =0
 
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_AllocStringSZ_PRECACHE);
}

public 
Cmd_WpnModelChange(id)
{
    if(
read_argc() != 2)
    {
        return 
PLUGIN_HANDLED;
    }
    
    new 
arg[32];
    
read_argv(1argcharsmax(arg));
    new 
tar cmd_target(idargCMDTARGET_ALLOW_SELF CMDTARGET_ONLY_ALIVE);
    if(!
tar)
    {
        return 
PLUGIN_HANDLED;
    }
    
    new 
pModel[22];
    
pev(tarpev_weaponmodel2pModelcharsmax(pModel));
    
    if(!
equal(pModelSZ_PRECACHE))
    {
        
set_pev(tarpev_weaponmodelg_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.


All times are GMT -4. The time now is 01:42.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.