Quote:
Originally Posted by yousuf khan
Hi.
I Need Hook Plugin !!
That Hook Is Not Normal Hook I Need Hook For VIPS
Flag "t"
This Hook Just Will Be Work On "Build Phase"
And In Prep Time And Other Time Hook Will Be Not Work Can If AnyOne Try To Use Hook After
BuildTime Then Show This Message
[BaseBuilder] Only VIPS Can Use Hook During Build Phase.
Can AnyOne Make This Plugin Without Any Error During Compiling Please !!
|
PHP Code:
#include <amxmodx>
#include <engine>
#include <amxmisc>
/* Tirant Zombie Base Builder or Veco Zombie Base Builder */
#define USE_TIRANT_ZBB
//#define USE_VECO_ZBB
#if defined USE_TIRANT_ZBB
#include <basebuilder>
#define IsBuildPhase() bb_is_build_phase()
#endif
new bool:g_bHook[ 33 ];
new gHookOrigins[ 33 ][ 3 ];
new g_iHook;
new const g_szPrefix[ ] = "Your Prefix Here";
public plugin_init( )
{
register_plugin( "[ ZBB Addon ] Hook", "1.0", "One Above All" );
register_clcmd( "+hook", "hook_on" );
register_clcmd( "-hook", "hook_off" );
}
public plugin_precache( )
{
g_iHook = precache_model( "sprites/zbb/hook.spr" );
}
public hook_on( id )
{
if ( !(get_user_flags( id ) & ADMIN_LEVEL_A) && !IsBuildPhase( ) )
{
ColorMessage( id, "Only^3 Admins^1 can use hook after build phase." );
return PLUGIN_HANDLED;
}
if ( get_user_team( id ) != 2 )
{
ColorMessage( id, "Only^3 Counter-Terrorists^1 can use hook!" );
return PLUGIN_HANDLED;
}
if ( IsBuildPhase() || !has_flag( id, "t" ) && !IsBuildPhase())
{
get_user_origin( id, gHookOrigins[ id ], 3 );
g_bHook[ id ] = true;
set_task( 0.1, "hook_task", id, "", 0, "ab" );
hook_task( id );
}
return PLUGIN_HANDLED;
}
public hook_off( id )
{
remove_hook( id );
return PLUGIN_HANDLED;
}
public hook_task( id )
{
if( !is_user_connected( id ) || !has_flag( id, "t" ) || !is_user_alive( id ) )
remove_hook( id );
remove_beam( id );
draw_hook( id );
new iOrigin[ 3 ], Float:fVelocity[ 3 ];
get_user_origin( id, iOrigin );
new iDistance = get_distance( gHookOrigins[ id ], iOrigin);
if ( iDistance > 25 )
{
fVelocity[ 0 ] = ( gHookOrigins[ id ][ 0 ] - iOrigin[ 0 ] ) * ( 2.0 * 300 / iDistance );
fVelocity[ 1 ] = ( gHookOrigins[ id ][ 1 ] - iOrigin[ 1 ] ) * ( 2.0 * 300 / iDistance );
fVelocity[ 2 ] = ( gHookOrigins[ id ][ 2 ] - iOrigin[ 2 ] ) * ( 2.0 * 300 / iDistance );
entity_set_vector( id, EV_VEC_velocity, fVelocity );
}
else
{
entity_set_vector( id, EV_VEC_velocity, Float:{0.0,0.0,0.0} );
remove_hook( id );
}
}
public draw_hook( id )
{
message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
write_byte( 1 ); // TE_BEAMENTPOINT
write_short( id ); // Entity index
write_coord( gHookOrigins[ id ][ 0 ] ); // Origin
write_coord( gHookOrigins[ id ][ 1 ] ); // Origin
write_coord( gHookOrigins[ id ][ 2 ] ); // Origin
write_short( g_iHook ); // Sprite index
write_byte( 0 ); // Start frame
write_byte( 0 ); // Framerate
write_byte( 100 ); // Life
write_byte( 10 ); // Width
write_byte( 0 ); // Noise
write_byte( random_num(0, 255) ); // Red
write_byte( random_num(0, 255) ); // Green
write_byte( random_num(0, 255) ); // Blue
write_byte( 250 ); // Brightness
write_byte( 1 ); // Speed
message_end( );
}
public remove_hook( id )
{
if( task_exists( id ) )
remove_task( id );
remove_beam(id);
g_bHook[ id ] = false;
}
public remove_beam(id)
{
message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
write_byte( 99 );
write_short( id );
message_end( );
}
stock ColorMessage( const id, const input[ ], any:... )
{
new iCount = 1, iPlayers[ 32 ];
static szMessage[ 191 ];
new iLen = formatex( szMessage, 190, "^4[%s]^1 ", g_szPrefix );
vformat( szMessage[ iLen ], 190-iLen, input, 3 );
if ( id ) iPlayers[ 0 ] = id;
else get_players( iPlayers , iCount , "ch" );
for ( new i = 0; i < iCount; i++ )
{
if ( is_user_connected( iPlayers[ i ] ) )
{
message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, iPlayers[ i ] );
write_byte( iPlayers[ i ] );
write_string( szMessage );
message_end( );
}
}
}