Raised This Month: $12 Target: $400
 3% 

catch on client_disconnect


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
JocAnis
Veteran Member
Join Date: Jun 2010
Old 11-08-2018 , 18:17   catch on client_disconnect
Reply With Quote #1

hey guys..where (or how) can i check what can we get from player when he disconnect's ?
im particulary interested in his last origin (which is impossible, its too late for that command ?) but we can get his nick, steamid, ip...something more?
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)
JocAnis is online now
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-08-2018 , 21:57   Re: catch on client_disconnect
Reply With Quote #2

Try it and see. What are you trying to do?
__________________
fysiks is offline
E1_531G
Senior Member
Join Date: Dec 2017
Old 11-09-2018 , 14:14   Re: catch on client_disconnect
Reply With Quote #3

API says the player entity is still valid, this means you can try to get his origin.
__________________
My English is A0
E1_531G is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-09-2018 , 18:21   Re: catch on client_disconnect
Reply With Quote #4

It may work but I would avoid it if possible. Can you maybe log it on his most recent kill/death, health change, money change, shot/damage, or any other game event?

FYI I just did this test and the origin was not accurate:
1. Spawn at T spawn in dust2.
2. Kill HL process, which resulted in my origin output when I timed out.
3. Recompiled the plugin to spawn myself at this origin and it was at bomb site B.

PHP Code:
#include <amxmodx>
#include <fakemeta>

public plugin_init() 
{
    
register_clcmd"say test" "Test" );
}

public 
client_disconnectid )
{
    new 
Float:fOrigin];
    
    if ( !
is_user_botid ) )
    {
        
pevid pev_origin fOrigin );
        
server_print"%d = %f %f %f" id fOrigin] , fOrigin] , fOrigin] )
    }
}

public 
Testid )
{
    
//Test 1 which is at bombsite B
    //set_pev( id , pev_origin , { -2080.000000 , 1824.000000 , 208.000000 } );
    
    //Test 2 was successful at CT spawn
    
set_pevid pev_origin , { 352.000000 2368.000000 , -87.000000 } );

__________________

Last edited by Bugsy; 11-09-2018 at 18:21.
Bugsy is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 11-09-2018 , 20:44   Re: catch on client_disconnect
Reply With Quote #5

Quote:
Originally Posted by Bugsy View Post
It may work but I would avoid it if possible. Can you maybe log it on his most recent kill/death, health change, money change, shot/damage, or any other game event?

FYI I just did this test and the origin was not accurate:
1. Spawn at T spawn in dust2.
2. Kill HL process, which resulted in my origin output when I timed out.
3. Recompiled the plugin to spawn myself at this origin and it was at bomb site B.

PHP Code:
#include <amxmodx>
#include <fakemeta>

public plugin_init() 
{
    
register_clcmd"say test" "Test" );
}

public 
client_disconnectid )
{
    new 
Float:fOrigin];
    
    if ( !
is_user_botid ) )
    {
        
pevid pev_origin fOrigin );
        
server_print"%d = %f %f %f" id fOrigin] , fOrigin] , fOrigin] )
    }
}

public 
Testid )
{
    
//Test 1 which is at bombsite B
    //set_pev( id , pev_origin , { -2080.000000 , 1824.000000 , 208.000000 } );
    
    //Test 2 was successful at CT spawn
    
set_pevid pev_origin , { 352.000000 2368.000000 , -87.000000 } );

It may be a stupid question, but have you also tested it with the public client_disconnected?
__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/
iceeedr is offline
Send a message via Skype™ to iceeedr
JocAnis
Veteran Member
Join Date: Jun 2010
Old 11-10-2018 , 08:02   Re: catch on client_disconnect
Reply With Quote #6

@fysiks, if tr leaves, replace ct with his origin, simple as that haha
@bugsy, interesting..i did this test: EDIT: thought fakemeta/engine will change anything
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <engine>

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

new Float:fOrigin]

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd"say /origin""origin" )
}
public 
client_disconnectid )
{
    if( !
is_user_botid ) )    
        
entity_get_vectoridEV_VEC_originfOrigin )
}
public 
originid )
{
    
entity_set_originidfOrigin )

and i tryed 3 times, all 3 worked (disconnect, retry, quit..) but im not sure what will be if player got crashed cs(cant think of the reason but maybe possible) or interenet connection lost, im not sure if it will be the same
edit: oh how now i see you did test with timed out
maybe to add check: if player timed out -> make normal spawn?
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)

Last edited by JocAnis; 11-10-2018 at 08:16.
JocAnis is online now
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-10-2018 , 09:21   Re: catch on client_disconnect
Reply With Quote #7

Can you provide a use-case for what you want to do with this origin? If it was me I would log it on some other game event, not disconnect.
__________________
Bugsy is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 11-10-2018 , 09:55   Re: catch on client_disconnect
Reply With Quote #8

deathrun mode...if TR player leaves server -> replace one CT with his last origin...the alternative is set_task with flag b on terror player untill he leaves haha
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)
JocAnis is online now
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-10-2018 , 10:33   Re: catch on client_disconnect
Reply With Quote #9

Yeah, there really is no game event for what you're trying to do. I would create a thinking entity and set the interval to maybe every 3-5 seconds to get all players origins.

You should add an additional condition to make sure the disconnecting player was actually in game prior to him leaving.

Something like this:
PHP Code:

#include <amxmodx>
#include <engine>

new const Version[] = "0.1";

const 
Float:OriginInterval 3.0;

new 
g_iEntity Float:g_fOriginsMAX_PLAYERS ][ ];

public 
plugin_init() 
{
    
register_plugin"Log Origins" Version "bugsy" );
    
    
g_iEntity create_entity"info_target" );
    
entity_set_stringg_iEntity EV_SZ_classname "lo_entity" );
    
register_think"lo_entity" "LOEntThink" );
    
entity_set_floatg_iEntity EV_FL_nextthink , ( get_gametime() + OriginInterval ) );
}

public 
client_disconnectid )
{
    if ( 
g_fOriginsid ][ ] )
    {
        
//spawn new player at g_fOrigins[ id ]
    
}
    
    
g_fOriginsid ][ ] = 0.0;
    
g_fOriginsid ][ ] = 0.0;
    
g_fOriginsid ][ ] = 0.0;
}

public 
LOEntThinkiEntity )
{
    if ( 
iEntity == g_iEntity 
    {
        new 
iPlayers32 ] , iNum id;
        
        
get_playersiPlayers iNum "aeh" "TERRORIST" );
        
        if ( 
iNum )
        {
            for ( new 
iNum i++ )
            {
                
id iPlayers];
                
entity_get_vectorid EV_VEC_origin g_fOriginsid ] );
            }
        }
        
        
entity_set_floatg_iEntity EV_FL_nextthink , ( get_gametime() + OriginInterval ) );
    }

__________________

Last edited by Bugsy; 11-10-2018 at 21:12.
Bugsy is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 11-10-2018 , 11:46   Re: catch on client_disconnect
Reply With Quote #10

interesting, thanks..
but because its deathrun (1TR + othersCT) we can shorten it to not loop all players, but only to check TR ?
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)

Last edited by JocAnis; 11-10-2018 at 11:47.
JocAnis is online now
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:30.


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