Raised This Month: $ Target: $400
 0% 

Handle disconected


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
quark
Veteran Member
Join Date: Oct 2011
Location: Your mind.
Old 09-14-2013 , 04:30   Handle disconected
Reply With Quote #1

Hey guys! Is possible to handle disconected players information and check after 5 minutes if he entered again?
__________________

Check out My Plugins:
qServerInfo ; ASKTAG
quark is offline
dark_style
Senior Member
Join Date: Jul 2009
Location: Bulgaria
Old 09-14-2013 , 04:40   Re: Handle disconected
Reply With Quote #2

I think ConnorMcLeod's Reconnect Features plugin should help you.
__________________




Last edited by dark_style; 09-14-2013 at 04:41.
dark_style is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 09-14-2013 , 05:59   Re: Handle disconected
Reply With Quote #3

You can easily do something like this:

Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #define PLUGIN "New Plugin" #define VERSION "1.0" #define AUTHOR "Author" new Trie: g_tPlayersLastConnection public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         g_tPlayersLastConnection = TrieCreate( ) } public client_disconnect( id ) {     new szAuthid[ 34 ]     get_user_authid( id, szAuthid, charsmax( szAuthid ) )         TrieSetCell( g_tPlayersLastConnection, szAuthid, get_systime( ) ) } public client_putinserver( id ) {     new szAuthid[ 34 ]     get_user_authid( id, szAuthid, charsmax( szAuthid ) )                 new iTime     TrieGetCell( g_tPlayersLastConnection, szAuthid, iTime )         if( get_systime( ) - iTime <= 300 )     {         // player has reconnected within 5 minutes     } }

Last edited by Backstabnoob; 09-15-2013 at 05:36.
Backstabnoob is offline
quark
Veteran Member
Join Date: Oct 2011
Location: Your mind.
Old 09-14-2013 , 07:34   Re: Handle disconected
Reply With Quote #4

Quote:
Originally Posted by Backstabnoob View Post
You can easily do something like this:

Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #define PLUGIN "New Plugin" #define VERSION "1.0" #define AUTHOR "Author" new Trie: g_tPlayersLastConnection public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         g_tPlayersLastConnection = TrieCreate( ) } public client_disconnect( id ) {     new szAuthid[ 34 ]     get_user_authid( id, szAuthid, charsmax( szAuthid ) )         TrieSetCell( g_tPlayersLastConnection, szAuthid, get_systime( ) ) } public client_putinserver( id ) {     new szAuthid[ 34 ]     get_user_authid( id, szAuthid, charsmax( szAuthid ) )         if( !TrieKeyExists( g_tPlayersLastConnection, szAuthid ) )         return                     new iTime     TrieGetCell( g_tPlayersLastConnection, szAuthid, iTime )         if( get_systime( ) - iTime <= 300 )     {         // player has reconnected within 5 minutes     } }
How can I do something with his steamid if he does not connect again?
__________________

Check out My Plugins:
qServerInfo ; ASKTAG
quark is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 09-14-2013 , 09:20   Re: Handle disconected
Reply With Quote #5

Code:
set_task(60.0*5, "prune", _, szAuthid, strlen(szAuthid)); public prune(szAuthid[]) {     TrieDeleteKey(g_tPlayersLastConnection, szAuthid); }

EDIT: If this is used you don't actually have to check the value of the trie cell. You also don't need to set a time for it. If it exists with any value the reconnect was within 5 minutes.
__________________

Last edited by Black Rose; 09-14-2013 at 12:25.
Black Rose is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 09-14-2013 , 11:39   Re: Handle disconected
Reply With Quote #6

Quote:
Originally Posted by quark View Post
How can I do something with his steamid if he does not connect again?
You will have to loop through all the values stored in the trie and check which one already passed the unix time difference.
Backstabnoob is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-14-2013 , 11:42   Re: Handle disconected
Reply With Quote #7

