Raised This Month: $ Target: $400
 0% 

Catching "reconnect" command.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BOYSplayCS
BANNED
Join Date: Apr 2008
Location: Gainesville, FL
Old 09-02-2009 , 09:33   Catching "reconnect" command.
Reply With Quote #1

How would I go about doing this? Please, don't ask me why, it's a secret that will be reveled soon ;).
BOYSplayCS is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 09-02-2009 , 09:55   Re: Catching "reconnect" command.
Reply With Quote #2

register_clcmd("reconnect", "haha")
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 09-02-2009 , 10:07   Re: Catching "reconnect" command.
Reply With Quote #3

PHP Code:
register_clcmd("reconnect""haha")

public 
haha()
{
new 
name[33]
get_user_name(id,name,32)
client_print(0,print_chat,"user %s isn idiot & trys to reconnect",name)

__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 09-02-2009 , 10:12   Re: Catching "reconnect" command.
Reply With Quote #4

I don't think the "reconnect" and "retry" commands can be hooked via register_clcmd( ).

You should try saving player data when the player disconnects.
Then, then a player connects, check to see if the player's data was saved.
If the player hasn't connected after X minutes from disconnecting, remove the saved data.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 09-02-2009 , 11:40   Re: Catching "reconnect" command.
Reply With Quote #5

Yes, they aren't send to the server. I believe the best way would be checking if connected player is the one that left previously.
SnoW is offline
Send a message via MSN to SnoW
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 09-02-2009 , 14:38   Re: Catching "reconnect" command.
Reply With Quote #6

Also, you can check the method viewing the code of plugins like No retry, No reconnect, etc...
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
Javivi
AlliedModders Donor
Join Date: Dec 2008
Old 09-02-2009 , 16:46   Re: Catching "reconnect" command.
Reply With Quote #7

Yes, watch this plugin:

http://forums.alliedmods.net/showthread.php?t=63484
__________________
Javivi is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 09-02-2009 , 17:02   Re: Catching "reconnect" command.
Reply With Quote #8

This one does it better:
http://forums.alliedmods.net/showthread.php?t=101937

EDIT:

I decided to write up an example of one that is like the link provided above, but also has support for removing the data after X minutes since the player left.

Code:
#include < amxmodx > #include < amxmisc > const TASK_ID_REMOVE = 1337; new Array:g_aReconnectSteamIDs; new Trie:g_tArrayPos; new g_iArraySize; public plugin_init( ) {     g_aReconnectSteamIDs = ArrayCreate( 35 );     g_tArrayPos = TrieCreate( ); } public plugin_end( ) {     ArrayDestroy( g_aReconnectSteamIDs );     TrieDestroy( g_tArrayPos ); } public client_authorized( client ) {     static szAuthid[ 35 ];     get_user_authid( client, szAuthid, 34 );         static iArrayPos;     if( !TrieGetCell( g_tArrayPos, szAuthid, iArrayPos ) )     {         return;     }         // client reconnected         RemoveReconnect( szAuthid, iArrayPos ) } public client_disconnect( client ) {     static szAuthid[ 35 ];     get_user_authid( client, szAuthid, 34 );         set_task( 60.0, "TaskRemoveReconnect", TASK_ID_REMOVE + AddReconnect( szAuthid ) ); } public TaskRemoveReconnect( iTaskId ) {     RemoveReconnect( _, ( iTaskId - TASK_ID_REMOVE ) ); } AddReconnect( szGivenAuthid[ ] ) {     static szAuthid[ 35 ], iArrayPos;         for( iArrayPos = 0; iArrayPos < g_iArraySize; iArrayPos++ )     {         ArrayGetString( g_aReconnectSteamIDs, iArrayPos, szAuthid, 34 );                 if( !szAuthid[ 0 ] )         {             ArraySetString( g_aReconnectSteamIDs, iArrayPos, szGivenAuthid );             TrieSetCell( g_tArrayPos, szGivenAuthid, iArrayPos );                         return iArrayPos;         }     }         iArrayPos = g_iArraySize++;         ArrayPushString( g_aReconnectSteamIDs, szGivenAuthid );     TrieSetCell( g_tArrayPos, szGivenAuthid, iArrayPos );         return iArrayPos; } RemoveReconnect( szGivenAuthid[ ]="", iGivenArrayPos=-1 ) {     static szAuthid[ 35 ], iArrayPos;     copy( szAuthid, 34, szGivenAuthid );     iArrayPos = iGivenArrayPos;         if( !szAuthid[ 0 ] )     {         if( iArrayPos < 0 )         {             return;         }                 ArrayGetString( g_aReconnectSteamIDs, iArrayPos, szAuthid, 34 );     }     else if( iArrayPos < 0 )     {         if( !TrieGetCell( g_tArrayPos, szAuthid, iArrayPos ) )         {             return;         }     }         ArraySetString( g_aReconnectSteamIDs, iArrayPos, "" );     TrieDeleteKey( g_tArrayPos, szAuthid );         remove_task( TASK_ID_REMOVE + iArrayPos ); }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!

Last edited by Exolent[jNr]; 09-02-2009 at 17:40.
Exolent[jNr] is offline
BOYSplayCS
BANNED
Join Date: Apr 2008
Location: Gainesville, FL
Old 09-02-2009 , 19:01   Re: Catching "reconnect" command.
Reply With Quote #9

That's a decent size script for such a small idea.
BOYSplayCS is offline
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 15:12.


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