Han ocurrido los siguientes errores:
Warning [2] Undefined variable $unreadreports - Line: 119 - File: global.php(961) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/global.php(961) : eval()'d code 119 errorHandler->error_callback
/global.php 961 eval
/printthread.php 16 require_once



MxEMexico
[Aporte] Mercader + Configuración. - Versión para impresión

+- MxEMexico (https://www.mxemexico.com)
+-- Foro: Extras (https://www.mxemexico.com/forumdisplay.php?fid=162)
+--- Foro: Pawn/Scripting. (https://www.mxemexico.com/forumdisplay.php?fid=100)
+--- Tema: [Aporte] Mercader + Configuración. (/showthread.php?tid=4338)



Mercader + Configuración. - Sky^^ - 01-28-2018

FUNCIÓN: Al tipear en say '/mercader' se abrirá un menú donde puedes crear una entidad a la cual le puse de nombre 'Mercader'.
La entidad se creará a donde apuntes, la entidad no se mueve ni nada, al presionar la E cerca de ella manda un print( esto se puede editar ).
La entidad se guarda automáticamente en un archivo .ini.

CÓDIGO:
Código PHP:
/* ============================================== */

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <engine>
#include <fakemeta>

new const szPlugin[ ][ ] = { "Mercader + Configuration""1.0""Sky^^" };
new const 
szMessages[ ][ ] = { "^3MERCADER:^1""^3ERROR:^1" };
new const 
szPrefixMenu[ ] = "\yMERCADER:\w";

/* ============================================== */

#define MERCHANT_CLASSNAME "MERCHANT_NPC"
#define MERCHANT_MODEL "models/Merchant/gman.mdl"

new const g_szSoundOpen[ ][ ] = { "MERCADER/M_OPENM.wav" };
new const 
g_szSoundError[ ][ ] = { "MERCADER/M_ERROR.wav" };
new const 
g_szSoundNext[ ][ ] = { "MERCADER/M_NEXT.wav" };

new 
g_szFile128 ];

/* ============================================== */

public plugin_init( )
{
    
register_pluginszPlugin], szPlugin], szPlugin] );
    
    
register_clcmd"say /mercader""menu_Mercader" );
    
    
RegisterHamHam_Use"func_button""fw_UseButton" );
    
    
register_thinkMERCHANT_CLASSNAME"fw_Merchant_Think" );
}
public 
plugin_precache( )
{
    new 
i;
    
    
engfuncEngFunc_PrecacheModelMERCHANT_MODEL );
    
engfuncEngFunc_PrecacheGeneric"models/gmanT.mdl" );
    
    for( 
0sizeof g_szSoundOpeni++ ) engfuncEngFunc_PrecacheSoundg_szSoundOpen] );
    for( 
0sizeof g_szSoundErrori++ ) engfuncEngFunc_PrecacheSoundg_szSoundError] );
    for( 
0sizeof g_szSoundNexti++ ) engfuncEngFunc_PrecacheSoundg_szSoundNext] );
}

public 
plugin_cfg( )
{
    new 
szDir64 ], szMapName32 ];
    
get_localinfo"amxx_configsdir"szDircharsmaxszDir ) );
    
    
get_mapnameszMapNamecharsmaxszMapName ) );
    
strtolowerszMapName );
    
    
formatexg_szFilecharsmaxg_szFile ), "%s/mercader/%s.ini"szDirszMapName );
    
    if (!
file_existsg_szFile ) )
    {
        
server_print"No hay Mercader's guardados en este mapa" );
        
        
addszDircharsmaxszDir ), "/mercader" );
        
        if( !
dir_existsszDir ) )
            
mkdirszDir );
    }
    else
        
ReadFile( );
}

ReadFile( )
{
    new 
szData64 ], szX13 ], szY13 ], szZ13 ], Float:Origin];
    
    new 
File fopeng_szFile"rt" );
    
    while( !
feofFile ) )
    {
        
fgetsFileszDatacharsmaxszData ) );
        
        if( !
szData] || szData] == ';' || szData] == ' ' || ( szData] == '/' && szData] == '/') )
            continue;
            
        
parseszDataszXcharsmaxszX ), szYcharsmaxszY ), szZcharsmaxszZ ) );
 
 
        Origin
] = str_to_floatszX );
        
Origin] = str_to_floatszY );
        
Origin] = str_to_floatszZ );
        
        
createMercaderOrigin );
    }
    
    
