Raised This Month: $ Target: $400
 0% 

Changing models


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
GhostMan
Senior Member
Join Date: Jun 2012
Old 09-14-2012 , 13:16   Changing models
Reply With Quote #1

I'm wondering if i'm changing player's hands and "player" models correctly. Maby there is any way to optimise it?

PHP Code:
new const fist_models[][] = { "models/p_bknuckles.mdl""models/v_bknuckles.mdl" }
new const 
crowbar_models[][] = { "models/p_crowbar.mdl""models/v_crowbar.mdl" }
new const 
fist_sounds[][] = { "weapons/cbar_hitbod2.wav""weapons/cbar_hitbod1.wav""weapons/bullet_hit1.wav""weapons/bullet_hit2.wav" }

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()
{
    static 
i
    
    
for(0sizeof fist_modelsi++)
        
precache_model(fist_models[i])
    
    for(
0sizeof fist_soundsi++)
        
precache_sound(fist_sounds[i])
    
    for(
0sizeof crowbar_modelsi++)
        
precache_model(crowbar_models[i])
        
    
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[])
{
    if(
get_pcvar_num(cvar_fists))
    {
        if(
is_user_alive(id))
        {
            if(
equal(sample"weapons/knife_"14))
            {
                if(
equal(sample"weapons/knife_hit"17))
                {
                    
emit_sound(idCHAN_WEAPON"weapons/bullet_hit2.wav"random_float(0.51.0), ATTN_NORM0PITCH_NORM)
                    return 
FMRES_SUPERCEDE
                
}
                else if(
equal(sample,"weapons/knife_stab.wav"))
                {
                    
emit_sound(idCHAN_WEAPON"weapons/cbar_hitbod2.wav"1.0ATTN_NORM0PITCH_NORM)    
                    return 
FMRES_SUPERCEDE
                
}
                else if(
equal(sample,"weapons/knife_hitwall1.wav"))
                {
                    
emit_sound(idCHAN_WEAPON"weapons/cbar_hitbod1.wav"1.0ATTN_NORM0PITCH_LOW)
                    return 
FMRES_SUPERCEDE            
                
}        
            }
        }        
    }
    return 
FMRES_IGNORED
}

public 
CurWeapon(id)
{
    if(
is_user_alive(id)) 
    {        
        if(
get_pcvar_num(cvar_fists) && id != crowbaruser
        {
            
set_pev(idpev_viewmodel2fist_models[1])
            
set_pev(idpev_weaponmodel2fist_models[0])    
        }    
        else if(
get_pcvar_num(cvar_crowbar) && id == crowbaruser// Don't look here, it checks for specified player. The player is randomly chosen on round start.
        
{
            
set_pev(idpev_viewmodel2crowbar_models[1])
            
set_pev(idpev_weaponmodel2crowbar_models[0])            
        }
    }
}

public 
client_spawn(id)
{    
    if(!
is_user_connected(id) || !is_user_alive(id))
        return
    
    new 
CsTeams:team
    team 
cs_get_user_team(id)
        
    if(
team == CS_TEAM_T
    {
        
cs_set_player_model(id"amx_t_nike")
    }
    else if (
team == CS_TEAM_CT
    {
        
cs_set_player_model(id"amx_ct_puma")    
    }

GhostMan 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