Advertisement
iFenomenal

Untitled

Jan 29th, 2019
441
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.96 KB | None | 0 0
  1. #include < amxmodx >
  2. #include < hamsandwich >
  3. #include < fakemeta >
  4.  
  5. #define VIP_FLAG read_flags("muie")
  6.  
  7. new const g_szVipModelT[ ] = "vip_model_t" ;
  8. new const g_szVipModelCT[ ] = "vip_model_ct" ;
  9.  
  10. public plugin_init( ) {
  11.  
  12.     register_plugin( "VIP Model", "1.1", "iFenomenal" ) ;
  13.  
  14.     register_forward( FM_SetClientKeyValue, "fw_FMSetClientKeyValuePre", 0 ) ;
  15.    
  16.     RegisterHam( Ham_Spawn, "player", "fw_HamSpawnPost", 1 ) ;
  17. }
  18.  
  19. public plugin_precache( ) {
  20.  
  21.     new szModelT[ 64 ], szModelCT[ 64 ] ;
  22.    
  23.     formatex( szModelT, charsmax( szModelT ), "models/player/%s/%s.mdl", g_szVipModelT, g_szVipModelT ) ;
  24.     precache_model( szModelT ) ;
  25.    
  26.     formatex( szModelCT, charsmax( szModelCT ), "models/player/%s/%s.mdl", g_szVipModelCT, g_szVipModelCT ) ;
  27.     precache_model( szModelCT ) ;
  28. }
  29.  
  30. public fw_HamSpawnPost( id ) {
  31.  
  32.     if( ! is_user_alive( id ) )
  33.     return HAM_IGNORED ;
  34.    
  35.     if( ~ get_user_flags( id ) & VIP_FLAG )
  36.     return HAM_IGNORED ;
  37.    
  38.     switch( get_user_team( id ) ) {
  39.        
  40.     case 1: {
  41.            
  42.             set_user_info( id, "model", g_szVipModelT ) ;
  43.         }
  44.        
  45.     case 2: {
  46.            
  47.             set_user_info( id, "model", g_szVipModelCT ) ;
  48.         }
  49.     }
  50.  
  51.     return HAM_IGNORED ;
  52. }
  53.  
  54. public fw_FMSetClientKeyValuePre( iPlayer, const szBuffer[ ], const szKey[ ] ) {
  55.  
  56.     if( equal( szKey, "model" ) ) {
  57.        
  58.         if( get_user_flags( iPlayer ) & VIP_FLAG ) {
  59.  
  60.             switch( get_user_team( iPlayer ) ) {
  61.                
  62.             case 1: {
  63.                    
  64.                     set_user_info( iPlayer, "model", g_szVipModelT ) ;
  65.                     return FMRES_SUPERCEDE ;
  66.                 }
  67.                
  68.             case 2: {
  69.                    
  70.                     set_user_info( iPlayer, "model", g_szVipModelCT ) ;
  71.                     return FMRES_SUPERCEDE ;
  72.                 }
  73.             }
  74.         }
  75.     }
  76.    
  77.     return FMRES_IGNORED ;
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement