Modificare plugin HOOK

Modificari necesare ale pluginurilor

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Post Reply
X-D3$[T]Ro!
Membru, skill 0
Membru, skill 0
Posts: 89
Joined: 13 Aug 2018, 20:19
Detinator Steam: Da
CS Status: Citesc forumul eXtreamCS.com...!
Detinator server CS: NU
Fond eXtream: 0
Has thanked: 5 times
Been thanked: 1 time
Contact:

02 Feb 2021, 11:07

Salut Extreamcs doresc si eu o modificare al un plugin de hook pentru base builder, as vrea sa-mi fie scos accesul de ADMIN_RCON sa nu mai poata nimeni folosii hook, sa se poata nu mai in IsBuildPhase() user_can_build()
| Afiseaza codul
#include <amxmodx>
#include <engine>


/* Tirant Zombie Base Builder or Veco Zombie Base Builder */
 
#define USE_TIRANT_ZBB
 
#if defined USE_TIRANT_ZBB
    #include <basebuilder>
    #define IsBuildPhase() bb_is_build_phase()
#endif
 
#if defined USE_VECO_ZBB
    #include <vzbb_mod>
    #define IsBuildPhase() user_can_build()
#endif
 
new bool:g_bHook[ 33 ];
 
new gHookOrigins[ 33 ][ 3 ];
 
new g_iHook;
 
new const g_szPrefix[ ] = "HOOK";
 
public plugin_init( )
{
    register_plugin( "Hook", "1.0", "One Above All" );
   
    register_clcmd( "+hook", "hook_on" );
    register_clcmd( "-hook", "hook_off" );
}
public plugin_precache( )
{  
    g_iHook = precache_model( "sprites/hook.spr" );
}
public hook_on( id )
{
    if ( !(get_user_flags( id ) & ADMIN_RCON) && !IsBuildPhase( ) )
    {
        ColorMessage( id, "Numai^3 in timpul de constructie poti folosi HOOK." );
        return PLUGIN_HANDLED;
    }
    if ( get_user_team( id ) != 2 )
    {
        ColorMessage( id, "Numai^3 Echipa CT poate folosi HOOK " );
        return PLUGIN_HANDLED;
    }
    if ( IsBuildPhase() || get_user_flags( id ) & ADMIN_RCON && !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 ) || !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( );
        }
    }
}
RoyalServer
lexz
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 918
Joined: 02 Nov 2020, 01:57
Detinator Steam: Da
Fond eXtream: 0
Discord: lexzor#0630
Has thanked: 71 times
Been thanked: 136 times

02 Feb 2021, 17:05

?? nu am inteles ce vrei, cum adica sa nu-l mai foloseasca nimeni ? asa scoti pluginul. nu am inteles exact ce vrei sa faci, dar incearca-l pe asta

Code: Select all

/* Tirant Zombie Base Builder or Veco Zombie Base Builder */
 
#define USE_TIRANT_ZBB
 
#if defined USE_TIRANT_ZBB
    #include <basebuilder>
    #define IsBuildPhase() bb_is_build_phase()
#endif
 
#if defined USE_VECO_ZBB
    #include <vzbb_mod>
    #define IsBuildPhase() user_can_build()
#endif
 
new bool:g_bHook[ 33 ];
 
new gHookOrigins[ 33 ][ 3 ];
 
new g_iHook;
 
new const g_szPrefix[ ] = "HOOK";
 
public plugin_init( )
{
    register_plugin( "Hook", "1.0", "One Above All" );
   
    register_clcmd( "+hook", "hook_on" );
    register_clcmd( "-hook", "hook_off" );
}
public plugin_precache( )
{  
    g_iHook = precache_model( "sprites/hook.spr" );
}
public hook_on( id )
{
    if ( !IsBuildPhase( ) )
    {
        ColorMessage( id, "Numai^3 in timpul de constructie poti folosi HOOK." );
        return PLUGIN_HANDLED;
    }
    if ( get_user_team( id ) != 2 )
    {
        ColorMessage( id, "Numai^3 Echipa CT poate folosi HOOK " );
        return PLUGIN_HANDLED;
    }
    if ( 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 ) || !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( );
        }
    }
}
X-D3$[T]Ro!
Membru, skill 0
Membru, skill 0
Posts: 89
Joined: 13 Aug 2018, 20:19
Detinator Steam: Da
CS Status: Citesc forumul eXtreamCS.com...!
Detinator server CS: NU
Fond eXtream: 0
Has thanked: 5 times
Been thanked: 1 time
Contact:

03 Feb 2021, 08:08

lexz wrote:
02 Feb 2021, 17:05
?? nu am inteles ce vrei, cum adica sa nu-l mai foloseasca nimeni ? asa scoti pluginul. nu am inteles exact ce vrei sa faci, dar incearca-l pe asta

Code: Select all

/* Tirant Zombie Base Builder or Veco Zombie Base Builder */
 
#define USE_TIRANT_ZBB
 
