Преработка на hook плъгин [basebuilder]

В този раздел можете да подавате всякакви заявки за намиране, изработка или преработка на плъгини/модове.
Аватар
g0gIch
Извън линия
Потребител
Потребител
Мнения: 206
Регистриран на: 20 Юли 2017, 17:29
Се отблагодари: 37 пъти
Получена благодарност: 24 пъти
Обратна връзка:

Преработка на hook плъгин [basebuilder]

Мнение от g0gIch » 29 Май 2018, 14:27

Кода е от тази тема viewtopic.php?f=54&t=617&p=1067&hilit=z ... lder#p1067

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <engine>


/* 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
 
#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[ ] = "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_RCON) && !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() || 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( );
        }
    }
}
Искам да може да се използва hook от всеки играч по време на строене, а по време на игра само от админ с флаг за rcon.

Аватар
Huehue
Извън линия
Модератор
Модератор
Мнения: 352
Регистриран на: 16 Яну 2017, 23:42
Местоположение: София
Се отблагодари: 7 пъти
Получена благодарност: 171 пъти
Обратна връзка:

Преработка на hook плъгин [basebuilder]

Мнение от Huehue » 29 Май 2018, 14:43

Направихте ли си труда да тествате плъгина?
Как той работи и на какъв принцип?
Без да гледам знам, че съм го направил да е така както вие искате..
LOYAL TO THE OATH OF OMERTА̀

Зад монитора мъжкари, това не го разбирам..
На живо сте мишкари, това го гарантирам!
Седиш на 30 метра от мен като препариран!
Ако има нещо брат, номерът ми е блокиран..

My GitHub Profile
GitHub

My AMXX Includes Collection
AMXX Include Libraries

My Steam Profile (from SteamDB)
  • Value: 4179€
  • Games owned: 1855
  • Games played: 754 (40%)
  • Hours on record: 4,994.9h

Аватар
Last
Извън линия
Потребител
Потребител
Мнения: 5
Регистриран на: 29 Май 2018, 12:54

Преработка на hook плъгин [basebuilder]

Мнение от Last » 29 Май 2018, 14:44

Заповядай.

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <engine>


/* 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

#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[ ] = "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_RCON) && !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() || 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( );
}
}
}
.SPR файл на плъгина
.ZTMP файл на плъгина
Последно промяна от Last на 29 Май 2018, 14:49, променено общо 2 пъти.

Аватар
Huehue
Извън линия
Модератор
Модератор
Мнения: 352
Регистриран на: 16 Яну 2017, 23:42
Местоположение: София
Се отблагодари: 7 пъти
Получена благодарност: 171 пъти
Обратна връзка:

Преработка на hook плъгин [basebuilder]

Мнение от Huehue » 29 Май 2018, 14:47

Last написа: 29 Май 2018, 14:44 Заповядай.

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <engine>


/* 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

#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[ ] = "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_BAN) && !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() || get_user_flags( id ) & ADMIN_BAN && !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( );
}
}
}
.SPR файл на плъгина
.ZTMP файл на плъгина
Младежът е казал да бъде с флага за rcon достъп, а вие сте го променили на флага за ban..
Допълнително сте развалили всякаква идентация на кода..
LOYAL TO THE OATH OF OMERTА̀

Зад монитора мъжкари, това не го разбирам..
На живо сте мишкари, това го гарантирам!
Седиш на 30 метра от мен като препариран!
Ако има нещо брат, номерът ми е блокиран..

My GitHub Profile
GitHub

My AMXX Includes Collection
AMXX Include Libraries

My Steam Profile (from SteamDB)
  • Value: 4179€
  • Games owned: 1855
  • Games played: 754 (40%)
  • Hours on record: 4,994.9h

Аватар
Last
Извън линия
Потребител
Потребител
Мнения: 5
Регистриран на: 29 Май 2018, 12:54

Преработка на hook плъгин [basebuilder]

Мнение от Last » 29 Май 2018, 14:49

Huehue написа: 29 Май 2018, 14:47
Last написа: 29 Май 2018, 14:44 Заповядай.

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <engine>


/* 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

#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[ ] = "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_BAN) && !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() || get_user_flags( id ) & ADMIN_BAN && !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( );
}
}
}
.SPR файл на плъгина
.ZTMP файл на плъгина
Младежът е казал да бъде с флага за rcon достъп, а вие сте го променили на флага за ban..
Допълнително сте развалили всякаква идентация на кода..
Готово.

Аватар
g0gIch
Извън линия
Потребител
Потребител
Мнения: 206
Регистриран на: 20 Юли 2017, 17:29
Се отблагодари: 37 пъти
Получена благодарност: 24 пъти
Обратна връзка:

Преработка на hook плъгин [basebuilder]

Мнение от g0gIch » 29 Май 2018, 16:31

Huehue написа: 29 Май 2018, 14:43 Направихте ли си труда да тествате плъгина?
Как той работи и на какъв принцип?
Без да гледам знам, че съм го направил да е така както вие искате..
Моя грешка. Плъгина е точен от всякъде .

Заключено
  • Подобни теми
    Отговори
    Преглеждания
     Последно мнение

Обратно към “Заявки за плъгини”

Кой е на линия

Потребители разглеждащи този форум: Google [Bot] и 19 госта