fcloseFile );
}

/* ============================================== */

public menu_Mercaderid )
{
    if( !
is_user_aliveid ) )
    {
        
emit_soundidCHAN_ITEMg_szSoundErrorrandom_num0sizeof g_szSoundError ) ], VOL_NORMATTN_NORM0PITCH_NORM );
        
ccid"%s Debes estar vivo para abrir el menu."szMessages] );
        return 
PLUGIN_HANDLED;
    }
    if( !
is_user_adminid ) ) 
    {
        
emit_soundidCHAN_ITEMg_szSoundErrorrandom_num0sizeof g_szSoundError ) ], VOL_NORMATTN_NORM0PITCH_NORM );
        
ccid"%s Debes ser administrador para abrir el menu."szMessages] );
        return 
PLUGIN_HANDLED;
    }
    
    static 
iFormatex90 ];
    
    
formatexiFormatexcharsmaxiFormatex ), "%s CONFIGURACION DEL MERCADER"szPrefixMenu );
    new 
iMenu menu_createiFormatex"hand_MenuMercader" );
    
    
menu_additemiMenu"\wCREAR\y MERCADER""1" );
    
    
menu_additemiMenu"\wBORRAR\y MERCADER""2" );
    
    
menu_additemiMenu"\wGUARDAR\y MERCADER's""3" );
    
    
menu_setpropiMenuMPROP_EXITNAME"SALIR" );
    
menu_displayidiMenu);
    
    return 
PLUGIN_HANDLED;
}
public 
hand_MenuMercaderidmenuitem )
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroymenu )
        return 
PLUGIN_HANDLED;
    }
    
    switch( 
item )
    {
        case 
0:
        {
            new 
i_Origin], Float:f_Origin];
            
get_user_originidi_Origin);
            
IVecFVeci_Originf_Origin );
                
            
f_Origin] += 20.0;
                
            if( 
createMercaderf_Origin ) )
            {
                
emit_soundidCHAN_ITEMg_szSoundNextrandom_num0sizeof g_szSoundNext ) ], VOL_NORMATTN_NORM0PITCH_NORM );
                
ccid"%s Mercader creado correctamente."szMessages] );
                
menu_Mercaderid );
            }
            else
            {
                
emit_soundidCHAN_ITEMg_szSoundErrorrandom_num0sizeof g_szSoundError ) ], VOL_NORMATTN_NORM0PITCH_NORM );
                
ccid"%s No se pudo crear el Mercader."szMessages] );
                
menu_Mercaderid );
            }
        }
        case 
1:
        {
            new 
entbody;
            
get_user_aimingidentbody9999 );
                
            if( 
is_valid_entent ) )
            {
                new 
szClass32 ];
                
entity_get_stringentEV_SZ_classnameszClasscharsmaxszClass ) );
                    
                if( 
equalszClassMERCHANT_CLASSNAME ) )
                {
                    
remove_entityent );
                    
emit_soundidCHAN_ITEMg_szSoundNextrandom_num0sizeof g_szSoundNext ) ], VOL_NORMATTN_NORM0PITCH_NORM );
                    
ccid"%s Mercader removido correctamente."szMessages] );
                    
menu_Mercaderid );
                }
                else
                {
                    
emit_soundidCHAN_ITEMg_szSoundErrorrandom_num0sizeof g_szSoundError ) ], VOL_NORMATTN_NORM0PITCH_NORM );
                    
ccid"%s Debes apuntar al Mercader para borrarlo."szMessages] );
                    
menu_Mercaderid );
                }
            }
            else
            {
                
emit_soundidCHAN_ITEMg_szSoundErrorrandom_num0sizeof g_szSoundError ) ], VOL_NORMATTN_NORM0PITCH_NORM );
                
ccid"%s Debes apuntar al Mercader para borrarlo."szMessages] );
                
menu_Mercaderid );
            }
        }
        case 
2:
        {
            new 
szData64 ], ent = -1 Float:Origin];
                        
            if( 
file_existsg_szFile ) )
                
delete_fileg_szFile );
                            
            new 
File fopeng_szFile"at" );
            
            
write_fileg_szFile"// Posiciones de los Mercader's." );
            
write_fileg_szFile"// NO MODIFICAR NADA." );
            
