AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   Disconnect Reason (https://forums.alliedmods.net/showthread.php?t=166239)

Bugsy 09-01-2011 09:27

Disconnect Reason
 
4 Attachment(s)
Disconnect Reason
.: v0.6

Description

This plugin notifies players via chat and console the reason that a player has disconnected (ie. Timed out, Client sent 'drop', Kicked). The standard console message notifying of a player disconnect will not be shown when the plugin is enabled. I've also eliminated the cvars found in the previous release that controlled notification types and notification methods; all types of disconnects are displayed in both chat and console. There is also a forward which allows you to utilize disconnect reasons in your own plugins 'client_disconnect_reason( id , drCode , szReason[] )', see below example. The forward remains active regardless of the dr_enabled cvar value which will only control chat\console message. Made by request.

CVars
  • dr_enabled <0/1> - Chat\console notification enabled\disabled status.
    • Default: 1 (0=disabled, 1=enabled)

Forwards
  • client_disconnect_reason( id , drCode , const szReason[] ) - Forward for client_disconnect with reason.
    • id - Player id
    • drCode - Disconnect reason code
      • DR_TIMEDOUT
      • DR_DROPPED
      • DR_KICKED
      • DR_LEVELCHANGE
      • DR_OTHER
    • szReason - Disconnect reason in text form: "Timed out", "Client sent 'drop'", "Kicked", "Dropping fakeclient on level change".

Disconnect Reason Codes
PHP Code:

enum ReasonCodes
{
    
DR_TIMEDOUT,
    
DR_DROPPED,
    
DR_KICKED,
    
DR_LEVELCHANGE,
    
DR_OTHER


Modules
  • Orpheu

Installation
  • Place compiled (.amxx) file in plugins directory as with any other plugin.
  • Place the SV_DropClient file (found in signatures.zip) in amxmodx\configs\orpheu\functions.
  • For forward to work in your plugin(s), you must have this plugin running (do not #include it).

ScreenShots
http://img.photobucket.com/albums/v2...ona/t_chat.jpg

http://img.photobucket.com/albums/v2...na/ct_chat.jpg

http://img.photobucket.com/albums/v2...na/console.jpg

Example Plugin
PHP Code:

#include <amxmodx>

new const Version[] = "0.1";

enum ReasonCodes
{
    
DR_TIMEDOUT,
    
DR_DROPPED,
    
DR_KICKED,
    
DR_LEVELCHANGE,
    
DR_OTHER
}

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

public 
client_disconnect_reasonid ReasonCodes:drReason , const szReason[] )
{
    
//Display info
    
server_print"id=%d ReasonCode=%d ReasonText=^"%s^"" id drReason szReason );
    
    switch ( 
drReason )
    {
        case 
DR_TIMEDOUTserver_print"Poor guy timed out" );
        case 
DR_DROPPEDserver_print"Ughh, another player left my server :(" );
        case 
DR_KICKEDserver_print"Player kicked, toodaloo!" );
        case 
DR_LEVELCHANGEserver_print"Server changed map, he didnt leave" );
        case 
DR_OTHERserver_print"hmm, why did he get disconnected?" );
    }


Changelog:
  • v0.6
    • Added 'Dropping fakeclient on level change' disconnect reason.
  • v0.5
    • Added client_disconnect_reason forward for hooking client_disconnect with reason.
  • v0.4
    • Removed Sys_Printf hook since I'm pretty sure it is only used for printing to server console which nobody sees anyway so it's pointless to block. I initially assumed it printed to both server and client consoles.
    • Added block for message #Game_disconnected to prevent players from seeing "Name has left the game" in console.
    • Removed post hook for SV_DropClient since it was not needed.
      • v0.4a
        • Minor code cleanup
  • v0.3
    • Improved signature used for SV_DropClient
    • Removed cvars for controlling type and method, all disconnect types are notified in both chat and console.
    • Added Sys_Printf hook to block the default disconnect message in console.
  • v0.2
    • Added condition to check that a real player is disconnecting. xPaw reported that a notification appeared with the server name (id=0).
    • Changed chat notification from messaging all players individually to a single message to all.
  • v0.1
    • Initial release

3400 7/3/15

Pastout 09-01-2011 09:33

Re: Disconnect Reason
 
Wow, cool

xPaw 09-01-2011 09:42

Re: Disconnect Reason
 
Why not use MSG_BROADCAST for chat message?

Bugsy 09-01-2011 09:56

Re: Disconnect Reason
 
I copied that function from my aimbot detect plugin which notifies on a per player basis. I will modify when I get home.

dark_style 09-01-2011 10:39

Re: Disconnect Reason
 
Good job. :)

Arkshine 09-01-2011 10:49

Re: Disconnect Reason
 
I have to update my tutorial but a better rule would be : all can be changed except the first byte and local vars (e*x).

So you get something like :
Code:

[0x55,0x8B,"*",0x81,"*","*","*","*","*",0x8B,0x4D,"*",0x53,0x56,0x8D,0x45,"*",0x57,0x50,0x51]

Lolz0r 09-01-2011 10:52

Re: Disconnect Reason
 
Nice plugin! :)

Bugsy 09-01-2011 11:02

Re: Disconnect Reason
 
I didn't understand the signature mask part very well. I tried to do exactly what was done in the sigscanning tut and your (Arkshine) tut, but for the most post I was just experimenting and it worked. A tutorial dedicated to making signatures/masks from a newbie perspective would be very useful. I have no experience on the subject.

dark_style 09-01-2011 11:06

Re: Disconnect Reason
 
I have an idea for you. What about to add the reason when mp_autokick is set to 1 and the player get kicked by it? :)

Arkshine 09-01-2011 11:19

Re: Disconnect Reason
 
If it can help better :

Code:

55                  push    ebp
8B EC                mov    ebp, esp
81 EC 00 06 00 00    sub    esp, 600h
8B 4D 10            mov    ecx, [ebp+Format]
53                  push    ebx
56                  push    esi
8D 45 14            lea    eax, [ebp+Args]
57                  push    edi
50                  push    eax           
51                  push    ecx

- Blue -> You keep always the first byte, and if there is only one ignore what you see after. (like 'ebp' in the first line)
- Green -> When you see e*x is used, you can keep the byte

Others = could be changed.


All times are GMT -4. The time now is 11:44.

Powered by vBulletin®
Copyright ©2000 - 2020, vBulletin Solutions, Inc.