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

Solved Remember disconnected player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
tepegoz
Senior Member
Join Date: Apr 2019
Old 12-18-2019 , 09:12   Remember disconnected player
Reply With Quote #1

I want to plugin remember to disconnect and quitting the game(closing the game) player for only current map(next map reset all data). When player reconnect server , server say " You reconnected".
Note: The player is closing game and open again and connecting to server.

Last edited by tepegoz; 12-19-2019 at 15:01.
tepegoz is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 12-18-2019 , 10:02   Re: Remember disconnected player
Reply With Quote #2

hahah, let's go:

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

new Trie:g_tReconnect;

public 
plugin_init()
{
    
register_plugin("Player Reconnect Reason","0.1","SmileY");

    
register_clcmd("joinclass","HOOK_JoinedClass");
    
register_clcmd("menuselect","HOOK_JoinedClass");

    
g_tReconnect TrieCreate();
}

public 
plugin_end()
{
    
TrieDestroy(g_tReconnect);
}

public 
client_disconnected(id,bool:bDrop,szReason[],iLen)
{
    if(
bDrop)
    {
        new 
szAuth[35]
        
get_user_authid(id,szAuth,charsmax(szAuth));

        
TrieSetString(g_tReconnect,szAuth,szReason,true);
    }
}

public 
HOOK_JoinedClass(id)
{
    new 
szAuth[35]
    
get_user_authid(id,szAuth,charsmax(szAuth));

    new 
szReason[32];

    if(
TrieGetString(g_tReconnect,szAuth,szReason,charsmax(szReason)))
    {
           if(
get_ent_data(id,"CBasePlayer","m_iMenu") == CS_Menu_ChooseAppearance && get_ent_data(id,"CBasePlayer","m_iJoiningState") == CS_STATE_PICKING_TEAM)
        {
            new 
szName[32];
            
get_user_name(id,szName,charsmax(szName));

            
client_print_color(0,id,"[^3%s^1 Reconnected] Last drop reason: ^3%s",szName,szReason);
        }
    }

Ps. Not tested
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
tepegoz
Senior Member
Join Date: Apr 2019
Old 12-18-2019 , 15:39   Re: Remember disconnected player
Reply With Quote #3

Quote:
Originally Posted by ^SmileY View Post
hahah, let's go:

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

new Trie:g_tReconnect;

public 
plugin_init()
{
    
register_plugin("Player Reconnect Reason","0.1","SmileY");

    
register_clcmd("joinclass","HOOK_JoinedClass");
    
register_clcmd("menuselect","HOOK_JoinedClass");

    
g_tReconnect TrieCreate();
}

public 
plugin_end()
{
    
TrieDestroy(g_tReconnect);
}

public 
client_disconnected(id,bool:bDrop,szReason[],iLen)
{
    if(
bDrop)
    {
        new 
szAuth[35]
        
get_user_authid(id,szAuth,charsmax(szAuth));

        
TrieSetString(g_tReconnect,szAuth,szReason,true);
    }
}

public 
HOOK_JoinedClass(id)
{
    new 
szAuth[35]
    
get_user_authid(id,szAuth,charsmax(szAuth));

    new 
szReason[32];

    if(
TrieGetString(g_tReconnect,szAuth,szReason,charsmax(szReason)))
    {
           if(
get_ent_data(id,"CBasePlayer","m_iMenu") == CS_Menu_ChooseAppearance && get_ent_data(id,"CBasePlayer","m_iJoiningState") == CS_STATE_PICKING_TEAM)
        {
            new 
szName[32];
            
get_user_name(id,szName,charsmax(szName));

            
client_print_color(0,id,"[^3%s^1 Reconnected] Last drop reason: ^3%s",szName,szReason);
        }
    }

Ps. Not tested
ac.sma(2 : error 088: number of arguments does not match definition
ac.sma(41) : error 017: undefined symbol "get_ent_data"

and I don't want reason. Only server say "You reconnected"
tepegoz is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 12-18-2019 , 15:46   Re: Remember disconnected player
Reply With Quote #4

Quote:
Originally Posted by tepegoz View Post
ac.sma(2 : error 088: number of arguments does not match definition
ac.sma(41) : error 017: undefined symbol "get_ent_data"

and I don't want reason. Only server say "You reconnected"
Compile locally.

PHP Code:
AMX Mod X Compiler 1.10.0.5257
Copyright 
(c1997-2006 ITB CompuPhase
Copyright 
(c2004-2013 AMX Mod X Team

Header size
:            504 bytes
Code size
:             1076 bytes
Data size
:             1000 bytes
Stack
/heap size:      16384 bytes
Total requirements
:   18964 bytes
Done
.
[
Finished in 0.3s
__________________


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
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 12-18-2019 , 16:00   Re: Remember disconnected player
Reply With Quote #5

What amxx version is being used in server? I can fix for it
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 

Last edited by ^SmileY; 12-18-2019 at 16:01.
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
tepegoz
Senior Member
Join Date: Apr 2019
Old 12-18-2019 , 16:20   Re: Remember disconnected player
Reply With Quote #6

1.8.2 and I don't want reason in plugin thanks
tepegoz is offline
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 12-19-2019 , 05:47   Re: Remember disconnected player
Reply With Quote #7

Then remove it yourself.
redivcram is offline
tepegoz
Senior Member
Join Date: Apr 2019
Old 12-19-2019 , 07:22   Re: Remember disconnected player
Reply With Quote #8

I am noob I can't remove and I don't know how to convert plugin to 1.8.2.
tepegoz is offline
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 12-19-2019 , 07:55   Re: Remember disconnected player
Reply With Quote #9

You can use BACKSPACE to delete the reason, at least.
redivcram is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 12-19-2019 , 08:48   Re: Remember disconnected player
Reply With Quote #10

PHP Code:
#include <amxmodx>

new Trie:g_tReconnect;

public 
plugin_init()
{
    
register_plugin("Player Reconnect Reason","0.2","SmileY");

    
g_tReconnect TrieCreate();
}

public 
plugin_end()
{
    
TrieDestroy(g_tReconnect);
}

public 
client_disconnect(id)
{
        new 
szAuth[35]
        
get_user_authid(id,szAuth,charsmax(szAuth));

        
TrieSetCell(g_tReconnect,szAuth,get_systime());
}

public 
client_putinserver(id)
{
    new 
szAuth[35]
    
get_user_authid(id,szAuth,charsmax(szAuth));

    if(
TrieKeyExists(g_tReconnect,szAuth))
    {
        
set_task(5.0,"SHOW_Message",id);
    }
}

public 
SHOW_Message(id)
{
    if(
is_user_connected(id))
    {
        new 
szName[32];
        
get_user_name(id,szName,charsmax(szName));

        
client_print(0,print_chat,"[RETRY BOT] %s Reconnected to server!",szName);
    }

Compiling in amxx 1.8.1 or 1.8.2, but not tested!
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 

Last edited by ^SmileY; 12-19-2019 at 08:48.
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
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:14.


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