AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Changing V_model Animation - Kinda buggy (https://forums.alliedmods.net/showthread.php?t=133985)

Gadzislaw007 07-30-2010 16:02

Changing V_model Animation - Kinda buggy
 
Well, another problem.

Global:
PHP Code:

new loaded[33

Register:
PHP Code:

    RegisterHam(Ham_Weapon_Deploy"weapon_knife""knife_deploy");
    
RegisterHam(Ham_Weapon_PrimaryAttack"weapon_knife""knife_attack");
    
RegisterHam(Ham_Weapon_SecondaryAttack"weapon_knife""knife_attack2"); 


PHP Code:

public knife_deploy( const iEntity ) {
            new 
id get_pdata_cbaseiEntitym_pPlayer)
        
entity_set_string(idEV_SZ_viewmodel"models/v_rpg.mdl")
        
entity_set_string(idEV_SZ_weaponmodel"models/p_rpg.mdl")
        if(
loaded[id])//if is loaded
        
{
            
set_pdata_floatiEntitym_flNextSecondaryAttack99999.0); // disable loading
            
set_pdata_floatiEntitym_flNextPrimaryAttack0.5); // enable firing
            
message_begin(MSG_ONESVC_WEAPONANIM_id)///set animation
            
write_byte(0//idle1
            
write_byte(pev(id,pev_body))
            
message_end()
                    }
        if(!
loaded[id])// if is unloaded
        
{
            
set_pdata_floatiEntitym_flNextSecondaryAttack0.5); // enable loading
            
set_pdata_floatiEntitym_flNextPrimaryAttack9999.0); // disable firing
            
message_begin(MSG_ONESVC_WEAPONANIM_id)///set animation
            
write_byte(8//idle2
            
write_byte(pev(id,pev_body))
            
message_end()  
        }


        
}

public 
knife_attack( const iEntity ) {
    new 
id get_pdata_cbaseiEntitym_pPlayer)
        
loaded[id] = 0
        set_task
(2.0"check_bazooka"id// set idle2 anim.
        
message_begin(MSG_ONESVC_WEAPONANIM_id// set animation 
        
write_byte(3//fire
        
write_byte(pev(id,pev_body))
        
message_end()  
        
fire_rocket(id)//fire rocket
        
set_pdata_floatiEntitym_flNextSecondaryAttack3.0); /// enable loading
        
set_pdata_floatiEntitym_flNextPrimaryAttack99999.0); // disable firing
        
emit_sound(idCHAN_VOICE"weapons/glauncher.wav"VOL_NORMATTN_NORM0PITCH_NORM)
        
}

public 
knife_attack2( const iEntity ) {
            new 
id get_pdata_cbaseiEntitym_pPlayer)    
        
loaded[id] = // is loaded
        
set_task(2.5"check_bazooka"id// set idle animation
         
set_pdata_floatiEntitym_flNextSecondaryAttack9999.0); // disable loading
        
set_pdata_floatiEntitym_flNextPrimaryAttack2.5); // enable firing
        
message_begin(MSG_ONESVC_WEAPONANIM_id)/// set animation
        
write_byte(2///reload
        
write_byte(pev(id,pev_body))
        
message_end()  
        



Sometimes animation gets bugged and sometimes (ussualy, when I'm ducking or running backward) instead of reloading it plays draw2 animation.
Is there any other method to do this? SVC_WEAPONANIM is kinda buggy :(.


All times are GMT -4. The time now is 00:18.

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