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

[CS:S] player_connect & dontBroadcast


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ici
Member
Join Date: Jan 2014
Old 10-26-2015 , 15:39   [CS:S] player_connect & dontBroadcast
Reply With Quote #1

The following code used to work before the recent CS:S update.
It suppressed the message "Player <name> has joined the game" but it doesn't work anymore.
Any ideas on how to fix this?

PHP Code:
HookEvent("player_connect"Event_PlayerConnectEventHookMode_Pre);

public 
Action:Event_PlayerConnect(Handle:event, const String:name[], bool:dontBroadcast)
{
    if (!
dontBroadcast) {
        
decl String:clientName[64], String:networkID[25], String:address[32];
        
GetEventString(event"name"clientNamesizeof(clientName));
        
GetEventString(event"networkid"networkIDsizeof(networkID));
        
GetEventString(event"address"addresssizeof(address));
        
        for (new 
1<= MaxClientsi++) {
            if (!
IsClientInGame(i) || IsFakeClient(i)) continue;
            
PrintToConsole(i"[Connect] %s %s"clientNamenetworkID);
        }
        
        new 
Handle:newEvent CreateEvent("player_connect"true);
        
SetEventString(newEvent"name"clientName);
        
SetEventInt(newEvent"index"GetEventInt(event"index"));
        
SetEventInt(newEvent"userid"GetEventInt(event"userid"));
        
SetEventString(newEvent"networkid"networkID);
        
SetEventString(newEvent"address"address);
        
        
FireEvent(newEventtrue);
        return 
Plugin_Handled;
    }
    return 
Plugin_Continue;


Last edited by ici; 10-26-2015 at 15:47.
ici is offline
psychonic

BAFFLED
Join Date: May 2008
Old 10-26-2015 , 17:12   Re: [CS:S] player_connect & dontBroadcast
Reply With Quote #2

The player_connect event is now serverside-only. There is a new player_connect_client event.
psychonic is offline
ici
Member
Join Date: Jan 2014
Old 10-26-2015 , 18:27   Re: [CS:S] player_connect & dontBroadcast
Reply With Quote #3

Thanks psychonic.
ici 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 21:49.


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