View Single Post
e54385991
AlliedModders Donor
Join Date: Aug 2013
Old 08-18-2018 , 22:24   Re: [CSGO] Player Connect Log Fix
Reply With Quote #110

PHP Code:
public void OnPluginStart()
{
    for(
int i 1<= MaxClientsi++)
    {
        if (
IsClientInGame(i))
            
OnClientPostAdminCheck(i);
    }
}
public 
void OnClientPostAdminCheck(int client)
{
    
/*
    * https://github.com/alliedmodders/hl2sdk/blob/98fe5b5a34b3721fe4d60ec7ba3a28ade3512560/game/server/EventLog.cpp#L63-L75
    * 
    */

    
char sIPPort[25];
    
GetClientIP(client,sIPPort,sizeof(sIPPort),false);

    
Event ConnectLogEvent;
    
ConnectLogEvent CreateEvent("player_connect",true);
    
    
char szClientName[MAX_NAME_LENGTH];
    
GetClientName(client,szClientName,MAX_NAME_LENGTH);
    
    
char szAuthID[25];
    
GetClientAuthId(client,AuthId_Engine,szAuthID,sizeof(szAuthID))
    
    
    
ConnectLogEvent.SetInt("userid",GetClientUserId(client))
    
ConnectLogEvent.SetString("address",sIPPort);
    
ConnectLogEvent.SetString("name",szClientName);
    
ConnectLogEvent.SetString("networkid",szAuthID);

    
ConnectLogEvent.Fire();

Maybe we can use sourcepawn

Last edited by e54385991; 08-18-2018 at 22:26.
e54385991 is offline
Send a message via ICQ to e54385991