Advertisement
ColdWar-Pawn

HNR FrostNades

Dec 27th, 2012
782
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 4.41 KB | None | 0 0
  1. /* Plugin generated by AMXX-Studio */
  2.  
  3. #include < amxmodx >
  4. #include < fakemeta >
  5.  
  6. #define TASK_EXPLODE(%1) ( 799 + %1 )
  7. #define UNTASK_EXPLODE(%1) ( %1 - 799)
  8.  
  9. #define TASK_UNFREEZE(%1) ( 899 + %1 )
  10. #define UNTASK_UNFREEZE(%1) ( %1 - 899 )
  11.  
  12. new bool: g_bFreezed[ 33 ], g_iBeaconSprite;
  13.  
  14. enum _:FrostSounds
  15. {
  16.     Explode,
  17.     Hit,
  18.     Unfreeze
  19. }
  20.  
  21. new const szFrostSoundsPath[ FrostSounds ][ ] = {
  22.     "warcraft3/frostnova.wav",
  23.     "warcraft3/impalehit.wav",
  24.     "warcraft3/impalelaunch1.wav"
  25. }
  26.  
  27. new const plugin_info[ 3 ][ ] = {
  28.     "Hit And Run Frost Nades",
  29.     "v0.1",
  30.     "+ColdWar"
  31. }
  32.  
  33. public plugin_precache( )
  34. {
  35.     for( new i = 0 ; i < FrostSounds ; i ++ )
  36.         precache_sound( szFrostSoundsPath[ i ] );
  37.        
  38.     g_iBeaconSprite = precache_model( "sprites/shockwave.spr" );
  39. }
  40.  
  41. public plugin_init()
  42. {
  43.     register_plugin( plugin_info[ 0 ] , plugin_info[ 1 ] , plugin_info[ 2 ] )
  44.    
  45.     register_forward( FM_SetModel, "Fwd_SetModel_Pre" );
  46. }
  47.  
  48. public Fwd_SetModel_Pre( iEnt, const Model[] )
  49. {
  50.     new iOwner = pev( iEnt, pev_owner );
  51.     if( !pev_valid( iEnt ) || !equal( Model, "models/w_smokegrenade.mdl" ) || !is_user_connected( iOwner ) )
  52.         return;
  53.     set_pev( iEnt, pev_nextthink, get_gametime( ) + 5.0 );
  54.     set_task( 1.5, "fnExplodeNade", TASK_EXPLODE( iEnt ) );
  55. }
  56.  
  57. public fnExplodeNade( Task_ID )
  58. {
  59.     new iEnt = UNTASK_EXPLODE( Task_ID );
  60.     if( !pev_valid( iEnt ) )
  61.         return;
  62.     new iOwner = pev( iEnt, pev_owner ), Float: g_flOrigin[ 3 ], g_iOrigin[ 3 ], Float: g_flPlayerOrigin[ 3 ];
  63.    
  64.     pev( iEnt, pev_origin, g_flOrigin );
  65.    
  66.     g_iOrigin[ 0 ] = floatround( g_flOrigin[ 0 ] );
  67.     g_iOrigin[ 1 ] = floatround( g_flOrigin[ 1 ] );
  68.     g_iOrigin[ 2 ] = floatround( g_flOrigin[ 2 ] );
  69.        
  70.     CmdExplodeBeacon( g_iOrigin )
  71.    
  72.     engfunc( EngFunc_EmitSound, iEnt, CHAN_WEAPON, szFrostSoundsPath[ Explode ], 1.0, ATTN_NORM, 0, PITCH_NORM );
  73.    
  74.     for( new i = 1 ; i < get_maxplayers( ) ; i ++ )
  75.     {
  76.         if( !is_user_connected( i ) || !is_user_alive( i ) || i == iOwner || g_bFreezed[ i ] )
  77.             continue;
  78.            
  79.         pev( i, pev_origin, g_flPlayerOrigin );
  80.        
  81.         if( get_distance_f( g_flPlayerOrigin, g_flOrigin ) > 240.0 )
  82.             continue;
  83.        
  84.         g_bFreezed[ i ] = true;
  85.        
  86.         set_task( 2.5, "Fwd_Unfreeze", TASK_UNFREEZE( i ) );
  87.            
  88.         new Float: g_flGlowColor[ 3 ];
  89.         g_flGlowColor[ 0 ] = 0.0;
  90.         g_flGlowColor[ 1 ] = 80.0;
  91.         g_flGlowColor[ 2 ] = 200.0;
  92.        
  93.         set_pev( i, pev_renderfx, kRenderFxGlowShell );
  94.         set_pev( i, pev_rendercolor, g_flGlowColor );
  95.         set_pev( i, pev_rendermode, kRenderNormal );
  96.         set_pev( i, pev_renderamt, 80.0 );
  97.        
  98.         set_pev( i, pev_flags, pev( i, pev_flags ) | FL_FROZEN );
  99.        
  100.         engfunc( EngFunc_EmitSound, i, CHAN_WEAPON, szFrostSoundsPath[ Hit ], 1.0, ATTN_NORM, 0, PITCH_NORM)   
  101.            
  102.         message_begin( MSG_ONE, get_user_msgid("ScreenFade"), _, i);
  103.         write_short( ~0 );
  104.         write_short( ~0 );
  105.         write_short( 0x0004 );
  106.         write_byte( 100 );
  107.         write_byte( 200 );
  108.         write_byte( 255 );
  109.         write_byte( 100 );
  110.         message_end( );
  111.         set_pev( i, pev_flags, pev( i, pev_flags ) | FL_FROZEN );
  112.     }
  113.    
  114.     engfunc( EngFunc_RemoveEntity , iEnt )
  115. }
  116.  
  117. public Fwd_Unfreeze( Task_ID )
  118. {
  119.     new client = UNTASK_UNFREEZE( Task_ID );
  120.    
  121.     new Float: g_flGlowColor[ 3 ];
  122.     g_flGlowColor[ 0 ] = 250.0;
  123.     g_flGlowColor[ 1 ] = 250.0;
  124.     g_flGlowColor[ 2 ] = 250.0;
  125.        
  126.     set_pev( client, pev_renderfx, kRenderFxNone );
  127.     set_pev( client, pev_rendercolor, g_flGlowColor );
  128.     set_pev( client, pev_rendermode, kRenderNormal );
  129.     set_pev( client, pev_renderamt, 16.0 );
  130.    
  131.     message_begin( MSG_ONE, get_user_msgid("ScreenFade"), _, client);
  132.     write_short( 0 );
  133.     write_short( 0 );
  134.     write_short( 0 );
  135.     write_byte( 0 );
  136.     write_byte( 0 );
  137.     write_byte( 0 );
  138.     write_byte( 0 );
  139.     message_end( );
  140.    
  141.     g_bFreezed[ client ] = false;
  142.    
  143.     set_pev( client, pev_flags, pev( client, pev_flags ) & ~FL_FROZEN );
  144.    
  145.     engfunc( EngFunc_EmitSound, client, CHAN_WEAPON, szFrostSoundsPath[ Unfreeze ], 1.0, ATTN_NORM, 0, PITCH_NORM)
  146. }
  147.  
  148. public CmdExplodeBeacon( const g_iOrigin[3] )
  149. {
  150.     message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
  151.     write_byte( TE_BEAMCYLINDER );
  152.     write_coord( g_iOrigin[0] );
  153.     write_coord( g_iOrigin[1] );
  154.     write_coord( g_iOrigin[2] );
  155.     write_coord( g_iOrigin[0] );
  156.     write_coord( g_iOrigin[1] );
  157.     write_coord( g_iOrigin[2] + 240);
  158.     write_short( g_iBeaconSprite );
  159.     write_byte( 0 );
  160.     write_byte( 0 );
  161.     write_byte( 8 );
  162.     write_byte( 60 );
  163.     write_byte( 0 );
  164.     write_byte( 40 );
  165.     write_byte( 100 );
  166.     write_byte( 200 );
  167.     write_byte( 200 );
  168.     write_byte( 3 );
  169.     message_end();
  170. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement