Raised This Month: $ Target: $400
 0% 

Help with Chat Logger


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
viniref
Junior Member
Join Date: Apr 2011
Old 05-16-2011 , 20:58   Help with Chat Logger
Reply With Quote #1

I need help to write the plugin in two places, and are increasing at amxx_logs amxx_site.

Here's the code:

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
("%d.%m.%Y"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 
0x73formatex(logmsgMAXLEN"%s(ALL) "logmsg)
    case 
0x74formatex(logmsgMAXLEN"%s(HUDCHAT) "logmsg)
    case 
0x63formatex(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 
03formatex(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


If someone would be grateful to me.
viniref is offline
 



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:31.


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