AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   [L4D2] OnClientConnected send a message to a specific player (not who is joining) (https://forums.alliedmods.net/showthread.php?t=316359)

Spinning Turte 05-19-2019 08:38

[L4D2] OnClientConnected send a message to a specific player (not who is joining)
 
I was trying to send me a message for every time a player (not bot obv) join the game, this code is "OnClientConnected(client)" but I don't know how to send this message only to me and if I'm in-game

PHP Code:

public OnClientConnected(client)
{
    if (!
IsFakeClient(client) && !IsClientInGame(client/*&& if I'm in-game*/)
        {
            
PrintToChat(/*I want to put here only my name, so I'll receive it only if I'm ingame*/,pMessages[10],256);
        }        
    }



Silvers 05-19-2019 09:15

Re: [L4D2] OnClientConnected send a message to a specific player (not who is joining)
 
PHP Code:

public void OnClientConnected(int client)
{
    if( !
IsFakeClient(client) )
    {
        
char sTemp[64];
        for( 
int i 1<= MaxClientsi++ )
        {
            if( 
IsClientInGame(i) && IsClientAuthorized(i) )
            {
                
GetClientAuthId(iAuthId_SteamID64sTempsizeof(sTemp));
                if( 
strcmp(sTemp"7656119XXXXXXXXXX") == // Replace with your SteamID64
                
{
                    
PrintToChat(i"%N connected."client);
                    return;
                }
            }
        }        
    }



Spinning Turte 05-19-2019 09:57

Re: [L4D2] OnClientConnected send a message to a specific player (not who is joining)
 
Quote:

Originally Posted by Silvers (Post 2652283)
PHP Code:

public void OnClientConnected(int client)
{
    if( !
IsFakeClient(client) )
    {
        
char sTemp[64];
        for( 
int i 1<= MaxClientsi++ )
        {
            if( 
IsClientInGame(i) && IsClientAuthorized(i) )
            {
                
GetClientAuthId(iAuthId_SteamID64sTempsizeof(sTemp));
                if( 
strcmp(sTemp"7656119XXXXXXXXXX") == // Replace with your SteamID64
                
{
                    
PrintToChat(i"%N connected."client);
                    return;
                }
            }
        }        
    }



It works! Thanks


All times are GMT -4. The time now is 00:09.

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