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

Solved Admins Playtime


Post New Thread Reply   
 
Thread Tools Display Modes
JocAnis
Veteran Member
Join Date: Jun 2010
Old 06-05-2019 , 18:20   Re: Admins Playtime
Reply With Quote #11

@Bugsy is client_disconnected also making problems with saving info with nVault? i have seen it has with <sqlx> no matter if sqlite or mysql...very annoying
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)
JocAnis is offline
farhanhyper
Member
Join Date: Dec 2017
Location: Finland
Old 06-06-2019 , 07:10   Re: Admins Playtime
Reply With Quote #12

Quote:
Originally Posted by Bugsy View Post
Try now, I don't think 1.8.2 or 1.8.3 like client_disconnected()

Also, did you read this in the nVault Utility & Array pages? Make sure you use this module.
Bugsy it works very well and it is exactly what I wanted.I really appreciate you

Thank you for noticing me about version of my engine,it was old ;)
__________________
Never Say Never
farhanhyper is offline
MR.pink
New Member
Join Date: Aug 2019
Old 08-30-2019 , 02:13   Re: Admins Playtime
Reply With Quote #13

Quote:
Originally Posted by Bugsy View Post
Not thoroughly tested.

The plugin will not display the admins current time if they are actively connected. The data displayed with the /at command is saved on disconnect.

You will need nVault Utility and nVault Array.

Cvar apt_adminflags holds the flags the player must have to be considered an admin
PHP Code:

#include <amxmodx>
#include <nvault_array>
#include <nvault_util>

#define MAX_PLAYERS 32

new const Version[] = "0.1";

enum AdminData
{
    
adName32 ],
    
adAuthID34 ],
    
adFlags26 ],
    
bool:adIsAdmin,
    
adConnectTime,
    
adPlayTime,
    
adConnections
}

new 
g_adDataMAX_PLAYERS ][ AdminData ];
new 
g_Vault;
new 
pcvarAdminFlags;

public 
plugin_init() 
{
    
register_plugin"Admin Play Time" Version "bugsy" );
    
    
register_clcmd"say /at" "AdminTime" );
    
register_clcmd"say_team /at" "AdminTime" );
    
    
pcvarAdminFlags register_cvar"apt_adminflags" "cde" );
    
    
g_Vault nvault_open"apt_data" );
}

public 
plugin_end() 
{
    
nvault_closeg_Vault );
}

public 
client_authorizedid )
{
    new 
szFlags26 ] , iPlayerFlags iRequiredFlags;
    
get_pcvar_stringpcvarAdminFlags szFlags charsmaxszFlags ) );
    
    
iPlayerFlags get_user_flagsid );
    
iRequiredFlags read_flagsszFlags );
    
    if ( ( 
g_adDataid ][ adIsAdmin ] = bool:!!( ( iPlayerFlags iRequiredFlags ) == iRequiredFlags ) ) )
    {
        
get_user_authidid g_adDataid ][ adAuthID ] , charsmaxg_adData[][ adAuthID ] ) );
        
nvault_get_arrayg_Vault g_adDataid ][ adAuthID ] , g_adDataid ][ AdminData:] , sizeofg_adData[] ) );
        
        
get_flagsiPlayerFlags g_adDataid ][ adFlags ] , charsmaxg_adData[][ adFlags ] ) );
        
get_user_nameid g_adDataid ][ adName ] , sizeofg_adData[][ adName ] ) );
        
g_adDataid ][ adConnections ]++;
        
g_adDataid ][ adConnectTime ] = get_systime();
    }
}

public 
client_disconnectid )
{
    if ( 
g_adDataid ][ adIsAdmin ] )
    {
        
g_adDataid ][ adPlayTime ] += ( get_systime() - g_adDataid ][ adConnectTime ] );
        
nvault_set_arrayg_Vault g_adDataid ][ adAuthID ] , g_adDataid ][ AdminData:] , sizeofg_adData[] ) );
    }
}

public 
AdminTimeid )
{
    new 
szHUD1024 ] , iHUDPos;
    new 
iVault iCount iPos szKey] , adDataAdminData ] , iTS;
    
    
nvault_closeg_Vault );
    
g_Vault nvault_open"apt_data" );
    
iVault nvault_util_open"apt_data" );
    
    
iCount nvault_util_countiVault );
    
    if ( 
iCount )
    {
        for ( new 
iCount i++ )
        {
            
iPos nvault_util_read_arrayiVault iPos szKey adDataAdminData:] , sizeofadData ) , iTS );
            
iHUDPos += formatexszHUDiHUDPos ] , charsmaxszHUD ) - iHUDPos "^n%d. %s, %s, %d connections, %d minutes" i+adDataadName ] , adDataadFlags ] , adDataadConnections ] , adDataadPlayTime ] / 60 );
        }
    }
    else
    {
        
copyszHUD charsmaxszHUD ) , "No data to display" );
    }
    
    
set_hudmessage255 255 255 0.05 0.30 0.07.0 );
    
show_hudmessageid szHUD );
    
    return 
PLUGIN_HANDLED;


hi
i want to copy admins online time data !!

and show last time to admins online

and just Flag "A" admins can see menu

and plugin have title

can u edit for me pls?
MR.pink 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 10:52.


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