Raised This Month: $ Target: $400
 0% 

Catching "reconnect" command.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Javivi
AlliedModders Donor
Join Date: Dec 2008
Old 09-02-2009 , 16:46   Re: Catching "reconnect" command.
Reply With Quote #1

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 #2

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
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:12.


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