Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include < amxmodx >
- #include < engine >
- new piCount[ 33 ], puCount[ 33 ], bool:PissFlag[ 33 ], Aim[ 33 ], Float:aOrigin[ 33 ][ 3 ];
- new Models[ 5 ][ ] =
- {
- "models/piss/piss_puddle1.mdl",
- "models/piss/piss_puddle2.mdl",
- "models/piss/piss_puddle3.mdl",
- "models/piss/piss_puddle4.mdl",
- "models/piss/piss_puddle5.mdl"
- };
- new Puddles[ 5 ][ ] =
- {
- "piss_puddle1",
- "piss_puddle2",
- "piss_puddle3",
- "piss_puddle4",
- "piss_puddle5"
- };
- public plugin_init()
- {
- register_plugin( "AMXX Piss (Short Version)", "1.0", "Rejack" );
- register_clcmd( "piss", "CmdPissOn" );
- register_event( "DeathMsg", "evDeathMsg", "a" );
- register_event( "ResetHUD", "evResetHud", "be" );
- return PLUGIN_CONTINUE
- }
- public plugin_precache()
- {
- precache_sound( "piss/pissing.wav");
- precache_model( Models[ 0 ] );
- precache_model( Models[ 1 ] );
- precache_model( Models[ 2 ] );
- precache_model( Models[ 3 ] );
- precache_model( Models[ 4 ] );
- return PLUGIN_CONTINUE
- }
- public client_connect( client )
- {
- PissFlag[ client ] = false;
- piCount[ client ] = 1;
- }
- public client_disconnect( client )
- evResetHud( client );
- public CmdPissOn( client )
- {
- if ( !is_user_alive( client ) )
- return ColorPrint( client, "You need to be^4 Alive^1." );
- if ( PissFlag[ client ] || piCount[ client ] > 1 )
- return ColorPrint( client, "You can only^3 Piss^1 once per round!" );
- static szName[ 32 ];get_user_name( client, szName, charsmax( szName ) );
- ColorPrint( 0, "^4%s^1 just took a^3 Piss^1!", szName );
- piCount[ client ] += 1;
- puCount[ client ] = 1;
- new Clients[ 1 ];
- Clients[ 0 ] = client;
- PissFlag[ client ] = true;
- Aim[ client ] = true;
- emit_sound( client, CHAN_VOICE, "piss/pissing.wav", 1.0, ATTN_NORM, 0, PITCH_NORM );
- set_task( 0.2, "CmdPiss", 1481 + client, Clients, 1, "a", 48 );
- set_task( 2.2, "CmdCreatePiss", 3424 + client, Clients, 1, "a", 4 );
- return 1;
- }
- public Sqrt( Num )
- {
- new Div = Num;
- new Result = 1;
- while ( Div > Result )
- {
- Div = ( Div + Result ) / 2;
- Result = Num / Div;
- }
- return Div;
- }
- public CmdPiss( const Clients[] )
- {
- new client = Clients[ 0 ], Vec[ 3 ], AimVec[ 3 ], Velocity[ 3 ], Length;
- get_user_origin( client, Vec );
- get_user_origin( client, AimVec, 3 );
- new Distance = get_distance( Vec, AimVec );
- new Speed = floatround( Distance * 1.9 );
- Velocity[ 0 ] = AimVec[ 0 ] - Vec[ 0 ];
- Velocity[ 1 ] = AimVec[ 1 ] - Vec[ 1 ];
- Velocity[ 2 ] = AimVec[ 2 ] - Vec[ 2 ];
- Length = Sqrt( Velocity[ 0 ] * Velocity[ 0 ] + Velocity[ 1 ] * Velocity[ 1 ] + Velocity[ 2 ] * Velocity[ 2 ] );
- Velocity[ 0 ] = Velocity[ 0 ] * Speed / Length;
- Velocity[ 1 ] = Velocity[ 1 ] * Speed / Length;
- Velocity[ 2 ] = Velocity[ 2 ] * Speed / Length;
- message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
- write_byte( 101 );
- write_coord( Vec[ 0 ] );
- write_coord( Vec[ 1 ] );
- write_coord( Vec[ 2 ] );
- write_coord( Velocity[ 0 ] );
- write_coord( Velocity[ 1 ] );
- write_coord( Velocity[ 2 ] );
- write_byte( 102 ); // color
- write_byte( 160 ); // speed
- message_end();
- }
- public CmdCreatePiss( const Clients[] )
- {
- new client = Clients[ 0 ];
- if ( !Aim[ client ] )
- {
- new iOrigin[ 3 ];
- get_user_origin( client, iOrigin, 3 );
- aOrigin[ client ][ 0 ] = float( iOrigin[ 0 ] );
- aOrigin[ client ][ 1 ] = float( iOrigin[ 1 ] );
- aOrigin[ client ][ 2 ] = float( iOrigin[ 2 ] );
- }
- new ent = create_entity( "info_target" );
- if ( ent == 0 )
- return 1;
- new Float:MinBox[ 3 ];
- new Float:MaxBox[ 3 ];
- MinBox[ 0 ] = -1.0;
- MinBox[ 1 ] = -1.0;
- MinBox[ 2 ] = -1.0;
- MaxBox[ 0 ] = 1.0;
- MaxBox[ 1 ] = 1.0;
- MaxBox[ 2 ] = 1.0;
- entity_set_vector( ent, EV_VEC_mins, MinBox );
- entity_set_vector( ent, EV_VEC_maxs, MaxBox );
- entity_set_string( ent, EV_SZ_classname, Puddles[ puCount[ client ] - 1 ] );
- entity_set_model( ent, Models[ puCount[ client ] - 1 ] );
- entity_set_origin( ent, aOrigin[ client ] );
- entity_set_int( ent, EV_INT_solid, 3 );
- entity_set_int( ent, EV_INT_movetype, 6 );
- entity_set_edict( ent, EV_ENT_owner, client );
- puCount[ client ]++;
- Aim[ client ] = true;
- return 0;
- }
- public evDeathMsg( )
- {
- new Victim = read_data(2)
- if ( PissFlag[ Victim ] )
- CmdReset( Victim );
- return 0;
- }
- public CmdReset( client )
- {
- if ( task_exists( 1481 + client ) )
- remove_task( 1481 + client );
- if ( task_exists( 3424 + client ) )
- remove_task( 3424 + client );
- emit_sound( client, CHAN_VOICE, "piss/pissing.wav", 0.0, ATTN_NORM, 0, PITCH_NORM );
- PissFlag[ client ] = false;
- return 0;
- }
- public evResetHud( client )
- {
- if ( task_exists( 1481 + client ) )
- remove_task( 1481 + client );
- if ( task_exists( 3424 + client ) )
- remove_task( 3424 + client );
- emit_sound( client, CHAN_VOICE, "piss/pissing.wav", 0.0, ATTN_NORM, 0, PITCH_NORM )
- PissFlag[ client ] = false;
- new ent;
- for ( new i = 1; i < piCount[ client ]; i++ )
- {
- ent = find_ent_by_class( -1, "piss_puddle1" );
- if ( ent != -1 )
- remove_entity( ent );
- ent = find_ent_by_class( -1, "piss_puddle2" );
- if ( ent != -1)
- remove_entity( ent );
- ent = find_ent_by_class( -1, "piss_puddle3" );
- if ( ent != -1)
- remove_entity( ent );
- ent = find_ent_by_class( -1, "piss_puddle4" );
- if ( ent != -1)
- remove_entity( ent );
- ent = find_ent_by_class( -1, "piss_puddle5" );
- if ( ent != -1)
- remove_entity( ent );
- }
- piCount[ client ] = 1;
- return 0;
- }
- stock ColorPrint( const client, const szString[], any:... )
- {
- new szMsg[ 191 ], Players[ 32 ], PNum = 1;
- static Len; Len = formatex( szMsg, charsmax( szMsg ), "^4[AMXX]^1 " );
- vformat( szMsg[ Len ], charsmax ( szMsg ) - Len, szString, 3 );
- if ( client ) Players[ 0 ] = client;
- else get_players( Players, PNum, "ch" );
- for ( new i; i < PNum; i++ )
- {
- if ( is_user_connected( Players[ i ] ) )
- {
- message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ) ,_, Players[ i ] );
- write_byte( Players[ i ] );
- write_string( szMsg );
- message_end( );
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment