Raised This Month: $ Target: $400
 0% 

Admin Complaint


Post New Thread Reply   
 
Thread Tools Display Modes
Alb0
Senior Member
Join Date: Jun 2010
Old 09-18-2011 , 20:09   Re: Admin Complaint
Reply With Quote #21

Would it be possible to also record chat logs? The only chat logs that would be recorded would be the ones made by the user making a complaint and the admin. That would be pretty neat.
Alb0 is offline
kotinha
Senior Member
Join Date: Jun 2009
Location: Alentejo, Portugal :)
Old 09-19-2011 , 12:53   Re: Admin Complaint
Reply With Quote #22

Quote:
Originally Posted by Alb0 View Post
Would it be possible to also record chat logs? The only chat logs that would be recorded would be the ones made by the user making a complaint and the admin. That would be pretty neat.
From what I understood what you want is already in the plugin... What chat logs do you want to record?

EDIT: Use this: http://forums.alliedmods.net/showthread.php?p=394600
__________________
"If God exists, I hope he has a good excuse." - Woody Allen

Last edited by kotinha; 09-27-2011 at 12:43.
kotinha is offline
kuato
New Member
Join Date: Sep 2011
Old 09-26-2011 , 03:22   Re: Admin Complaint
Reply With Quote #23

Hi, greetings from Argentina and thank you for your cool plugin. I'm trying to translate this plugin into spanish but i'm having problems with the "reason" content. The original plugin works perfect, and everything else is working fine in the translated one except for the "reason".
This is an example of the resultant log entry.
Code:
<b>Queja:</b> angryuser (STEAM_ID_LAN)<br/><b>Admin:</b> badadmin (STEAM_ID_LAN).<br/><b>Razon:</b> <br/> <b>Fecha:</b>  03:52:56<br/><hr/>
No reason even if the reason is provided.

This is the translated plugin code, can you see any error?.

Code:
#include <amxmodx>
#include <amxmisc>
#include <nvault>

#define PLUGIN	"Admin Complaint"
#define AUTHOR	"thony"
#define VERSION	"1.0"

new szComplaintsDir[] = "addons/amxmodx/logs/quejas/";
new g_PlayerVotes[33][33]
new iComplaining[33]
new nVault
new iMaxPlayers

