/*
| INFORMACIÓN |
# Este PLUGIN ha sido creado por Chema.
*/
#include < amxmodx >
// #include < amxmisc >
// #include < cstrike >
// #include < engine >
#include < fakemeta >
// #include < hamsandwich >
// #include < fun >
// #include < xs >
// #include < sqlx >
new CHAT_PREFIX[ ] = "!g[ vG ]!y";
new CONSOLE_PREFIX[ ] = "[ vG ]";
const MAX_ATTEMPTS = 3;
new g_iAttempts[ 33 ];
new g_szPlayerName[ 33 ][ 32 ];
public plugin_init( ) {
register_plugin( "Block Name Change", "1.0", "Chema" );
/*
| CÓDIGO |
# Agrega tú código aquí...
*/
register_forward( FM_ClientUserInfoChanged, "FM_UserInfoChanged" );
}
public client_putinserver( id ) {
get_user_name( id, g_szPlayerName[ id ], sizeof( g_szPlayerName ) );
g_iAttempts[ id ] = 0;
}
public FM_UserInfoChanged( id, szBuffer ) {
if( is_user_connected( id ) ) {
new szNewName [ 33 ];
engfunc( EngFunc_InfoKeyValue, szBuffer, "name", szNewName, sizeof( szNewName ) );
if( !equal( g_szPlayerName[ id ], szNewName ) ){
engfunc( EngFunc_SetClientKeyValue, id, szBuffer, "name", g_szPlayerName[ id ] );
client_cmd( id, "name ^"%s^"", g_szPlayerName[ id ] );
if( g_iAttempts[ id ] >= 3 ) {
server_cmd( "kick #%d ^"Has intentado cambiar el nombre 3 veces.^"", get_user_userid( id ) );
g_iAttempts[ id ] = 0;
}
g_iAttempts[ id ]++;
ColorChat( id, "Has intentado cambiar el nombre !g%i!y/!g%i!y.", g_iAttempts[ id ], MAX_ATTEMPTS );
console_print( id, "%s Has intentado cambiar el nombre %i/%i.", CONSOLE_PREFIX, g_iAttempts[ id ], MAX_ATTEMPTS );
}
}
return FMRES_IGNORED;
}
stock ColorChat( const id, const Text[ ], any:... ) {
new count = 1, players[ 32 ];
static msg[ 191 ], len, i;
len = formatex( msg, charsmax(msg), "%s ", CHAT_PREFIX );
vformat( msg[ len ], 190 - len, Text, 3 );
replace_all( msg, 190, "!g", "^4" );
replace_all( msg, 190, "!y", "^1" );
replace_all( msg, 190, "!t", "^3" );
static iLen = sizeof( msg );
replace_all( msg, iLen, "á", "á" );
replace_all( msg, iLen, "Á", "Ã" );
replace_all( msg, iLen, "é", "é" );
replace_all( msg, iLen, "É", "É" );
replace_all( msg, iLen, "í", "Ã*" );
replace_all( msg, iLen, "Í", "Ã" );
replace_all( msg, iLen, "ó", "ó" );
replace_all( msg, iLen, "Ó", "Ó" );
replace_all( msg, iLen, "ú", "ú" );
replace_all( msg, iLen, "Ú", "Ú" );
replace_all( msg, iLen, "ñ", "ñ" );
replace_all( msg, iLen, "Ñ", "Ñ" );
if( id )
players[ 0 ] = id;
else
get_players( players, count, "ch" );
for( i = 0; i < count; ++i) {
if( is_user_connected( players[ i ] ) )
writeMessage( players[ i ], msg );
}
}
stock writeMessage( player, message[ ] ) {
message_begin( MSG_ONE, get_user_msgid( "SayText" ), { 0, 0, 0 }, player );
write_byte( player );
write_string( message );
message_end( );
}