Ayuda configurar mapas [TTT]
#1
Exclamación 
Buenas, no se en donde vaya esto pero necesito ayuda con mi servidor para configurar algunos mapas [TTT] para que los traidores puedan abrir las puertas y no todos, etc. Alguien que me diga como?
[Imagen: 76561198258768928.png][Imagen: AddFriend.png]
Responder
#2
¿Tenés algún ejemplo?
No hago trabajos privados. Si necesitás ayuda, abrí un nuevo tema.
¿Buscás un ejemplo o algún modo de juego? Podés echarle un vistazo a mis aportes
.
Responder
#3
En algunos mapas, hay unas puertas que solo los traidores pueden abrir, en este caso todos pueden abrirlas. y no se como configurar eso
[Imagen: 76561198258768928.png][Imagen: AddFriend.png]
Responder
#4
Se hace por un plugin, pero tendrías que pasar los mapas para saber que entidades son.
No hago trabajos privados. Si necesitás ayuda, abrí un nuevo tema.
¿Buscás un ejemplo o algún modo de juego? Podés echarle un vistazo a mis aportes
.
Responder
#5
Pues hay varios, entre, ttt_towers_fix, ttt_little_house, y creo que otros más.
[Imagen: 76561198258768928.png][Imagen: AddFriend.png]
Responder
#6
Quería comprobar que estuvieras hablando de los mapas que creé hace un tiempo Ángel Acá te dejo dos plugins, uno que maneja el ttt_towers_fix y otro que maneja el ttt_little_house.

Cada uno tiene que ser activado solo cuando se carga cada mapa respectivamente. La manera fácil de hacerlo es crear un "plugins.ini" para cada mapa en particular. Por ejemplo, se puede crear un plugins-ttt_little_house.ini y escribir dentro el nombre del .amxx que administra el Little House, y luego mover dicho .ini a una carpeta dentro de configs que ya no recuerdo como debe llamarse.

ttt_towers_fix

Código PHP:
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#include <ttt>
#include <xs>

/* ========================================================================
*                 [ Globals & Macros ]
* ======================================================================== */

#define ID_RESULT ( iTaskId - TASK_RESULT )

#define IsPlayerValid(%0) ( 1 <= %0 <= 32 )
#define IsEntityModded(%0) ( %0[ 0 ] == 't' && %0[ 4 ] == 't' )
#define IsPlayerFrozen(%0) ( entity_get_int( %0, EV_INT_flags ) & FL_FROZEN )
#define IsButtonUsable(%0) ( entity_get_float( %0, EV_FL_fuser1 ) <= get_gametime( ) )
#define IsEntityAlive(%0) ( entity_get_float( %0, EV_FL_health ) > 0.0 )

const TASK_RESULT 747;

enum _:Entity_Type
{
    
Entity_Work,
    
Entity_Room,
    
Entity_Wood,
    
Entity_Place,
    
Entity_Tester,
    
Entity_Explosive
}

new 
g_iEntitiesEntity_Type ];

/* ========================================================================
*                 [ Initiation ]
* ========================================================================= */

public plugin_init( )
{
    
register_plugin"[TTT] Towers Manager""1.0""Manu" );
    
    
RegisterHamHam_Use"func_button""fw_PlayerButton_Pre"false );
    
    
g_iEntitiesEntity_Work ] = find_ent_by_tname( -1"traitwork" );
    
g_iEntitiesEntity_Room ] = find_ent_by_tname( -1"traitroom" );
    
g_iEntitiesEntity_Wood ] = find_ent_by_tname( -1"traitwood" );
    
g_iEntitiesEntity_Place ] = find_ent_by_tname( -1"traitplace" );
    
g_iEntitiesEntity_Tester ] = find_ent_by_tname( -1"traittester" );
    
g_iEntitiesEntity_Explosive ] = find_ent_by_tname( -1"traitexplosive" );
}

