hlmod.hu
https://hlmod.hu/

Disconnect Reason [ Chatbe ]
https://hlmod.hu/viewtopic.php?f=29&t=8893
Oldal: 1 / 1

Szerző:  Anonymous1337 [ 2013.06.10. 11:17 ]
Hozzászólás témája:  Disconnect Reason [ Chatbe ]

Üdvözlök mindenkit! Amit VASTAGON írtam, azokat én írtam bele utólag! Tehát a kérdéseim a következőek lennének:

1, Saját magamon teszteltem a plugint, hogy ki e írja ha kickelem magam: NEM! Mit ronthattam el?

2, Szintén magamon teszteltem hogy ha lebanolom magam ír e valamit: NEM! Miért?

Ha jól értelmeztem a leírást, akkor elvileg CONSOLE -ba is kellene írnia ugyan azokat, mint Chatbe, de nem írja oda se!
Az eredeti leírásba, csatoltak egy képet:
Kép
(Nekem ilyet consoleba nem ír!)

The source:

#include <amxmodx>
#include <amxmisc>
#include <orpheu> // [ 5] Orpheu RUN - orpheu_amxx.dll v2.5.1 pl1 ANY ANY

new const Version[] = "0.5";

enum ReasonCodes
{
DR_TIMEDOUT,
DR_DROPPED,
DR_KICKED,
DR_BANNED,
DR_OTHER
}
new const DisconnectMessages[ ReasonCodes ][] =
{
"Idotullepes",
"Client sent 'drop'",
"Kirugva(kick)",
"Kitiltva(ban)",
""
};
enum DisconnectData
{
ReasonCode,
ReasonMessage[ 32 ]
}

new g_pEnabled , bool:g_bEnabled , g_szName[ 33 ][ 33 ] , g_DisconnectInfo[ DisconnectData ] , g_iFwdDisconnect;

public plugin_init()
{
register_plugin( "Disconnect Reason" , Version , "bugsy" );

g_pEnabled = register_cvar( "dr_enabled" , "1" );
register_cvar( "disconnectreason_version" , Version , ( FCVAR_SERVER | FCVAR_SPONLY ) );

OrpheuRegisterHook( OrpheuGetFunction( "SV_DropClient" ) , "SV_DropClient" );

register_message( get_user_msgid( "TextMsg" ) , "fw_MsgTextMsg" );

g_iFwdDisconnect = CreateMultiForward( "client_disconnect_reason", ET_CONTINUE , FP_CELL , FP_CELL , FP_STRING );
}

public client_putinserver( id )
{
get_user_name( id , g_szName[ id ] , charsmax( g_szName[] ) );
}

public OrpheuHookReturn:SV_DropClient( a , b , const szMessage[] )
{
if ( ( g_bEnabled = bool:!!get_pcvar_num( g_pEnabled ) ) )
{
copy( g_DisconnectInfo[ ReasonMessage ] , charsmax( g_DisconnectInfo[ ReasonMessage ] ) , szMessage );

new ReasonCodes:rcReason;
for ( rcReason = DR_TIMEDOUT ; rcReason < ReasonCodes ; rcReason++ )
{
if ( equal( szMessage , DisconnectMessages[ rcReason ] ) )
break;
}

g_DisconnectInfo[ ReasonCode ] = _:rcReason;
}
}

public client_disconnect( id )
{
new iReturn;
ExecuteForward( g_iFwdDisconnect , iReturn , id , g_DisconnectInfo[ ReasonCode ] , g_DisconnectInfo[ ReasonMessage ] );

if ( g_bEnabled )
{
console_print( 0 , "* %s lecsatlakozott - Ok [ %s ]" , g_szName[ id ] , g_DisconnectInfo[ ReasonMessage ] );
ChatNotify( id );
}
}

public fw_MsgTextMsg( iMsgID , iMsgDest , iMsgArgs )
{
static szMessage[ 19 ];
return ( g_bEnabled && get_msg_arg_string( 2 , szMessage , charsmax( szMessage ) ) && equal( szMessage , "#Game_disconnected" ) ) ? PLUGIN_HANDLED : PLUGIN_CONTINUE;
}

ChatNotify( iDisconnectID )
{
static szMessage[ 100 ] , iMsgSayText;
formatex( szMessage , charsmax( szMessage ) , "^1*^3 %s ^1lecsatlakozott - Ok [^4 %s ^1]" , g_szName[ iDisconnectID ] , g_DisconnectInfo[ ReasonMessage ] );

emessage_begin( MSG_BROADCAST , iMsgSayText ? iMsgSayText : ( iMsgSayText = get_user_msgid( "SayText" ) ) , _ , 0 );
ewrite_byte( iDisconnectID );
ewrite_string( szMessage );
emessage_end();
}

(Azért nem írtam
SMA Forráskód: [ Mindet kijelol ]
  1.  
mert akkor nem tudom kiemelni a lényeget.)!
============================================================
SMA Forráskód: [ Mindet kijelol ]
  1. static szMessage[ 100 ] , iMsgSayText;
  2. formatex( szMessage , charsmax( szMessage ) , "^1*^3 %s ^1lecsatlakozott - Ok [^4 %s ^1]" , g_szName[ iDisconnectID ] ,

Ezt nem értem!
Ez elvileg az a kód, hogy ha valaki lecsatlakozik, akkor CHATBE írja ki(Indokot és a nevét)!
Nem egyszerűbb lett volna így megoldani?(Ez csak feltételezés)
SMA Forráskód: [ Mindet kijelol ]
  1. client_print(0, print_chat, "[ Pelda-Prefix ] %s nullazta %s statisztikajat.", name, tempname);


Előre is köszönöm válaszotokat!

Üdv. [profil]Anonymous1337[/profil]

Oldal: 1 / 1 Minden időpont UTC+02:00 időzóna szerinti
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/