Raised This Month: $ Target: $400
 0% 

Changing models


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-14-2012 , 14:43   Re: Changing models
Reply With Quote #2

PHP Code:
new Trie:g_tFistSounds
new g_iszFistPModelg_iszFistVModelg_iszCrowbarPModelg_iszCrowbarVModel

public plugin_init() 
{
    
register_event("CurWeapon""CurWeapon""be""1=1""2=29")

    
register_forward(FM_EmitSound"EmitSound")

    
RegisterHam(Ham_Spawn"player""client_spawn"1)
}

public 
plugin_precache()
{
    
g_tFistSounds TrieCreate()

    new 
bullet_hit2[] = "weapons/bullet_hit2.wav"
    
new cbar_hitbod1[] = "weapons/cbar_hitbod1.wav"
    
new cbar_hitbod2[] = "weapons/cbar_hitbod2.wav"

    
TrieSetString(g_tFistSounds"weapons/knife_hit1.wav"bullet_hit2)
    
TrieSetString(g_tFistSounds"weapons/knife_hit2.wav"bullet_hit2)
    
TrieSetString(g_tFistSounds"weapons/knife_hit3.wav"bullet_hit2)
    
TrieSetString(g_tFistSounds"weapons/knife_hit4.wav"bullet_hit2)
    
TrieSetString(g_tFistSounds"weapons/knife_hitwall1.wav"cbar_hitbod1)
    
TrieSetString(g_tFistSounds"weapons/knife_stab.wav"cbar_hitbod2)

    new 
p_bknuckles[] = "models/p_bknuckles.mdl"
    
new v_bknuckles[] = "models/v_bknuckles.mdl"
    
new p_crowbar[] = "models/p_crowbar.mdl"
    
new v_crowbar[] = "models/v_crowbar.mdl"
    
g_iszFistPModel engfunc(EngFunc_AllocStringp_bknuckles)
    
g_iszFistVModel engfunc(EngFunc_AllocStringv_bknuckles)
    
g_iszCrowbarPModel engfunc(EngFunc_AllocStringp_crowbar)
    
g_iszCrowbarVModel engfunc(EngFunc_AllocStringv_crowbar)

    
precache_soundbullet_hit2 )
    
precache_soundcbar_hitbod1 )
    
precache_soundcbar_hitbod2 )

    
precache_modelp_bknuckles )
    
precache_modelv_bknuckles )
    
precache_modelp_crowbar )
    
precache_modelv_crowbar )

    
precache_model("models/player/amx_t_nike/amx_t_nike.mdl")
    
precache_model("models/player/amx_ct_puma/amx_ct_puma.mdl")
}

public 
EmitSound(idchannelsample[], Float:volFloat:attnflagspitch)
{
    if (
get_pcvar_num(cvar_fists) && is_user_alive(id) )
    {
        new 
szSound[32]
        if( 
TrieGetString(g_tFistSoundssampleszSoundcharsmax(szSound)) )
        {
            
emit_sound(idchannelszSoundvolattnflagspitch)
            return 
FMRES_SUPERCEDE
        
}    
    }
    return 
FMRES_IGNORED
}

public 
CurWeapon(id)
{
    if( 
is_user_alive(id) ) 
    {
        if( 
id == crowbaruser )
        {
            
set_pev(idpev_viewmodelg_iszCrowbarVModel)
            
set_pev(idpev_weaponmodelg_iszCrowbarPModel
        }
        else if( 
get_pcvar_num(cvar_fists) )
        {
            
set_pev(idpev_viewmodelg_iszFistVModel)
            
set_pev(idpev_weaponmodelg_iszFistPModel)  
        }
    }
}

public 
client_spawn(id)
{    
    if( 
is_user_aliveid ) )
    {
        switch( 
cs_get_user_team(id) )
        {
            case 
CS_TEAM_T:cs_set_player_model(id"amx_t_nike")
            case 
CS_TEAM_CT:cs_set_player_model(id"amx_ct_puma")
        }
    }

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 09-15-2012 at 05:47.
ConnorMcLeod is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:16.


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