new cvar_MaxComplaints

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	register_clcmd("say /queja", "ShowComplainMenu")
	register_clcmd("Motivo de la queja", "ComplaintReason")
	register_clcmd("say /verquejas", "ViewComplaintsMenu", ADMIN_RCON)
	
	cvar_MaxComplaints = register_cvar("ac_maxcomplaints", "1")
	
	nVault = nvault_open("AdminComplain")
	iMaxPlayers = get_maxplayers();
}
public ComplaintReason(id) {
	if(iComplaining[id] == 0)
		return PLUGIN_HANDLED;
	
	if(is_user_admin(iComplaining[id])) {
		new szNum[3], authid[32]
		get_user_authid(iComplaining[id], authid, charsmax(authid))
		if(nvault_get(nVault, authid, szNum, charsmax(szNum))) {
			new iNum = str_to_num(szNum)
			num_to_str((iNum+1), szNum, charsmax(szNum))
			nvault_set(nVault, authid, szNum)
		}
		else
			nvault_set(nVault, authid, "1")
		
		g_PlayerVotes[id][iComplaining[id]]++;
		
		new szReason[246]
		read_argv(6, szReason, charsmax(szReason))
		LogComplain(id, iComplaining[id], szReason);
		iComplaining[id] = 0;
		
		client_print(id, print_chat, "[Quejas] Tu queja fue registrada, muchas gracias.")
	}
	return PLUGIN_HANDLED;
}
public client_disconnect(id) {
	for(new i; i < iMaxPlayers; i++) {
		g_PlayerVotes[id][i] = 0;
	}
	iComplaining[id] = 0;
}
public ShowComplainMenu(id) {
	new admins[33], adminsnum
	for(new i; i < iMaxPlayers; i++) {
		if(is_user_admin(i)) {
			admins[adminsnum] = i;
			adminsnum++;
		}
	}
	if(adminsnum < 1) {
		client_print(id, print_chat, "[Quejas] No hay admins conectados sobre los que quejarse.")
		return PLUGIN_HANDLED;
	}
	new menu = menu_create("Admin Complain", "ComplainMenuHandler")
	
	for(new i; i < adminsnum; i++) {
		new szName[42], szID[2], szFinal[42], iComplaintsNum = getComplaintsNum(admins[i]);
		get_user_name(admins[i], szName, charsmax(szName))
		num_to_str(admins[i], szID, charsmax(szID))
		
		if(g_PlayerVotes[id][admins[i]] >= get_pcvar_num(cvar_MaxComplaints))
			formatex(szFinal, charsmax(szFinal), "\d%s \r(%i)", szName, iComplaintsNum)
		else
			formatex(szFinal, charsmax(szFinal), "%s \r(%i)", szName, iComplaintsNum)
		
		menu_additem(menu, szFinal, szID)
	}
	
	menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
	menu_display(id, menu, 0);
	return PLUGIN_HANDLED;
}
public ComplainMenuHandler(id, menu, item)
{
	if(item == MENU_EXIT) {
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}
	
	new data[6], szName[64];
	new access, callback;
	menu_item_getinfo(menu, item, access, data,charsmax(data), szName,charsmax(szName), callback);
	
	new adminid = str_to_num(data);
	
	if(g_PlayerVotes[id][adminid] >= get_pcvar_num(cvar_MaxComplaints)) {
		client_print(id, print_chat, "[Quejas] Maximo numero de quejas alcanzado por admin.")
		ShowComplainMenu(id)
	}
	
	else if(is_user_admin(adminid)) {
		iComplaining[id] = adminid;
		client_cmd(id, "messagemode ^"Razon de la queja^"")
	}
	
	return PLUGIN_HANDLED;
}
public ViewComplaintsMenu(id, level, cid) {
	if(!cmd_access(id, level, cid, 1))
		return PLUGIN_HANDLED;
	
	new fileName[32], dir;
	dir = open_dir(szComplaintsDir, fileName, charsmax(fileName))
	next_file(dir, fileName, charsmax(fileName))
	
	if(!next_file(dir, fileName, charsmax(fileName))) {
		client_print(id, print_chat, "[Quejas] No hay quejas, felicitaciones.")
		close_dir(dir)
		return PLUGIN_HANDLED;
	}
	new menu = menu_create("Ver quejas por fecha", "ViewComplaintsMenuHandler")
	
	do {
		menu_additem(menu, fileName, fileName)
	}
	while(next_file(dir, fileName, charsmax(fileName)))
	
	menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
	menu_display(id, menu, 0);
	close_dir(dir)
	return PLUGIN_HANDLED;
}
public ViewComplaintsMenuHandler(id, menu, item) {
	if(item == MENU_EXIT) {
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}
	
	new data[6], szName[64], fullDir[100];
	new access, callback;
	menu_item_getinfo(menu, item, access, data,charsmax(data), szName,charsmax(szName), callback);
	
	formatex(fullDir, charsmax(fullDir), "%s%s", szComplaintsDir, szName)
	
	show_motd(id, fullDir, szName)
	
	menu_destroy(menu);
	return PLUGIN_HANDLED;
}
getComplaintsNum(id) {
	new szNum[3], authid[32]
	get_user_authid(id, authid, charsmax(authid))
	if(nvault_get(nVault, authid, szNum, charsmax(szNum)))
		return str_to_num(szNum);
	
	return 0;
}
LogComplain(id, adminid, const reason[]) {
	new szDate[40], szFile[50]
	get_time("%d-%m-%Y", szDate, charsmax(szDate))
	formatex(szFile, charsmax(szFile), "%s%s.txt", szComplaintsDir, szDate)
	if(!file_exists(szFile)) {
		write_file(szFile, "<style> body {background: black; color: white; font-size: 10px; font-family: arial;} </style>")
	}
	new szAuthid[32], szAuthid2[32], szTime[32], szName[42], szName2[42], szLog[200]
	get_time( "%H:%M:%S", szTime, charsmax(szTime))
	get_user_authid(id, szAuthid, charsmax(szAuthid))
	get_user_authid(adminid, szAuthid2, charsmax(szAuthid2))
	get_user_name(id, szName, charsmax(szName))
	get_user_name(adminid, szName2, charsmax(szName2))
	formatex(szLog, charsmax(szLog), "<b>Denunciante:</b> %s (%s)<br/><b>Sobre el Admin:</b> %s (%s).<br/><b>Razon:</b> %s<br/> <b>Fecha:</b>  %s<br/><hr/>", szName, szAuthid, szName2, szAuthid2, reason, szTime)
	write_file(szFile, szLog)
}
Thanks in advance for any help you can provide me.

Last edited by kuato; 09-26-2011 at 03:28.
kuato is offline
kotinha
Senior Member
Join Date: Jun 2009
Location: Alentejo, Portugal :)
Old 09-27-2011 , 03:41   Re: Admin Complaint
Reply With Quote #24

Line 48:
PHP Code:
read_argv(6szReasoncharsmax(szReason)) 

PHP Code:
read_argv(5szReasoncharsmax(szReason)) 
Try that...
__________________
"If God exists, I hope he has a good excuse." - Woody Allen
kotinha is offline
SGT
Senior Member
Join Date: Sep 2011
Old 09-27-2011 , 04:19   Re: Admin Complaint
Reply With Quote #25

Approved.



Sike. Plugin approvers should approve though.
SGT is offline
kotinha
Senior Member
Join Date: Jun 2009
Location: Alentejo, Portugal :)
Old 09-27-2011 , 12:09   Re: Admin Complaint
Reply With Quote #26

Quote:
Originally Posted by SGT View Post
Approved.



Sike. Plugin approvers should approve though.
Thank you!
__________________
"If God exists, I hope he has a good excuse." - Woody Allen
kotinha is offline
Choose_Your_Destiny
Senior Member
Join Date: May 2011
Old 10-02-2011 , 09:54   Re: Admin Complaint
Reply With Quote #27

Hey!!! Thank you very much man
Choose_Your_Destiny is offline
kotinha
Senior Member
Join Date: Jun 2009
Location: Alentejo, Portugal :)
Old 10-02-2011 , 11:59   Re: Admin Complaint
Reply With Quote #28

Quote:
Originally Posted by Choose_Your_Destiny View Post
Hey!!! Thank you very much man
Glad you liked it
__________________
"If God exists, I hope he has a good excuse." - Woody Allen
kotinha is offline
omer
Senior Member
Join Date: Nov 2011
Old 04-07-2012 , 10:14   Re: Admin Complaint
Reply With Quote #29

Can you make this to sql Please...
omer is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-20-2014 , 08:07   Re: Admin Complaint
Reply With Quote #30

Don't hardcode log path.

Unapproved for now as it appears author is inactive.
__________________
Arkshine 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 20:08.


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