write_fileg_szFile"// Plugin by Skylar.^n" );
                        
            while( ( 
ent find_ent_by_class(entMERCHANT_CLASSNAME ) ) )
            {
                
entity_get_vectorentEV_VEC_originOrigin );
                                
                
formatexszDatacharsmaxszData ), "%f %f %f^n"Origin], Origin], Origin] );
                
                
fputsFileszData );
            }
            
            
fcloseFile );
            
            
emit_soundidCHAN_ITEMg_szSoundNextrandom_num0sizeof g_szSoundNext ) ], VOL_NORMATTN_NORM0PITCH_NORM );
            
ccid"%s Mercader's guardados correctamente."szMessages] );
        }
    }
            
    
menu_destroymenu );
    return 
PLUGIN_HANDLED;
}
            
public 
createMercaderFloat:Origin] )
{
    new 
i_Ent create_entity"func_button" );
    
    if( !
is_valid_enti_Ent ) )
        return 
PLUGIN_CONTINUE
   
    entity_set_string
i_EntEV_SZ_classnameMERCHANT_CLASSNAME );
    
entity_set_stringi_EntEV_SZ_target"merchant" );
    
entity_set_inti_EntEV_INT_solidSOLID_BBOX );
    
entity_set_modeli_EntMERCHANT_MODEL );
 
  
    
#define MERCHANT_MINS { -16.0, -16.0, 0.0 }
    #define MERCHANT_MAXS { 16.0, 16.0, 72.0 }
    
entity_set_sizei_EntFloat:MERCHANT_MINSFloat:MERCHANT_MAXS );
    
    
entity_set_origini_EntOrigin );
 
  
    entity_set_float
i_EntEV_FL_nextthinkhalflife_time( ) + 3.0 );
 
  
    drop_to_floor
i_Ent );
    
    return 
PLUGIN_HANDLED;
}

/* ============================================== */

public fw_Merchant_Thinkent )
{
    
entity_set_floatentEV_FL_animtimeget_gametime( ) );
    
entity_set_floatentEV_FL_framerate1.0 );
    
entity_set_intentEV_INT_sequencerandom_num0) );
    
    
entity_set_floatentEV_FL_nextthinkhalflife_time( ) + 3.0 );
}

public 
fw_UseButtonentid )
{
    if( !
ent || id 32 ) return HAM_IGNORED;
    if( !
is_user_aliveid ) ) return HAM_IGNORED;
    
    static 
szTarget32 ]; entity_get_stringentEV_SZ_targetszTargetcharsmaxszTarget ) )
    
    if( 
equalszTarget"merchant" ) )
    {
        
emit_soundidCHAN_ITEMg_szSoundOpenrandom_num0sizeof g_szSoundOpen ) ], VOL_NORMATTN_NORM0PITCH_NORM );
        
ccid"%s Se abrio el Shop."szMessages] );
    }
    
    return 
HAM_IGNORED;
}

/* ============================================== */

stock ccid, const input[], any:... )
{
    static 
szMsg191 ], msgSayText;
    
    if( !
msgSayText msgSayText get_user_msgid"SayText" );
    
    
vformatszMsg190input3) ;
    
    
replace_allszMsg190"!g""^4" );
    
replace_allszMsg190"!y""^1" );
    
replace_allszMsg190"!team""^3" );
    
    
message_beginid MSG_ONE_UNRELIABLE MSG_BROADCASTmsgSayText, .player id );
    
write_byteid id 33 );
    
write_stringszMsg );
    
message_end( );


ACÁ PUEDEN EDITAR LA FUNCIÓN QUE CUMPLIRÁ AL PRESIONAR LA TECLA 'E':

Código PHP:
public fw_UseButtonentid )
{
    if( !
ent || id 32 ) return HAM_IGNORED;
    if( !
is_user_aliveid ) ) return HAM_IGNORED;
    
    static 
szTarget32 ]; entity_get_stringentEV_SZ_targetszTargetcharsmaxszTarget ) )
    
    if( 
equalszTarget"merchant" ) )
    {
        
emit_soundidCHAN_ITEMg_szSoundOpenrandom_num0sizeof g_szSoundOpen ) ], VOL_NORMATTN_NORM0PITCH_NORM );
        
ccid"%s Se abrio el Shop."szMessages] );
    }
    
    return 
HAM_IGNORED;


RECURSOS: http://www.mediafire.com/file/by13p454a561rx4/Mercader%20Recursos.rar

Si tienen alguna duda me la comentan!