Raised This Month: $32 Target: $400
 8% 

Write admin activity in log


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dimanok
Junior Member
Join Date: Jan 2010
Old 05-24-2010 , 12:39   Write admin activity in log
Reply With Quote #1

Hello all.
Help me please.
I have this code:
PHP Code:
#include <amxmodx>
#define PLUGIN ""
#define VERSION "0.0"
#define AUTHOR "Dimanok"



public plugin_init() {
   
register_plugin(PLUGINVERSIONAUTHOR)
}

public 
client_putinserver(id)
{

new 
CurrentTime[9]
get_time("%H:%M:%S",CurrentTime,8

    static 
s_Name[32], s_Text[128], i_Flags
   
    get_user_name
(ids_Namecharsmax(s_Name))
    
i_Flags get_user_flags(id)


       if (
i_Flags ADMIN_LEVEL_H)
    else
     public  
client_disconnect id ) {
        
log_to_file ("admin_activity.log",CurrentTime)    
     return 
PLUGIN_HANDLED
    

It is necessary that if the admin has the flag "t" of his visit when he came and when he came in log file as follows: Nick xx.xx.xx - xx.xx.xx
Help me please.

Last edited by Dimanok; 05-25-2010 at 03:22.
Dimanok is offline
Dimanok
Junior Member
Join Date: Jan 2010
Old 05-25-2010 , 03:11   Re: Write admin activity in log
Reply With Quote #2

up (
Dimanok is offline
mysticssjgoku4
Veteran Member
Join Date: Jan 2005
Location: Chicago Heights, IL
Old 05-25-2010 , 03:42   Re: Write admin activity in log
Reply With Quote #3

Not sure exactly you want for xx.xx.xx - xx.xx.xx, is that the start and end time?
Try this...let me know if it works, untested.

Code:
#include <amxmodx> #define PLUGIN "Admin T Logger" #define VERSION "1.0" #define AUTHOR "Dimanok" new g_szTimeIN[32][9]; new g_szTimeOut[32][9]; public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR); } public client_disconnect(id) {        log_event(id);     //Reset the time in & out.     g_szTimeOut[id][0] = 0;     g_szTimeIN[id][0] = 0;     return PLUGIN_HANDLED    } public client_putinserver(id) {     //(Get the current time)     get_time("%H:%M:%S",g_szTimeIN[id],8);     return PLUGIN_HANDLED } public log_event(id) {     //(Create all the new vars)     new szName[32], iFlags, szSteamID[32], szIP[32];         //(Get the users IP)     get_user_ip(id,szIP,sizeof(szIP));         //(Get the users name)     get_user_name(id, szName, charsmax(szName));         //(Get the users steamid)     get_user_authid(id,szSteamID,sizeof(szSteamID));         //(Get the users flags)     iFlags = get_user_flags(id);     //(IF iFlags contain ADMIN_LEVEL_H?)     if( (iFlags & ADMIN_LEVEL_H) )     {         get_time("%H:%M:%S",g_szTimeOut[id],8);                 new szText[128];         //(Format the String) "[Time] [Name] [SteamID] [IP Address]"         format(szText,sizeof(szText),"(%s)-(%s) ---- Name:[%s] SteamID:[%s] IP:[%s]",g_szTimeIN[id],g_szTimeOut[id],szName,szSteamID,szIP);                 //Write it to the log         log_to_file ("admin_activity.log",szText);     }     return PLUGIN_HANDLED; }
__________________

mysticssjgoku4 is offline
Send a message via AIM to mysticssjgoku4 Send a message via MSN to mysticssjgoku4
Dimanok
Junior Member
Join Date: Jan 2010
Old 05-25-2010 , 08:41   Re: Write admin activity in log
Reply With Quote #4

Big thanks! It works !
Dimanok is offline
Reply


Thread Tools
Display Modes

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 01:43.


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