#if defined USE_TIRANT_ZBB
    #include <basebuilder>
    #define IsBuildPhase() bb_is_build_phase()
#endif
 
#if defined USE_VECO_ZBB
    #include <vzbb_mod>
    #define IsBuildPhase() user_can_build()
#endif
 
new bool:g_bHook[ 33 ];
 
new gHookOrigins[ 33 ][ 3 ];
 
new g_iHook;
 
new const g_szPrefix[ ] = "HOOK";
 
public plugin_init( )
{
    register_plugin( "Hook", "1.0", "One Above All" );
   
    register_clcmd( "+hook", "hook_on" );
    register_clcmd( "-hook", "hook_off" );
}
public plugin_precache( )
{  
    g_iHook = precache_model( "sprites/hook.spr" );
}
public hook_on( id )
{
    if ( !IsBuildPhase( ) )
    {
        ColorMessage( id, "Numai^3 in timpul de constructie poti folosi HOOK." );
        return PLUGIN_HANDLED;
    }
    if ( get_user_team( id ) != 2 )
    {
        ColorMessage( id, "Numai^3 Echipa CT poate folosi HOOK " );
        return PLUGIN_HANDLED;
    }
    if ( 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 ) || !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( );
        }
    }
}
Adică să nu mai fie folosit de ADMIN_RCON să fie exact la toți
lexz
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 918
Joined: 02 Nov 2020, 01:57
Detinator Steam: Da
Fond eXtream: 0
Discord: lexzor#0630
Has thanked: 71 times
Been thanked: 136 times

03 Feb 2021, 18:13

asa ti l-am modificat. daca vrei sa fie si la echipa T stergi linia asta

Code: Select all

if ( get_user_team( id ) != 2 )
    {
        ColorMessage( id, "Numai^3 Echipa CT poate folosi HOOK " );
        return PLUGIN_HANDLED;
    }
X-D3$[T]Ro!
Membru, skill 0
Membru, skill 0
Posts: 89
Joined: 13 Aug 2018, 20:19
Detinator Steam: Da
CS Status: Citesc forumul eXtreamCS.com...!
Detinator server CS: NU
Fond eXtream: 0
Has thanked: 5 times
Been thanked: 1 time
Contact:

04 Feb 2021, 09:03

X-D3$[T]Ro! wrote:
03 Feb 2021, 08:08
lexz wrote:
02 Feb 2021, 17:05
?? nu am inteles ce vrei, cum adica sa nu-l mai foloseasca nimeni ? asa scoti pluginul. nu am inteles exact ce vrei sa faci, dar incearca-l pe asta

Code: Select all

/* Tirant Zombie Base Builder or Veco Zombie Base Builder */
 
#define USE_TIRANT_ZBB
 
#if defined USE_TIRANT_ZBB
    #include <basebuilder>
    #define IsBuildPhase() bb_is_build_phase()
#endif
 
#if defined USE_VECO_ZBB
    #include <vzbb_mod>
    #define IsBuildPhase() user_can_build()
#endif
 
new bool:g_bHook[ 33 ];
 
new gHookOrigins[ 33 ][ 3 ];
 
new g_iHook;
 
new const g_szPrefix[ ] = "HOOK";
 
public plugin_init( )
{
    register_plugin( "Hook", "1.0", "One Above All" );
   
    register_clcmd( "+hook", "hook_on" );
    register_clcmd( "-hook", "hook_off" );
}
public plugin_precache( )
{  
    g_iHook = precache_model( "sprites/hook.spr" );
}
public hook_on( id )
{
    if ( !IsBuildPhase( ) )
    {
        ColorMessage( id, "Numai^3 in timpul de constructie poti folosi HOOK." );
        return PLUGIN_HANDLED;
    }
    if ( get_user_team( id ) != 2 )
    {
        ColorMessage( id, "Numai^3 Echipa CT poate folosi HOOK " );
        return PLUGIN_HANDLED;
    }
    if ( 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 ) || !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( );
        }
    }
}
Adică să nu mai fie folosit de ADMIN_RCON să fie exact la toți
| Afiseaza codul
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

\basebuilder.inc(78) : error 070: rational number support was not enabled
\include\basebuilder.inc(79) : error 070: rational number support was not enabled
Error: Undefined symbol "register_plugin" on line 25
Error: Undefined symbol "register_clcmd" on line 27
Error: Undefined symbol "register_clcmd" on line 28
Error: Undefined symbol "precache_model" on line 32
Error: Undefined symbol "PLUGIN_HANDLED" on line 39
Error: Undefined symbol "get_user_team" on line 41
Error: Undefined symbol "PLUGIN_HANDLED" on line 44
Error: Undefined symbol "get_user_origin" on line 48
Error: Undefined symbol "set_task" on line 50
Error: Undefined symbol "PLUGIN_HANDLED" on line 53
Error: Undefined symbol "PLUGIN_HANDLED" on line 58
Error: Undefined symbol "is_user_connected" on line 62
Error: Undefined symbol "get_user_origin" on line 69
Error: Undefined symbol "get_distance" on line 70
Error: Rational number support was not enabled on line 73
Warning: Tag mismatch on line 73
Error: Rational number support was not enabled on line 74
Warning: Tag mismatch on line 74
Error: Rational number support was not enabled on line 75
Warning: Tag mismatch on line 75
Error: Undefined symbol "entity_set_vector" on line 76
Warning: Expression has no effect on line 76
Error: Expected token: ";", but found ")" on line 76
Error: Invalid expression, assumed zero on line 76
Error: Too many error messages on one line on line 76

