AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Reason for disconnection amxx 1.9 (https://forums.alliedmods.net/showthread.php?t=315660)

iceeedr 04-18-2019 00:34

Reason for disconnection amxx 1.9
 
Hello, I'm having trouble capturing the reason for the player's disconnect, below is a small plug made for testing.

PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "Bruno"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
// Add your code here...
}

public 
client_disconnected(idbool:dropMsg[], Len)
{
    
drop true
    log_amx
("%s"Msg)


And this is what I get in the log ...

In fact I can not capture the message ... it can be sleep disturbing me kkkkk

PHP Code:

L 04/18/2019 01:21:29: [test.amxxOT
L 04
/18/2019 01:21:29: [test.amxxOT
L 04
/18/2019 01:21:29: [test.amxxOT
L 04
/18/2019 01:21:29: [test.amxxOT
L 04
/18/2019 01:21:29: [test.amxxOT
L 04
/18/2019 01:21:29: [test.amxxOT
L 04
/18/2019 01:21:29: [test.amxxOT
L 04
/18/2019 01:21:29: [test.amxxOT
L 04
/18/2019 01:21:29: [test.amxxOT
L 04
/18/2019 01:21:29: [test.amxxOT 


E1_531G 04-18-2019 12:06

Re: Reason for disconnection amxx 1.9
 
You can't do this:
PHP Code:

drop true 

it has no logic.

client_disconnected() is a forward, it notice you the thing that already happen.

PHP Code:

public client_disconnected(idbool:dropMsg[], Len

    if( 
drop 
        
server_printMsg 


Also, drop is false if you exit from the server by yourself.

iceeedr 04-18-2019 12:59

Re: Reason for disconnection amxx 1.9
 
Exactly! Now we get where I wanted to go, I want to know the reason for the disconnection to execute an action, if it is output of its own accord, but the message is only written if the drop is true, so I was in a dead end.

E1_531G 04-18-2019 13:10

Re: Reason for disconnection amxx 1.9
 
PHP Code:

public client_disconnected(idbool:dropMsg[], Len)  
{  
    if( 
drop )  
        
server_printMsg )  // afk, timeout, overflow, kick
    
else
        
server_print"It was a player's decision to exit" // ESC on connect, disconnect/quit



iceeedr 04-18-2019 14:49

Re: Reason for disconnection amxx 1.9
 
For some reason, I'm still having problems, when I use the debug (as you did above) everything is ok, but when I add some action ... simply ignore bool: drop ...

Bugsy 04-18-2019 19:52

Re: Reason for disconnection amxx 1.9
 
Show your code

iceeedr 04-22-2019 09:37

Re: Reason for disconnection amxx 1.9
 
Quote:

Originally Posted by Bugsy (Post 2648114)
Show your code


Sure.

PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "arsmi"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
// Add your code here...
}

public 
client_disconnected(idbool:dropmessage[], maxlen)
{
    if(
drop)
    {
        
log_amx("dropped by server")
        return 
PLUGIN_HANDLED
    
}
    else 
    {
        
log_amx("Player dropped itself")
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_HANDLED


Code:

L 04/22/2019 - 10:00:32: [plmenu.amxx] Kick: "iceeedR<1><STEAMxxxxxx><>" kick "iceeedR<1><STEAMxxxxxx><>"
L 04/22/2019 - 10:00:33: [tst.amxx] Player dropped itself

Another question, sometimes it is possible to get the team from whoever left "cs_get_user_team"), and sometimes it generates the error log, but this is correct? Given that in the API says "When this fires the entity player is still valid (eg is_user_connected (id) will return true), but in the networked commands will reach the client. "

thEsp 04-22-2019 10:55

Re: Reason for disconnection amxx 1.9
 
I think you can hook team change, and store players team into a global variable.

iceeedr 04-22-2019 11:04

Re: Reason for disconnection amxx 1.9
 
Yes, I already do this, but the question is ... if the player is still "valid" even returning the boolean connect as true, why trying to get the player team generates the invalid player log ... does not do much sense.

E1_531G 04-22-2019 15:20

Re: Reason for disconnection amxx 1.9
 
Quote:

Originally Posted by iceeedr (Post 2648519)
Yes, I already do this, but the question is ... if the player is still "valid" even returning the boolean connect as true, why trying to get the player team generates the invalid player log ... does not do much sense.

Try to get m_iTeam from a player ID if entity is valid:
PHP Code:

if( pev_valid(id) == team get_pdata_intidm_iTeam



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

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