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

Logging admins playtime


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
blackcat
Junior Member
Join Date: Oct 2005
Old 12-30-2005 , 14:36   Logging admins playtime
Reply With Quote #1

I would like a plugin that logs admins playtime on a server, and only admins. Don't want it stored in sql, but in a regular txt-file.

This to be able to check how active the admins are on our servers.

Any ideas?
blackcat is offline
Lord_Destros
Veteran Member
Join Date: Jul 2004
Location: With stupid.
Old 12-30-2005 , 16:24  
Reply With Quote #2

lol, cool idea. Could be better if there was a command for evreyone to view where someone can type /activeadmins in the chat and get an MOTD window (or message in the console) saying the top x number of admins in the server along y most unactive members in server along with maybe the last time they joined the server?

This is useful for seeing who you can consider "active" as well as possibly rewarding more active members.

Cvars could be
amx_displayactive 5 (shows 5 most active members, reffered to as x)
amx_displayunactive 2 (displayes 2 most unactive members, reffered to as y)

This is really useful for peeps who need to check how active their members are without wanting to look through logs (which takes years)
__________________
Quote:
Originally Posted by Twilight Suzuka
Don't worry m'lord. The turtles day will come.
Lord_Destros is offline
Send a message via AIM to Lord_Destros
blackcat
Junior Member
Join Date: Oct 2005
Old 12-31-2005 , 06:19  
Reply With Quote #3

Okay, so I made a sample script, just the basic logging of time spent on server, but everytime an admin disconnects my server segfaults and restarts. Any ideas?

Code:
 // AMX Mod X Script
 //
 // playtime
 //
 // Author Stein_R
 // [email protected]
 //

 #include <amxmodx>
 #include <amxmisc>
 #include <nvault>

 #define VAULTNAME "playtime"

 new gVaultHandle

 public plugin_init(){
        register_plugin("PlayTime","1.0","Stein")
                     }


public client_disconnect(id){
    if (!(get_user_flags(id)&ADMIN_KICK))       {
        return PLUGIN_HANDLED
                                                }
        new authid[32]
        new playtime = get_user_time(id)
        get_user_authid(id,authid,31)
        gVaultHandle = nvault_open(VAULTNAME)
        if (gVaultHandle == INVALID_HANDLE) {
                log_amx("Error opening nVault file: %s",VAULTNAME)
                                            }
        new tmp_vault_time, vault_time[21], TimeStamp
        nvault_lookup(gVaultHandle, authid, vault_time, 20, TimeStamp)
        tmp_vault_time = str_to_num(vault_time)
        tmp_vault_time += playtime
        num_to_str(tmp_vault_time,vault_time,20)
        nvault_set(gVaultHandle, authid, vault_time)
        nvault_close(gVaultHandle)
        return PLUGIN_CONTINUE
 }
blackcat is offline
McD
Junior Member
Join Date: Apr 2004
Old 12-31-2005 , 07:00  
Reply With Quote #4

There is a plugin for that in for amx.

http://djeyl.net/forum/index.php?showtopic=38408&hl=
__________________
McD - Burgers for the people!
McD is offline
Sir Apocalypse
Member
Join Date: Jul 2005
Location: Finland
Old 12-31-2005 , 07:53  
Reply With Quote #5

^^
But this is AMXX
__________________
[img]http://img56.**************/img56/864/sirapocalypse1yh.gif[/img]
Sir Apocalypse is offline
Send a message via MSN to Sir Apocalypse
McD
Junior Member
Join Date: Apr 2004
Old 12-31-2005 , 09:49  
Reply With Quote #6

Yes I know but that plugin is easy to convert to amxx
__________________
McD - Burgers for the people!
McD is offline
uTg | bigpapajiggs
Senior Member
Join Date: Sep 2005
Location: Bellingham, WA
Old 12-31-2005 , 18:37  
Reply With Quote #7

Might work, might not.

Code:
#include <amxmodx> public client_disconnect(id) {     if( get_user_flags(id) & read_flags("abcdefghijklmnopqrstu") )     {         new playingtime, playingtimeStr[32]         new steamid[33]         get_user_authid(id, steamid, 32)         while(replace(steamid, 31, ":", "_")) {}         new logfile[64]         format(logfile,63,"addons/amxmodx/config/playingtime/%s.txt",steamid)         new text[32]         new len         new pos=0         if (file_exists(logfile))         {             while(read_file(logfile,pos++,text,31,len))             {                 playingtime = str_to_num(text)              }         }         playingtime += get_user_time(id, 1)         num_to_str(playingtime, playingtimeStr, 31)         write_file(logfile, playingtimeStr, 0)     } } public plugin_init() {     register_plugin("Admin Playing Time", "0.1", "KRoTaL") }