public 
ttt_gamemodeiGamemode )
{
    if( 
iGamemode == GAME_PREPARING )
    {
        
entity_set_floatg_iEntitiesEntity_Room ], EV_FL_fuser10.0 );
        
entity_set_floatg_iEntitiesEntity_Wood ], EV_FL_fuser10.0 );
        
entity_set_floatg_iEntitiesEntity_Tester ], EV_FL_fuser10.0 );
        
entity_set_floatg_iEntitiesEntity_Explosive ], EV_FL_fuser10.0 );
    }
}

/* ========================================================================
*                 [ Hamsandwich ]
 * ======================================================================== */

public fw_PlayerButton_PreiEntiIdiActivatoriUseTypeFloat:fValue )
{
    static 
szTarget16 ]; entity_get_stringiEntEV_SZ_targetnameszTargetcharsmaxszTarget ) );
    
    if( 
iUseType == && fValue == 1.0 && IsEntityModdedszTarget ) && IsButtonUsableiEnt ) && is_user_aliveiId ) )
    {
        if( 
szTarget] == 't' )
        {
            if( 
IsEntityAliveg_iEntitiesEntity_Work ] ) )
            {
                new 
iOrigin];
                new 
iPlayer GetTesteablePlayer( );
                
                if( 
IsPlayerValidiPlayer ) )
                {
                    
get_user_originiPlayeriOrigin );
                    
                    
message_beginMSG_BROADCASTSVC_TEMPENTITY );
                    
write_byteTE_IMPLOSION );
                    
write_coordiOrigin] );
                    
write_coordiOrigin] );
                    
write_coordiOrigin] );
                    
write_byte200 );
                    
write_byte25 );
                    
write_byte28 );
                    
message_end( );
                    
                    
set_task3.0"ShowResults"iPlayer TASK_RESULT );
                    
                    
entity_set_floatiEntEV_FL_fuser1get_gametime( ) + 20.0 );
                    
entity_set_intiPlayerEV_INT_flagsentity_get_intiPlayerEV_INT_flags ) | FL_FROZEN );
                    
                    
client_print_color0print_team_default"^x04[TTT]^x01 No podras moverte hasta que termine la prueba." );
                }
                else
                {
                    
client_print_color0print_team_default"^x04[TTT]^x01 No hay ningun jugador sobre la plataforma." );
                    
                    
entity_set_floatiEntEV_FL_fuser1get_gametime( ) + 3.0 );
                }
            }
            else
            {
                
client_print_color0print_team_default"^x04[TTT]^x01 El tester fue destruido." );
            }
        }
        else
        {
            if( 
ttt_get_playerstateiId ) == PC_TRAITOR )
            {
                switch( 
szTarget] )
                {
                    case 
'r':
                    {
                        
client_print_color0print_team_default"^x04[TTT]^x01 No puedes ^"campear^" adentro de este lugar." );
                        
                        
entity_set_floatiEntEV_FL_fuser1get_gametime( ) + 10.0 );
                        
                        return 
HAM_IGNORED;
                    }
                    case 
'w':
                    {
                        
client_print_color0print_team_default"^x04[TTT]^x01 Los puentes han sido destruidos." );
                        
                        
entity_set_floatiEntEV_FL_fuser1get_gametime( ) + 500.0 );
                    }
                    case 
'e':
                    {
                        
client_print_color0print_team_default"^x04[TTT]^x01 La caja de explosivos ha sido detonada." );
                        
                        
entity_set_floatiEntEV_FL_fuser1get_gametime( ) + 500.0 );
                    }
                }
            }
            else
            {
                
client_print_color0print_team_default"^x04[TTT]^x01 Solo los traidores tienen acceso a este boton." );
            }
        }
        
        return 
HAM_SUPERCEDE;
    }
    
    return 
HAM_IGNORED;
}

/* ========================================================================
*                 [ Public Functions ]
 * ======================================================================== */
 
public ShowResultsiTaskId )
{
    new 
iState ttt_get_playerstateID_RESULT );
    
    
set_renderingID_RESULTkRenderFxGlowShellg_iTeamColorsiState ][ ], g_iTeamColorsiState ][ ], g_iTeamColorsiState ][ ], kRenderNormal50 );
    
