AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   The proper event to print information to client (https://forums.alliedmods.net/showthread.php?t=318157)

edon1337 08-17-2019 09:52

The proper event to print information to client
 
Hi, I've been searching a lot, and testing, but still had no positive results, what's the most reliable event to print information to client when he connects? I tried client_authorized, client_authorized with 0.3s delay, client_putinserver, client_putinserver with 3.0s delay, nothing works.
Thanks.

OciXCrom 08-17-2019 09:59

Re: The proper event to print information to client
 
Quote:

Originally Posted by LearninG (Post 2663575)
client_connect , maybe ?

Not even close. How is he supposed to see the message while he is connecting?

thEsp 08-17-2019 10:04

Re: The proper event to print information to client
 
Quote:

Originally Posted by LearninG (Post 2663575)
client_connect , maybe ?

Research, maybe?
https://forums.alliedmods.net/showpo...12&postcount=2

JocAnis 08-17-2019 10:24

Re: The proper event to print information to client
 
So what is called when player is connecting, but downloading some resources? I also had problems to understand what is called when exactly..but almost every time putiserver + 3-4sec seems okay

edon1337 08-17-2019 10:25

Re: The proper event to print information to client
 
Quote:

Originally Posted by LearninG (Post 2663575)
client_connect , maybe ?

That's the worst event to do things aside from changing var/bool values. In client_connect player hasn't even gotten a SteamID.

Natsheh 08-17-2019 10:27

Re: The proper event to print information to client
 
1st attach your code
2th what are you trying to print which way?

I believe the best event is putinserver or hook player choose team command

edon1337 08-17-2019 10:38

Re: The proper event to print information to client
 
Quote:

Originally Posted by Natsheh (Post 2663583)
1st attach your code
2th what are you trying to print which way?

I believe the best event is putinserver or hook player choose team command

1. What code? Hooking putinserver and printing "Hello"?
2. Anything, the way it's supposed to print?

Putinserver doesn't work, setting a 3.0s delay doesn't work either.

LearninG 08-17-2019 10:43

Re: The proper event to print information to client
 
Quote:

Originally Posted by OciXCrom (Post 2663577)
Not even close. How is he supposed to see the message while he is connecting?

I thought it was possible with set_task... my mistake.

Natsheh 08-17-2019 11:59

Re: The proper event to print information to client
 
Quote:

Originally Posted by edon1337 (Post 2663587)
1. What code? Hooking putinserver and printing "Hello"?
2. Anything, the way it's supposed to print?

Putinserver doesn't work, setting a 3.0s delay doesn't work either.

1. Always show what have you tried no matter how silly the code is.
2. Printing differs from one way to other for example printing in user chat or console or even server console.


Not sure what you mean with it not working that's why you always have to show the code.

edon1337 08-17-2019 14:00

Re: The proper event to print information to client
 
Quote:

Originally Posted by Natsheh (Post 2663597)
1. Always show what have you tried no matter how silly the code is.
2. Printing differs from one way to other for example printing in user chat or console or even server console.


Not sure what you mean with it not working that's why you always have to show the code.

There, full code can be found here. Player gets kicked but the prints do go off.
PHP Code:

public client_authorizedid )
{
    
set_task0.3"client_authorized_delayed"id TASK_AUTHORIZED );
}

public 
client_authorized_delayedid )
{
    
id -= TASK_AUTHORIZED;

    
CheckBannedid );
}

public 
CheckBannedid )
{
    if( 
get_user_flagsid ) & g_iConfigIMMUNITY_FLAG ] )
    {
        return 
PLUGIN_HANDLED;
    }

    else
    {
        new 
eDataPlayerBan ], szSteamIdMAX_AUTHID_LENGTH ], szNameMAX_NAME_LENGTH ], szIPMAX_IP_LENGTH ];
        
get_user_authididszSteamIdcharsmaxszSteamId ) );
        
get_user_nameidszNamecharsmaxszName ) );
        
get_user_ipidszIPcharsmaxszIP ), );

        for( new 
iArraySizeg_aBans ); i++ )
        {
            
ArrayGetArrayg_aBansieData );
            
            if( 
equaliszSteamIdeDataPlayer_SteamId ] ) || equaliszNameeDataPlayer_Name ] ) || equaliszIPeDataPlayer_IP ] ) )
            {
                if( ! 
HasDatePassedeDataPlayer_BanExpire ] ) || equalieDataPlayer_BanExpire ], "never" ) )
                {
                    if( 
equalieDataPlayer_BanExpire ], "never" ) )
                    {                
                        
                        
send_messageidCONSOLEfalse"************************************************" );
                        
send_messageidCONSOLEfalse"%L"id"BAN_INFO_BANNED" );
                        
send_messageidCONSOLEfalse"%L"id"BAN_INFO_EXPIRE_NEVER" );
                        
send_messageidCONSOLEfalse"%L"id"BAN_INFO_REASON"eDataPlayer_BanReason ] );
                        
send_messageidCONSOLEfalse"%L"id"BAN_INFO_BY"eDataPlayer_BannedBy ] );
                        
send_messageidCONSOLEfalse"************************************************" );
                    }
                    
                    else
                    {
                        
send_messageidCONSOLEfalse"************************************************" );
                        
send_messageidCONSOLEfalse"%L"id"BAN_INFO_BANNED" );
                        
send_messageidCONSOLEfalse"%L"id"BAN_INFO_EXPIRE"eDataPlayer_BanExpire ] );
                        
send_messageidCONSOLEfalse"%L"id"BAN_INFO_REASON"eDataPlayer_BanReason ] );
                        
send_messageidCONSOLEfalse"%L"id"BAN_INFO_BY"eDataPlayer_BannedBy ] );
                        
send_messageidCONSOLEfalse"************************************************" );
                    }
                    
server_cmd"kick #%d %L"get_user_useridid ), id"CHECK_CONSOLE_INFO" );
                    break;
                }
            }
        }
    }
    return 
PLUGIN_CONTINUE;




All times are GMT -4. The time now is 05:37.

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