Raised This Month: $ Target: $400
 0% 

all players connections count


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sky_pg
Member
Join Date: Apr 2012
Old 10-16-2013 , 05:06   all players connections count
Reply With Quote #1

count for all players connections to server for 24h ...save to logfile, next day next logfile
(or log on mapchange)

maybe a hud counter in right uper corner...

anybody can do this?

i try search but nothing can find here like this...

Last edited by sky_pg; 10-16-2013 at 05:07.
sky_pg is offline
Shooting King
RAAASENGAN
Join Date: Mar 2012
Location: India
Old 10-17-2013 , 07:49   Re: all players connections count
Reply With Quote #2

Players Connect
PHP Code:
#include <amxmodx>
#include <engine>

#define PLUGIN        "Player Counter"
#define VERSION        "1.0"
#define AUTHOR        "Shooting King"

#define LOGPERDAY        
//#define LOGPERMAP    

new const gszClassName[] = "sk_connections";
new const 
gszFileName[] = "Connections.dat";
new 
g_SyncScoreInfog_iConnections;
new 
gszBaseDir[64];
new 
gszDatFile[64];

public 
plugin_init()
{
    
register_pluginPLUGINVERSIONAUTHOR );
    
    new 
hFileszData[32];
    
get_localinfo"amxx_basedir"gszBaseDir63);
    
formatexgszDatFilecharsmax(gszDatFile), "%s/data/%s"gszBaseDirgszFileName );
    
    if(
file_exists(gszDatFile))
    {
        
hFile fopengszDatFile"rt" );
        
fgetshFileszDatacharsmax(szData));
        
g_iConnections str_to_num(szData);
        
fclose(hFile);
    }
        
    new 
iEnt create_entity("info_target");
    
entity_set_string(iEntEV_SZ_classnamegszClassName);
    
entity_set_float(iEntEV_FL_nextthinkget_gametime() + 1.0);
    
register_think(gszClassName,"ForwardThink");
    
    
g_SyncScoreInfo CreateHudSyncObj();
}

public 
client_connect(id)
{
    
g_iConnections++;
}

public 
ForwardThink(iEnt)
{
    
set_hudmessage025000.550.0__0.2__, -1);    
    
ShowSyncHudMsg0g_SyncScoreInfo"Total Connections : %d"g_iConnections );
    
entity_set_float(iEntEV_FL_nextthinkget_gametime() + 0.1);
}

public 
plugin_end()
{
    new 
szData[32];
    new 
hFile fopengszDatFile"wt" );
    
num_to_strg_iConnectionsszDatacharsmax(szData));
    
fputshFileszData );
    
fclose(hFile);
    
#if defined LOGPERMAP
    
new szMap[32];
    
szData[0] = '^0';
    
get_mapnameszMapcharsmax(szMap));
    
format_timeszDatacharsmax(szData), "Concs_%d-%m_%H;%M.log" );
    
log_to_fileszData"Connections on %s : %d"szMapg_iConnections);
#endif

#if defined LOGPERDAY
    
new hrsszFile[64];
    
time(hrs);
    
szData[0] = '^0';
    
    if( 
hrs )
    {
        
format_timeszDatacharsmax(szData), "Concs_%d-%m-%Y.log" );
        
formatexszFile63"%s/logs/%s"gszBaseDirszData );
        
        if(!
file_exists(szFile))
        {
            
log_to_fileszData"Connections : %d"g_iConnections);
        }
    }
#endif

Which way do you want for logs ??
PHP Code:
#define LOGPERDAY        
#define LOGPERMAP 
If you want Log-Per-Map then comment "#define LOGPERDAY" line and vice-versa.
Attached Files
File Type: sma Get Plugin or Get Source (player_connections.sma - 615 views - 2.1 KB)
File Type: sma Get Plugin or Get Source (player_connections_rcon.sma - 605 views - 2.2 KB)
__________________
As every time said, don't ever UNDERESTIMATE me.

Donate - Here

Last edited by Shooting King; 10-24-2013 at 04:20.
Shooting King is offline
sky_pg
Member
Join Date: Apr 2012
Old 10-17-2013 , 17:10   Re: all players connections count
Reply With Quote #3

nice king, its working, im testing now...
sky_pg is offline
sky_pg
Member
Join Date: Apr 2012
Old 10-23-2013 , 12:45   Re: all players connections count
Reply With Quote #4

ok..work great ...i trying to add "if(get_user_flags(id) & ADMIN_RCON)" and lett only owners to see the couner but in not working...:/
sky_pg is offline
Shooting King
RAAASENGAN
Join Date: Mar 2012
Location: India
Old 10-24-2013 , 04:20   Re: all players connections count
Reply With Quote #5

Attached A Rcon Only Version.
__________________
As every time said, don't ever UNDERESTIMATE me.

Donate - Here
Shooting King is offline
sky_pg
Member
Join Date: Apr 2012
Old 10-24-2013 , 16:11   Re: all players connections count
Reply With Quote #6

king, nice work! ty
sky_pg 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 17:16.


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