entity_set_intID_RESULTEV_INT_flagsentity_get_intID_RESULTEV_INT_flags ) & ~FL_FROZEN );
    
    
set_task3.0"RemoveGlowing"ID_RESULT );
}

public 
RemoveGlowingiId )
{
    if( 
is_user_aliveiId ) )
    {
        
set_renderingiId );
    }
}

/* ========================================================================
*                 [ Private Functions ]
 * ======================================================================== */

GetTesteablePlayer( )
{
    new 
iNumiPlayers32 ];
    
    
get_playersiPlayersiNum"a" );
    
    for( 
iNum--; iNum >= 0iNum-- )
    {
        if( 
entity_rangeiPlayersiNum ], g_iEntitiesEntity_Place ] ) > 32.0 )
        {
            continue;
        }
        
        return 
iPlayersiNum ];
    }
    
    return 
0;


ttt_little_house

Código PHP:
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#include <ttt>
#include <xs>

/* ========================================================================
*                 [ Globals & Macros ]
* ======================================================================== */

#define MIN_DIST 16.0

#define IsModdedEntity(%0) ( %0[ 0 ] == 't' && %0[ 4 ] == 't' )
#define IsButtonUsable(%0) ( entity_get_float( %0, EV_FL_fuser1 ) <= get_gametime( ) )

const TASK_FOG 1111;

enum
{
    
END_POINT = -1,
    
ZOMBIE_POINT EV_INT_iuser2,
    
ZOMBIE_RUN 4,
    
ZOMBIE_IDLE 1,
    
ZOMBIE_ATTACK 75
}

enum _:Entity_Type
{
    
Entity_Fog,
    
Entity_Start,
    
Entity_Zombie
}

new 
g_iOwnerg_iMaxPlayersg_iEntitiesEntity_Type ];

new const 
g_szZombieModel[ ] = "models/ttt_little_house/zombie.mdl";
new const 
g_szZombieClassname[ ] = "ttt_zombie";

/* ========================================================================
*                 [ Initiation ]
* ======================================================================== */

public plugin_precache( )
{
    
precache_modelg_szZombieModel );
}

public 
plugin_init( )
{
    
register_plugin"[TTT] Little House Manager""1.0""Manu" );
    
    
RegisterHamHam_Use"func_button""fw_PlayerButton_Pre"false );
    
register_thinkg_szZombieClassname,"think_Zombie" );
    
    
set_cvar_num"sv_skycolor_r");
    
set_cvar_num"sv_skycolor_g");
    
set_cvar_num"sv_skycolor_b");
    
    
g_iMaxPlayers get_maxplayers( );
    
    
g_iEntitiesEntity_Fog ] = find_ent_by_tname( -1"traitfog" );
    
g_iEntitiesEntity_Start ] = find_ent_by_tname( -1"zmplace" );
    
g_iEntitiesEntity_Zombie ] = find_ent_by_tname( -1"traitzm" );
}

public 
ttt_gamemodeiGamemode )
{
    if( 
iGamemode == GAME_ENDED || iGamemode == GAME_PREPARING )
    {
        if( 
task_existsTASK_FOG ) )
        {
            
RemoveFog( );
            
remove_taskTASK_FOG );
        }
        
        
RemoveZombie( );
        
        
entity_set_floatg_iEntitiesEntity_Fog ], EV_FL_fuser10.0 );
        
entity_set_floatg_iEntitiesEntity_Zombie ], EV_FL_fuser10.0 );
    }
}

/* ========================================================================
*                 [ Zombie's brain ]
 * ======================================================================== */

public think_ZombieiEnt )
{
    new 
iPoint entity_get_intiEntZOMBIE_POINT );
    
    if( 
entity_rangeiEntiPoint ) < MIN_DIST )
    {
        static 
szData[32];
        
        
entity_get_stringiPointEV_SZ_targetszDatacharsmaxszData ) );
        