Quote:
Originally Posted by Backstabnoob View Post
You can easily do something like this:

Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #define PLUGIN "New Plugin" #define VERSION "1.0" #define AUTHOR "Author" new Trie: g_tPlayersLastConnection public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         g_tPlayersLastConnection = TrieCreate( ) } public client_disconnect( id ) {     new szAuthid[ 34 ]     get_user_authid( id, szAuthid, charsmax( szAuthid ) )         TrieSetCell( g_tPlayersLastConnection, szAuthid, get_systime( ) ) } public client_putinserver( id ) {     new szAuthid[ 34 ]     get_user_authid( id, szAuthid, charsmax( szAuthid ) )         if( !TrieKeyExists( g_tPlayersLastConnection, szAuthid ) )         return                     new iTime     TrieGetCell( g_tPlayersLastConnection, szAuthid, iTime )         if( get_systime( ) - iTime <= 300 )     {         // player has reconnected within 5 minutes     } }
TrieGetCell returns the same value as TrieKeyExists, you don't need to call TrieKeyExists first.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 09-14-2013 , 11:51   Re: Handle disconected
Reply With Quote #8

Good to know, thanks. Thought it was a bit faster call.
Backstabnoob is offline
quark
Veteran Member
Join Date: Oct 2011
Location: Your mind.
Old 09-25-2013 , 15:50   Re: Handle disconected
Reply With Quote #9

Quote:
Originally Posted by ConnorMcLeod View Post
TrieGetCell returns the same value as TrieKeyExists, you don't need to call TrieKeyExists first.
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plugin"
#define VERSION "1.0"
#define AUTHOR "Author"

new Trieg_tPlayersLastConnection

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
g_tPlayersLastConnection TrieCreate( )
}


public 
client_disconnectid )
{
    new 
szAuthid34 ]
    
get_user_authididszAuthidcharsmaxszAuthid ) )
    
    
TrieSetCellg_tPlayersLastConnectionszAuthidget_systime( ) )
}

public 
client_putinserverid )
{
    new 
szAuthid34 ]
    
get_user_authididszAuthidcharsmaxszAuthid ) )        
        
    new 
iTime
    TrieGetCell
g_tPlayersLastConnectionszAuthidiTime )
    
    if( 
get_systime( ) - iTime <= 300 )
    {
        
// player has reconnected within 5 minutes
    
}

So , this should work like this?
__________________

Check out My Plugins:
qServerInfo ; ASKTAG
quark is offline
DWIGHTpN
Senior Member
Join Date: Jan 2013
Location: Romania.
Old 09-25-2013 , 16:32   Re: Handle disconected
Reply With Quote #10

TrieGetCell() return true if key exist, and false if not..
So use it as a condition.
Code:
#include <amxmodx> 
#include <amxmisc> 

#define PLUGIN "New Plugin" 
#define VERSION "1.0" 
#define AUTHOR "Author" 

new Trie: g_tPlayersLastConnection 

public plugin_init() { 
    register_plugin(PLUGIN, VERSION, AUTHOR) 
     
    g_tPlayersLastConnection = TrieCreate( ) 
} 


public client_disconnect( id ) 
{ 
    new szAuthid[ 34 ] 
    get_user_authid( id, szAuthid, charsmax( szAuthid ) ) 
     
    TrieSetCell( g_tPlayersLastConnection, szAuthid, get_systime( ) ) 
} 

public client_putinserver( id ) 
{ 
    new szAuthid[ 34 ] 
    get_user_authid( id, szAuthid, charsmax( szAuthid ) )         
         
    new iTime 
    if( !TrieGetCell( g_tPlayersLastConnection, szAuthid, iTime ) ) // if key not exist, exit...
         return PLUGIN_CONTINUE;
     
    if( get_systime( ) - iTime <= 300 ) 
    { 
        // player has reconnected within 5 minutes 
    } 
} 

Last edited by DWIGHTpN; 09-25-2013 at 16:35.
DWIGHTpN 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 19:10.


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