.amxx is attached.
Attached Files
File Type: amx admin_playingtime.amx (2.2 KB, 98 views)
__________________
What's my confidence level? I do crossword puzzles with a pen.
uTg | bigpapajiggs is offline
Send a message via AIM to uTg | bigpapajiggs Send a message via MSN to uTg | bigpapajiggs Send a message via Yahoo to uTg | bigpapajiggs
Lord_Destros
Veteran Member
Join Date: Jul 2004
Location: With stupid.
Old 01-02-2006 , 18:26  
Reply With Quote #8

doesn't work
__________________
Quote:
Originally Posted by Twilight Suzuka
Don't worry m'lord. The turtles day will come.
Lord_Destros is offline
Send a message via AIM to Lord_Destros
blackcat
Junior Member
Join Date: Oct 2005
Old 01-05-2006 , 04:59  
Reply With Quote #9

Made a new beta that uses Nvault (code partially stolen here and there ).
But this one segfaults the server when an admin disconnects. No usable debug info though Any ideas?

Edit: Ahh.. problem with the nvault close... ;)

Code:
#include <amxmodx> #include <amxmisc> #include <nvault> #define VAULTNAME "adminplaytime" new gConnectTime[33], gVaultHandle, authid[32], vault_time[21] public plugin_init(){         register_plugin("AdminPlaytime","1.0","Stein_R") } public client_authorized(id){         get_user_authid(id,authid,31)         if ((get_user_flags(id) & ADMIN_RESERVATION)) {                 gVaultHandle = nvault_open(VAULTNAME)                 if (gVaultHandle == INVALID_HANDLE) {                         log_amx("Error opening nVault file: %s",VAULTNAME)                 }                 //Getting Vault Data                 new TimeStamp                 nvault_lookup(gVaultHandle, authid, vault_time, 20, TimeStamp)                 gConnectTime[id] = str_to_num(vault_time)                 nvault_close(gVaultHandle)         }         return PLUGIN_CONTINUE } public client_disconnect(id){         new playtime = get_user_time(id)         get_user_authid(id,authid,31)         if ((get_user_flags(id) & ADMIN_RESERVATION)) {                 gVaultHandle = nvault_open(VAULTNAME)                 if (gVaultHandle == INVALID_HANDLE) {                         log_amx("Error opening nVault file: %s",VAULTNAME)                 }                 new tmp_vault_time, TimeStamp                 nvault_lookup(gVaultHandle, authid, vault_time, 20, TimeStamp)                 tmp_vault_time = str_to_num(vault_time)                 tmp_vault_time += playtime                 num_to_str(tmp_vault_time,vault_time,20)                 nvault_set(gVaultHandle, authid, vault_time)                 nvault_close(gVaultHandle)         }         return PLUGIN_CONTINUE }
blackcat is offline
blackcat
Junior Member
Join Date: Oct 2005
Old 01-05-2006 , 05:41  
Reply With Quote #10

Okey. So this is what it comes down to ;) just made a script that uses regular vault and actually works writes to the default vault.ini of the server

Code:
#include <amxmodx> #include <amxmisc> #include <vault> new connecttime[33], vault_time[21], authid[32] public plugin_init(){         register_plugin("Admin Playtime Vault","1.0","Stein_R") } public client_authorized(id){         get_user_authid(id,authid,31)         if ((get_user_flags(id) & ADMIN_RESERVATION)) {                         if(vaultdata_exists(authid)){                         get_vaultdata(authid,vault_time,20)                         connecttime[id] = str_to_num(vault_time)                         }else{//No data exists                                 connecttime[id] = 0                         }         }         return PLUGIN_CONTINUE } public client_disconnect (id){  //Update players time in the database         get_user_authid(id,authid,31)         if ((get_user_flags(id) & ADMIN_RESERVATION)) {                 new playtime = get_user_time (id)                 if(vaultdata_exists(authid)){                         new tmp_vault_time,vault_time[21]                         get_vaultdata(authid,vault_time,20)                         tmp_vault_time = str_to_num(vault_time)                         tmp_vault_time += playtime                         num_to_str(tmp_vault_time,vault_time,20)                         set_vaultdata(authid,vault_time)                 }else{//create a record for them                         num_to_str(playtime,vault_time,20)                         set_vaultdata(authid,vault_time)                 }         }         return PLUGIN_CONTINUE }
blackcat 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 08:16.


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