entity_set_intiEntZOMBIE_POINT, ( iPoint find_ent_by_tname( -1szData ) ) );
        
        if( !
is_valid_entiPoint ) )
        {
            
remove_entityiEnt );
            
            
g_iOwner = -1;
            
            return;
        }
    }
    
    
entity_set_floatiEntEV_FL_nextthinkget_gametime( ) + 0.1 );
    
    
WalkToEntityiEntiPoint );
    
KillNearPlayersiEnt );
}

/* ========================================================================
*                 [ Hamsandwich ]
 * ======================================================================== */

public fw_PlayerButton_PreiEntiIdiActivatoriUseTypeFloat:fValue )
{
    static 
szTarget16 ]; entity_get_stringiEntEV_SZ_targetnameszTargetcharsmaxszTarget ) );
    
    if( 
iUseType == && fValue == 1.0 && IsModdedEntityszTarget ) && IsButtonUsableiEnt ) && is_user_aliveiId ) )
    {
        if( 
ttt_get_playerstateiId ) == PC_TRAITOR )
        {
            switch( 
szTarget] )
            {
                case 
'f':
                {
                    
message_beginMSG_BROADCASTget_user_msgid"Fog" ), { 00}, );
                    
write_byte175 );
                    
write_byte175 );
                    
write_byte175 );
                    
write_byte90 );
                    
write_byte101 );
                    
write_byte68 );
                    
write_byte59 );
                    
message_end( );
                    
                    
entity_set_floatiEntEV_FL_fuser1get_gametime( ) + 90.0 );
                    
                    
set_task30.0"RemoveFog"TASK_FOG );
                    
                    
client_print_color0print_team_default"^x04[TTT]^x01 Una niebla ha cubierto el mapa durante 30 segundos." );
                }
                case 
'z':
                {
                    
CreateZombieiId );
                    
                    
entity_set_floatiEntEV_FL_fuser1get_gametime( ) + 90.0 );
                    
                    
client_print_color0print_team_default"^x04[TTT]^x01 Un zombie fue liberado en las alcantarillas." );
                }
            }
        }
        else
        {
            
client_print_color0print_team_default"^x04[TTT]^x01 Solo los traidores tienen acceso a este boton." );
            
            return 
HAM_SUPERCEDE;
        }
    }
    
    return 
HAM_IGNORED;
}

/* ========================================================================
*                 [ Public Functions ]
 * ======================================================================== */

public client_disconnectediId )
{
    if( 
g_iOwner == iId )
    {
        
RemoveZombie( );
    }
}

public 
RemoveFog( )
{
    
message_beginMSG_BROADCASTget_user_msgid"Fog" ), { 00}, );
    
write_byte);
    
write_byte);
    
write_byte);
    
write_byte);
    
write_byte);
    
write_byte);
    
write_byte);
    
message_end( );
}

/* ========================================================================
*                 [ Private Functions ]
 * ======================================================================== */

RemoveZombie( )
{
    new 
iEnt find_ent_by_class( -1g_szZombieClassname );
    
    if( 
is_valid_entiEnt ) )
    {
        
remove_entityiEnt );
    }
}

CreateZombie( const iOwner )
{
    new 
iEntFloat:fOrigin];
    
    if( !
is_valid_ent( ( iEnt create_entity"info_target" ) ) ) )
    {
        return;
    }
    
    
g_iOwner iOwner;
    
    
entity_set_stringiEntEV_SZ_classnameg_szZombieClassname );
    
    
entity_set_modeliEntg_szZombieModel );
    
entity_set_sizeiEntFloat:{ -16.0,-16.0,-32.0 }, Float:{ 16.0,16.0,32.0 } );
    
    
entity_set_intiEntEV_INT_movetypeMOVETYPE_PUSHSTEP );
    
entity_set_intiEntEV_INT_solidSOLID_TRIGGER );
    
