Rejack

Amxx Dookie (Short Version)

Apr 2nd, 2013 (edited)
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 4.36 KB | None | 0 0
  1. #include < amxmodx >
  2. #include < engine >
  3. #include < fakemeta >
  4.  
  5. #define write_coord_f(%1)       engfunc(EngFunc_WriteCoord, %1)
  6.  
  7. #define get_ent_origin(%1,%2)       entity_get_vector(%1,EV_VEC_origin,%2)
  8.  
  9. #define IsPlayer(%1)    ( 1 <= %1 <= g_iMaxPlayers )
  10.  
  11. new const Float:g_vecDookieMins[] = {-1.0, -1.0, -1.0 }
  12. new const Float:g_vecDookieMaxs[] = { 1.0,  1.0,  1.0 }
  13.  
  14. new Models[ 5 ][ ] =
  15. {
  16.     "models/dookie2.mdl",
  17.     "models/dookie3.mdl",
  18.     "dookie/dookie1.wav",
  19.     "dookie/dookie3.wav",
  20.     "sprites/steam1.spr"
  21. };
  22.  
  23. new Steam, gMsgScreenShake, bool:Dookied[ 33 ];
  24.  
  25. public plugin_precache()
  26. {
  27.     precache_sound( Models[ 2 ] );
  28.    
  29.     precache_sound( Models[ 3 ] );
  30.    
  31.     precache_model( Models[ 0 ] );
  32.    
  33.     precache_model( Models[ 1 ] );
  34.    
  35.     Steam = precache_model( Models[ 4 ] );
  36. }
  37.  
  38. public plugin_init()
  39. {
  40.     register_plugin( "Shit (Short Version)", "1.0", "Rejack" );
  41.    
  42.     register_clcmd("dookie", "CmdDookie")
  43.    
  44.     register_clcmd("shit", "CmdDookie")
  45.    
  46.     register_think( "amx_dookie", "ThinkDookie")
  47.    
  48.     register_event("HLTV", "evNewRound", "a", "1=0", "2=0")
  49.    
  50.     gMsgScreenShake = get_user_msgid( "ScreenShake" );
  51. }
  52.  
  53. public evNewRound()
  54. {
  55.     for ( new i = 1; i < get_maxplayers(); i++ )
  56.     {
  57.         if ( !is_user_connected( i ) )
  58.             continue;
  59.        
  60.         Dookied[ i ] = false;
  61.     }
  62.    
  63.     new iDookie = find_ent_by_class( -1, "amx_dookie" );
  64.    
  65.     while( iDookie > 0)
  66.     {
  67.         remove_entity( iDookie );
  68.        
  69.         iDookie = find_ent_by_class( iDookie, "amx_dookie" );
  70.     }
  71. }
  72. public CmdDookie( client )
  73. {
  74.     if ( !is_user_alive( client ) )
  75.         return ColorPrint( client, "You need to be^4 Alive^1." );
  76.    
  77.     if ( Dookied[ client ] )
  78.         return ColorPrint( client, "You can only^3 Shit^1 once per round!" );
  79.    
  80.     new Float:vecOrigin[ 3 ];
  81.    
  82.     get_ent_origin( client, vecOrigin );
  83.    
  84.     static szName[ 32 ];get_user_name( client, szName, charsmax( szName ) );
  85.    
  86.     Dookied[ client ] = true;
  87.    
  88.     emit_sound( client, CHAN_VOICE, Models[ 3 ], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  89.    
  90.     CreateDookie( client, vecOrigin, true)
  91.    
  92.     ColorPrint( 0, "^4%s^1 just took a^3 Shit^1!", szName );
  93.    
  94.     return 1;
  95. }
  96.  
  97. stock CreateDookie( client, Float:vecOrigin[ 3 ], bool:bSuper = false )
  98. {
  99.     new iEnt = create_entity("info_target")
  100.    
  101.     if( iEnt > 0 )
  102.     {
  103.         entity_set_string( iEnt, EV_SZ_classname, "amx_dookie" );
  104.         entity_set_model( iEnt, bSuper ? Models[ 0 ] : Models[ 1 ] );
  105.         entity_set_size( iEnt, g_vecDookieMins, g_vecDookieMaxs );
  106.         entity_set_origin( iEnt, vecOrigin );
  107.        
  108.         entity_set_int( iEnt, EV_INT_solid, SOLID_SLIDEBOX );
  109.         entity_set_int( iEnt, EV_INT_movetype, MOVETYPE_TOSS );
  110.         entity_set_edict( iEnt, EV_ENT_owner, client );
  111.        
  112.         entity_set_float( iEnt, EV_FL_nextthink, get_gametime() + 1.0);
  113.        
  114.        
  115.         if( bSuper )
  116.         {
  117.             message_begin( MSG_BROADCAST, gMsgScreenShake );
  118.             write_short(8<<12);
  119.             write_short(8<<8);
  120.             write_short(8<<12);
  121.             message_end();
  122.            
  123.             for (new j = 0; j < 10; j++)
  124.             {
  125.                 message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
  126.                 write_byte( TE_BLOODSTREAM );
  127.                 write_coord_f( vecOrigin[ 0 ] );
  128.                 write_coord_f( vecOrigin[ 1 ] );
  129.                 write_coord_f( vecOrigin[ 2 ] - 20 );
  130.                 write_coord( random_num( -100,100 ) );
  131.                 write_coord( random_num( -100,100 ) );
  132.                 write_coord( random_num( 20,300 ) );
  133.                 write_byte( 100 );
  134.                 write_byte( random_num( 100,200 ) );
  135.                 message_end();
  136.             }
  137.         }
  138.     }
  139. }
  140.  
  141. public ThinkDookie( ent )
  142. {
  143.     new Float:vecOrigin[ 3 ];
  144.     entity_get_vector( ent, EV_VEC_origin, vecOrigin );
  145.    
  146.     message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
  147.     write_byte( TE_SPRITE );
  148.     write_coord_f( vecOrigin[ 0 ] );
  149.     write_coord_f( vecOrigin[ 1 ] );
  150.     write_coord_f( vecOrigin[ 2 ] + 10 );
  151.     write_short( Steam );
  152.     write_byte( 8 );
  153.     write_byte( 10 );
  154.     message_end();
  155.    
  156.     entity_set_float(ent, EV_FL_nextthink, get_gametime() + 1.0 );
  157. }
  158.  
  159. stock ColorPrint( const client, const szString[], any:... )
  160. {
  161.     new szMsg[ 191 ], Players[ 32 ], PNum = 1;
  162.    
  163.     static Len; Len = formatex( szMsg, charsmax( szMsg ), "^4[AMXX]^1 " );
  164.    
  165.     vformat( szMsg[ Len ], charsmax ( szMsg ) - Len, szString, 3 );
  166.    
  167.     if ( client )   Players[ 0 ] = client;
  168.    
  169.     else    get_players( Players, PNum, "ch" );
  170.    
  171.     for ( new i; i < PNum; i++ )
  172.     {
  173.         if ( is_user_connected( Players[ i ] ) )
  174.         {
  175.             message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ) ,_, Players[ i ] );
  176.            
  177.             write_byte( Players[ i ] );
  178.            
  179.             write_string( szMsg );
  180.            
  181.             message_end( );
  182.         }
  183.     }
  184.    
  185.     return 1;
  186. }
Advertisement
Add Comment
Please, Sign In to add comment