AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Write admin activity in log (https://forums.alliedmods.net/showthread.php?t=127751)

Dimanok 05-24-2010 12:39

Write admin activity in log
 
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.

Dimanok 05-25-2010 03:11

Re: Write admin activity in log
 
up (

mysticssjgoku4 05-25-2010 03:42

Re: Write admin activity in log
 
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; }

Dimanok 05-25-2010 08:41

Re: Write admin activity in log
 
Big thanks! It works !


All times are GMT -4. The time now is 05:23.

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