entity_set_intiEntZOMBIE_POINTfind_ent_by_tname0"zm_point1" ) );
    
    
entity_get_vectorg_iEntitiesEntity_Start ], EV_VEC_originfOrigin );
    
entity_set_originiEntfOrigin );
    
    
entity_set_floatiEntEV_FL_health500.0 );
    
entity_set_floatiEntEV_FL_takedamageDAMAGE_YES );
    
entity_set_floatiEntEV_FL_gravity1.0 );
    
    
entity_set_floatiEntEV_FL_nextthinkget_gametime( ) + 0.1 );
    
    
drop_to_flooriEnt );
    
    
PlaySequenceiEntZOMBIE_IDLE );
}

WalkToEntityiEntiTarget )
{
    static 
Float:fOrigin], Float:fTarget], Float:fAngles];
    
    
entity_get_vectoriEntEV_VEC_originfOrigin );
    
entity_get_vectoriTargetEV_VEC_originfTarget );
    
    
xs_vec_subfTargetfOriginfTarget );
    
xs_vec_normalizefTargetfTarget );
    
vector_to_anglefTargetfAngles );
    
xs_vec_mul_scalarfTarget16.0fTarget );
    
    
fAngles] = 0.0;
    
    
entity_set_vectoriEntEV_VEC_anglesfAngles );
    
entity_set_vectoriEntEV_VEC_velocityfTarget );
    
    
engfuncEngFunc_WalkMoveiEntfAngles], 20.0WALKMOVE_NORMAL );
    
    if( 
entity_get_intiEntEV_INT_sequence ) != ZOMBIE_RUN )
    {
        
PlaySequenceiEntZOMBIE_RUN );
    }
}

KillNearPlayersiEnt )
{
    for( new 
iIdiId <= g_iMaxPlayersiId++ )
    {
        if( 
is_user_aliveiId ) && entity_rangeiEntiId ) < 64.0 )
        {
            
PlaySequenceiEntZOMBIE_ATTACK );
            
ExecuteHamHam_KillediIdg_iOwner);
            
entity_set_floatiEntEV_FL_nextthinkget_gametime( ) + 1.0 );
            
            break;
        }
    }
}

PlaySequenceiEntiSequence )
{
    if( !
is_valid_entiEnt ) )
    {
        return;
    }
    
    
entity_set_floatiEntEV_FL_animtimeget_gametime( ) );
    
entity_set_floatiEntEV_FL_framerate1.0 );
    
entity_set_intiEntEV_INT_sequenceiSequence );

No hago trabajos privados. Si necesitás ayuda, abrí un nuevo tema.
¿Buscás un ejemplo o algún modo de juego? Podés echarle un vistazo a mis aportes
.
Responder
#7
Se debe crear una carpeta "maps" y dentro meter ese .ini y dentro de el .ini poner el nombre de el plugin??

// osea que se tiene que crear un plugin para cada mapa? y así con sus entidades? es que yo mire otros mapas que tenian asi puertas de traidores y así, creo que mire el ttt_construct o algo así
[Imagen: 76561198258768928.png][Imagen: AddFriend.png]
Responder
#8
No necesariamente es un plugin para cada mapa, pasa que yo solo hice dos y como son tan diferentes uno del otro entonces los hice por separado.

Si tenés distintas ideas para cada mapa entonces es preferible hacer un plugin para cada a menos que pienses tener varios mapas con entidades que solo sean usables por traidores, pero no vas a encontrar muchos mapas así (posiblemente ninguno, porque implica crear un mapa).

Si estás dispuesto a crear los mapas entonces posiblemente te convenga un plugin general con distintas funcionalidades para poder manejar de forma genérica esos mapas "custom".

EDIT: Si, creo que va en maps.
No hago trabajos privados. Si necesitás ayuda, abrí un nuevo tema.
¿Buscás un ejemplo o algún modo de juego? Podés echarle un vistazo a mis aportes
.
Responder
#9
Gracias Sonrisa Proud
[Imagen: 76561198258768928.png][Imagen: AddFriend.png]
Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)