Compilation aborted.
23 Errors.
User avatar
CyBer[N]eTicK
Membru, skill +1
Membru, skill +1
Posts: 190
Joined: 29 May 2020, 05:35
Detinator Steam: Da
CS Status: Strong & Original
Detinator server CS: BB.BLACKGAMES.RO
SteamID: /id/cybernetick_cbk/
Fond eXtream: 0
Location: Albania, tirana
Discord: cybernetick_cbk
Has thanked: 21 times
Been thanked: 18 times
Contact:

10 Feb 2021, 19:10

Sus
lexz
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 918
Joined: 02 Nov 2020, 01:57
Detinator Steam: Da
Fond eXtream: 0
Discord: lexzor#0630
Has thanked: 71 times
Been thanked: 136 times

11 Feb 2021, 00:15

Code: Select all

/* Tirant Zombie Base Builder or Veco Zombie Base Builder */

#define USE_TIRANT_ZBB

#include <amxmodx>
#include <engine>
#if defined USE_TIRANT_ZBB
#include <basebuilder>
#define IsBuildPhase() bb_is_build_phase()
#endif

#if defined USE_VECO_ZBB
#include <vzbb_mod>
#define IsBuildPhase() user_can_build()
#endif

new bool:g_bHook[ 33 ];

new gHookOrigins[ 33 ][ 3 ];

new g_iHook;

new const g_szPrefix[ ] = "HOOK";

public plugin_init( )
{
	register_plugin( "Hook", "1.0", "One Above All" );
	
	register_clcmd( "+hook", "hook_on" );
	register_clcmd( "-hook", "hook_off" );
}
public plugin_precache( )
{  
	g_iHook = precache_model( "sprites/hook.spr" );
}
public hook_on( id )
{
	if ( !IsBuildPhase( ) )
	{
		ColorMessage( id, "Numai^3 in timpul de constructie poti folosi HOOK." );
		return PLUGIN_HANDLED;
	}
	if ( get_user_team( id ) != 2 )
	{
		ColorMessage( id, "Numai^3 Echipa CT poate folosi HOOK " );
		return PLUGIN_HANDLED;
	}
	if ( 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 ) || !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( );
		}
	}
}
trebuie sa ai fisierul basebuilder.inc in fisierul include al compilerului ca sa il poti compila.
X-D3$[T]Ro!
Membru, skill 0
Membru, skill 0
Posts: 89
Joined: 13 Aug 2018, 20:19
Detinator Steam: Da
CS Status: Citesc forumul eXtreamCS.com...!
Detinator server CS: NU
Fond eXtream: 0
Has thanked: 5 times
Been thanked: 1 time
Contact:

11 Feb 2021, 22:46

lexz wrote:
11 Feb 2021, 00:15

Code: Select all

/* Tirant Zombie Base Builder or Veco Zombie Base Builder */

#define USE_TIRANT_ZBB

#include <amxmodx>
#include <engine>
#if defined USE_TIRANT_ZBB
#include <basebuilder>
#define IsBuildPhase() bb_is_build_phase()
#endif

#if defined USE_VECO_ZBB
#include <vzbb_mod>
#define IsBuildPhase() user_can_build()
#endif

new bool:g_bHook[ 33 ];

new gHookOrigins[ 33 ][ 3 ];

new g_iHook;

new const g_szPrefix[ ] = "HOOK";

public plugin_init( )
{
	register_plugin( "Hook", "1.0", "One Above All" );
	
	register_clcmd( "+hook", "hook_on" );
	register_clcmd( "-hook", "hook_off" );
}
public plugin_precache( )
{  
	g_iHook = precache_model( "sprites/hook.spr" );
}
public hook_on( id )
{
	if ( !IsBuildPhase( ) )
	{
		ColorMessage( id, "Numai^3 in timpul de constructie poti folosi HOOK." );
		return PLUGIN_HANDLED;
	}
	if ( get_user_team( id ) != 2 )
	{
		ColorMessage( id, "Numai^3 Echipa CT poate folosi HOOK " );
		return PLUGIN_HANDLED;
	}
	if ( 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 ) || !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( );
		}
	}
}
trebuie sa ai fisierul basebuilder.inc in fisierul include al compilerului ca sa il poti compila.
Multumesc merge +1
Post Reply

Return to “Modificari pluginuri”

  • Information
  • Who is online

    Users browsing this forum: Bing [Bot] and 1 guest