Raised This Month: $32 Target: $400
 8% 

catch on client_disconnect


Post New Thread Reply   
 
Thread Tools Display Modes
E1_531G
Senior Member
Join Date: Dec 2017
Old 11-10-2018 , 12:32   Re: catch on client_disconnect
Reply With Quote #11

xPaw's solution didn't work anymore?
https://forums.alliedmods.net/showth...=xpaw+deathrun
__________________
My English is A0
E1_531G is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-10-2018 , 12:50   Re: catch on client_disconnect
Reply With Quote #12

Added 'e' flag and added Terrorist.

If using 1.9 then you should use get_players_ex() with the appropriate flags.
__________________
Bugsy is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 11-10-2018 , 13:06   Re: catch on client_disconnect
Reply With Quote #13

@e1, idk i dont use his plugin anymore
thanks bugsy for that..probably gonna use that func cuz i dont see how to detect if player timed_out without orpeu
__________________
KZ Public Autocup - PrimeKZ

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

I wouldn't bother doing much more for this, what I gave you will cover what you need.
__________________
Bugsy is offline
shauli
Member
Join Date: Jun 2018
Old 11-11-2018 , 06:03   Re: catch on client_disconnect
Reply With Quote #15

Quote:
Originally Posted by JocAnis View Post
interesting, thanks..
but because its deathrun (1TR + othersCT) we can shorten it to not loop all players, but only to check TR ?
If you do that then save the new terrorist origin immediately after teleporting him, for the rare cases that the new terrorist will instantly retry before the loop happens.
shauli is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 11-11-2018 , 16:57   Re: catch on client_disconnect
Reply With Quote #16

@shauli, hmm didint undestand what exactly do you mean
idk why but i really have desire to it with client_disconnect ...tryed with kill process (if that includes task manager, dunno) and the origin was correct, the practical code would be:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <cstrike>
#include <hamsandwich>
#include <colorchat>

#define PLUGIN "TR Replacer"
#define VERSION "1.0"
#define AUTHOR "doesntmatter"

new Float:fOrigin]
new 
g_Name33 ]

public 
plugin_init() 
{
    
register_pluginPLUGINVERSIONAUTHOR )
}
public 
client_disconnectid )
{
    if( 
is_user_botid ) || cs_get_user_teamid ) != CS_TEAM_T )
        return
    
    
entity_get_vectoridEV_VEC_originfOrigin )
    
get_user_nameidg_Namecharsmaxg_Name ) )
        
    new 
ctAlive32 ], ctDead32 ], ctDctAii
    
    get_players
ctAlivectA"aeh""CT" )
    
get_playersctDeadctD"beh""CT" )
    
    if( 
ctD >= && ctA >= //priority is to transfer dead players, but if there min 2cts
    
{
        
ii ctDeadrandomctD ) ]
        
Respawnii)
    }
    else if( 
ctD == && ctA >= )
    {
        
ii ctAliverandomctA ) ]
        
Respawnii)
    }    
}
public 
Respawnidtype )
{
    new 
name32 ]
    
get_user_nameidnamecharsmaxname ) )
    
cs_set_user_teamidCS_TEAM_T )
    
    if( 
type == //dead CT
    
{
        
ExecuteHamBHam_CS_RoundRespawnid )    
    }
    
entity_set_originidfOrigin )
    
    
ColorChat0BLUE"^4[DR]^1 %s disconnected, new terrorist is:^3 %s"g_Namename )

__________________
KZ Public Autocup - PrimeKZ

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

Last edited by JocAnis; 11-12-2018 at 07:20. Reason: check tr disconnect
JocAnis is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 01-28-2019 , 17:05   Re: catch on client_disconnect
Reply With Quote #17

i think its better to continue this thread, than making new:
problem is, why client_disconnect cant catch this?
PHP Code:
public client_disconnectedid )
{
    
g_isAliveid ] = false
    
if( g_iTeamid ] > -)
    {
        
client_printg_iTeamid ], print_chat"Your teammate left the server..." //this wont show
        
g_iTeamg_iTeamid ] ] = -//this wont change
        
g_iTeamid ] = -//dunno for this cuz on putinserver its already -1 per id
    
}

anyone got solution?
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)
JocAnis is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 01-28-2019 , 19:01   Re: catch on client_disconnect
Reply With Quote #18

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 } );

If you try to call any specific natives for players in client_disconnected it will cause "invalid client" error, that's what I noticed in my tests.
__________________









Last edited by CrazY.; 01-28-2019 at 19:04.
CrazY. is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 01-30-2019 , 12:07   Re: catch on client_disconnect
Reply With Quote #19

Quote:
Originally Posted by JocAnis View Post
i think its better to continue this thread, than making new:
problem is, why client_disconnect cant catch this?
PHP Code:
public client_disconnectedid )
{
    
g_isAliveid ] = false
    
if( g_iTeamid ] > -)
    {
        
client_printg_iTeamid ], print_chat"Your teammate left the server..." //this wont show
        
g_iTeamg_iTeamid ] ] = -//this wont change
        
g_iTeamid ] = -//dunno for this cuz on putinserver its already -1 per id
    
}

anyone got solution?
i have no idea why i did disconnectED here...with client_disconnect is all ok..
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)
JocAnis is offline
E1_531G
Senior Member
Join Date: Dec 2017
Old 01-30-2019 , 16:09   Re: catch on client_disconnect
Reply With Quote #20

Maybe because client_disconnect is deprecated? And client_disconnected is the enhanced version of it.
__________________
My English is A0
E1_531G is offline
Reply



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 15:54.


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