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

remove txt file


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Night Wolf90
Member
Join Date: Jan 2016
Old 08-13-2017 , 08:14   remove txt file
Reply With Quote #1

hi
i want edite chat logger plugin With these features:

save log in one file with txt format and remove log every 30 days and Having a cvar To set the time to the minute
plz help plz


PHP Code:
/* Chat Logger v2.1a
   Author: Jim (jim_yang @ AlliedModders Forum)
   Credit: aligind4h0us3 for the idea, suggestion and test.
           Cheap_Suit
           Amx Mod X Team for Adminchat plugin.
   
   Description: It logs messages of say(@|@@|@@@), say_team(@), amx_say, amx_chat, amx_psay, amx_csay, amx_tsay
   Install: put this plugin above adminchat.amxx in amxxdir\configs\plugins.ini
   Cvar: cl_logmode 0  log chat messages to ChatLog.htm in amxxdir\logs\
                    1  log chat messages(by date)to XXXX.XX.XX.htm in amxxdir\logs\
               XXXX.XX.XX is the date.
                       default is 1.
*/

#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#define MAXLEN 511
#define TITLE "<h2 align=center>Chat Logger</h2><hr>"
#define FONT "<font face=^"Verdana^" size=2>"
static FilePath[49]
new 
g_cvarlogmode
new g_adminchatID
new const HUDPOS[4][] = {"""HUDCHAT""HUDCENTER""HUDBOTTOM"}
new const 
TEAMCOLOR[_:CsTeams][] = {"gray""red""blue""gray"}
new const 
TEAMNAME[_:CsTeams][] = {"*DEAD*""(Terrorist) ""(Counter-Terrorist) ""*SPEC*"}

public 
plugin_init()
{
    
register_plugin("Chat Logger""2.1a""Jim")
    
g_cvarlogmode register_cvar("cl_logmode""1")
    
register_clcmd("say""logtext")
    
register_clcmd("say_team""logtext")
    
register_concmd("amx_say""logtext")
    
register_concmd("amx_chat""logtext")
    
register_concmd("amx_psay""logtext")
    
register_concmd("amx_tsay""logtext")
    
register_concmd("amx_csay""logtext")
    
get_localinfo("amxx_logs"FilePath48)
}

public 
plugin_cfg()
{
    
g_adminchatID is_plugin_loaded("Admin Chat")
}

public 
logtext(id)
{
    if(
is_user_bot(id)) return
    
    new 
bool:IsAdminChatRunning false
    
if(g_adminchatID != -1)
    {
        new 
tmp[1], status[2]
        
get_plugin(g_adminchatID,tmp,0,tmp,0,tmp,0,tmp,0,status,1)
        if(
status[0] == 0x72)
            
IsAdminChatRunning true
    
}
        
    static 
datestr[11], LogFile[65]
    new 
timestr[9], authid[32], ip[16], cmd[9], logmsg[MAXLEN 1]
    new 
pos 0ufg get_user_flags(id) & ADMIN_CHAT
    
    get_time
("%Y.%m.%d"datestr10)
    
get_time("%H:%M:%S"timestr8)
    
get_user_authid(idauthid31)
    
get_user_ip(idip151)
    
    if(
get_pcvar_num(g_cvarlogmode))
    {
        
formatex(LogFile64"%s/%s.htm"FilePathdatestr)
        if(!
file_exists(LogFile))
        {    
            new 
title[80]
            
formatex(title79"<title>Chat Logger - %s</title>%s"datestrTITLE)
            
write_file(LogFiletitle)
            
write_file(LogFileFONT)
        }
        
formatex(logmsgMAXLEN"%s &lt;%s&gt;&lt;%s&gt;"timestrauthidip)
    }
    else
    {
        
formatex(LogFile64"%s/ChatLog.htm"FilePath)
        if(!
file_exists(LogFile))
        {
            
write_file(LogFile"<title>Chat Logger</title>")
            
write_file(LogFileTITLE)
            
write_file(LogFileFONT)
        }
        
formatex(logmsgMAXLEN"%s - %s &lt;%s&gt;&lt;%s&gt;"datestrtimestrauthidip)
    }
    
    
read_argv(0cmd8)
    if(
cmd[0] == 0x61)
    {
        if(!
IsAdminChatRunning || !ufg) return
        
        
formatex(logmsgMAXLEN"%s <font color=purple>"logmsg)
        if(
cmd[5] == 0x68)
            
formatex(logmsgMAXLEN"%s(ADMINS) "logmsg)
        else
        {
            switch(
cmd[4])
            {
                case 
0x73:    formatex(logmsgMAXLEN"%s(ALL) "logmsg)
                case 
0x74:    formatex(logmsgMAXLEN"%s(HUDCHAT) "logmsg)
                case 
0x63:    formatex(logmsgMAXLEN"%s(HUDCENTER) "logmsg)
                case 
0x70:
                {
                    new 
privpname[32]
                    
read_argv(1pname31)
                    
pos strlen(pname) + 1
                    priv 
cmd_target(idpname0)
                    if(!
priv)
                        return
                    
get_user_name(privpname31)
                    
CheckPlayerName(pname)
                    
formatex(logmsgMAXLEN"%s(%s) "logmsgpname)
                }
            }
        }
    }
    else
    {
        new 
0at[5]
        
read_argv(1at4)
        while(
at[a] == 0x40)
            
a++
        if(
IsAdminChatRunning && && cmd[3])
        {
            
pos 1
            formatex
(logmsgMAXLEN"%s <font color=teal>(%s) "logmsgis_user_admin(id) ? "ADMIN" "PLAYER")
        }
        else if(
IsAdminChatRunning && && !cmd[3] && ufg)
        {    
            
pos IsColorLetter(at[a]) ? a
            formatex
(logmsgMAXLEN"%s <font color=purple>(%s) "logmsgHUDPOS[a])
        }
        else
        {
            if(!
is_user_connected(id)) return
            new 
CsTeams:team cs_get_user_team(id)
            
formatex(logmsgMAXLEN"%s <font color=%s>"logmsgTEAMCOLOR[_:team])
            switch(
team)
            {
                case 
12
                {
                    if(!
is_user_alive(id))
                        
formatex(logmsgMAXLEN"%s*DEAD*"logmsg)
                    if(
cmd[3])
                        
formatex(logmsgMAXLEN"%s%s"logmsgTEAMNAME[_:team])
                }
                case 
03:    formatex(logmsgMAXLEN"%s%s"logmsgTEAMNAME[_:team])
            }
        }
    }
    
    new 
name[32],  said[192]
    
get_user_name(idname31)
    
CheckPlayerName(name)
    
read_args(said191)
    
remove_quotes(said)
    
replace_all(said191"<""&lt;")
    
replace_all(said191">""&gt;")
    
formatex(logmsgMAXLEN"%s%s</font> : <font color=green>%s</font><br>"logmsgnamesaid[pos])
    
write_file(LogFilelogmsg)
}

CheckPlayerName(name[])
{
    new 
0c
    
while((name[i]))
    {
        switch(
c)
        {
            case 
0x3Cname[i] = 0x5B
            
case 0x3Ename[i] = 0x5D
        
}
        
i++
    }
}

bool:IsColorLetter(c)
{
    switch(
c)
    {
        case 
0x72,0x67,0x62,0x79,0x6D,0x63,0x6F: return true
        
default: return false
    
}
    return 
false


Last edited by Night Wolf90; 08-13-2017 at 08:54.
Night Wolf90 is offline
Ayman Khaled
Senior Member
Join Date: Mar 2017
Location: Palestine
Old 08-13-2017 , 08:39   Re: remove txt file
Reply With Quote #2

you mentioned in your title that its solved...
__________________
Ayman Khaled is offline
Night Wolf90
Member
Join Date: Jan 2016
Old 08-13-2017 , 08:55   Re: remove txt file
Reply With Quote #3

Quote:
Originally Posted by Ayman Khaled View Post
you mentioned in your title that its solved...
oh Sorry, I made a mistake in prefix
plz help
Night Wolf90 is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 08-15-2017 , 20:28   Re: remove txt file
Reply With Quote #4

Probrably what you need is fvault|file [includes].
__________________









Last edited by CrazY.; 08-15-2017 at 20:28.
CrazY. is offline
Night Wolf90
Member
Join Date: Jan 2016
Old 08-23-2017 , 15:47   Re: remove txt file
Reply With Quote #5

Quote:
Originally Posted by CrazY. View Post
Probrably what you need is fvault|file [includes].
plz edit plugin
i can not edite
Night Wolf90 is offline
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 08-24-2017 , 02:09   Re: remove txt file
Reply With Quote #6

Quote:
Originally Posted by Night Wolf90 View Post
plz edit plugin
i can not edite
then don`t post in this section.
__________________
retired chump
DjSoftero is offline
Night Wolf90
Member
Join Date: Jan 2016
Old 10-06-2017 , 18:13   Re: remove txt file
Reply With Quote #7

plz move post
Night Wolf90 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 04:43.


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