View Single Post
DON KHAN 1
Senior Member
Join Date: Mar 2019
Location: Pakistan
Old 08-20-2019 , 12:32   Re: Realistic Deagle v1.2
Reply With Quote #16

PHP Code:
#include <amxmodx> 
#include <engine> 

#define oldAK "models/v_ak47.mdl" 
#define newAK "models/v_ak47_z.mdl"

#define oldDG "models/v_deagle.mdl"
#define newDG "models/v_deagle_z.mdl" 

new bool:g_inZoom[33], Float:g_lastZoom[33]; 
new 
g_HideWeapon

public 
plugin_init() 

    
register_plugin("Realistic Weapons""1.0""thEsp"); 
    
g_HideWeapon get_user_msgid("HideWeapon"); 


public 
plugin_precache() 

    
precache_model(oldAK); 
    
precache_model(newAK); 
    
precache_model(oldDG);
    
precache_model(newDG);


public 
client_cmdStart(id

    if(
g_lastZoom[id] > get_gametime() || !(get_usercmd(usercmd_buttons) & IN_ATTACK2) || get_user_weapon(id) != CSW_AK47
        return 
PLUGIN_CONTINUE

    
g_lastZoom[id] = get_gametime() + 0.25

    if(
g_inZoom[id]) 
    { 
        
entity_set_string(idEV_SZ_viewmodeloldDG); 

        
message_begin(MSG_ONEg_HideWeapon_id); 
        
write_byte(0<<6); 
        
message_end(); 
    } 
    else 
    { 
        
entity_set_string(idEV_SZ_viewmodelnewDG); 

        
message_begin(MSG_ONEg_HideWeapon_id); 
        
write_byte(1<<6); 
        
message_end(); 
    } 
    if(
g_inZoom[id]) 
    { 
        
entity_set_string(idEV_SZ_viewmodeloldDG); 

        
message_begin(MSG_ONEg_HideWeapon_id); 
        
write_byte(0<<6); 
        
message_end(); 
    } 
    else 
    { 
        
entity_set_string(idEV_SZ_viewmodelnewDG); 

        
message_begin(MSG_ONEg_HideWeapon_id); 
        
write_byte(1<<6); 
        
message_end(); 
    } 

    
g_inZoom[id] = !g_inZoom[id]; 
    return 
PLUGIN_CONTINUE


public 
client_disconnect(id

    
g_inZoom[id] = false
    
g_lastZoom[id] = 0.0

more weapons can be register in this plugin like i registered the ak47, not tested but compile perfectly.

its a very nice plugin and ur awesome efforts.
__________________
Facebook
My YouTube
Ro{Y}aL WarLanD CommuniTy
Selling Zombie CSO 4.3 Money System Mod

Last edited by DON KHAN 1; 08-20-2019 at 12:34.
DON KHAN 1 is offline