AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Off-Topic (https://forums.alliedmods.net/forumdisplay.php?f=15)
-   -   Catching admin actions (https://forums.alliedmods.net/showthread.php?t=228073)

Warlord_dd2 10-13-2013 12:05

Catching admin actions
 
Hello,

I would like to know what is the best way (most optimal / resource saving) to catch admin action and do something with it.

For example:
1 / To log normal chat and team chat made by admins on one place
I need this to put normal chat of my admins in amx_logs, thus on one place have everything admin related that I might need.

2 / To "catch" many commands like "amx_ban", "amx_kick", "amx_slap", amx_slay", etc.
The reason for this is that I want to print console message to headadmins of who did what action, so we can better know who exactly issued which punishmetn, etc. Yes, I can go to amx_logs and see that, but purpose of this is to save time and also to give same ability to some people that I don't wanna give FTP access yet.

Thank you in advanced

simanovich 10-13-2013 14:32

Re: Catching admin actions
 
First:
Create an array that handler with all console commands
Then loop though all plugins, then get all console commands, and store them in the array if they are an admin commands.

Then hook client_command forward, get the args of the command (read_args) (read_argv(0,command,charsmax(command)) = The command itself)

Loop the array and check if the command match to any command in the array.

If there is a match just what you have to do is to log the admin name && steamid && ip && userid && command && command args and of course break the loop.

LordOfNothing 10-16-2013 03:57

Re: Catching admin actions
 
and is_user_admin no necesary ?

Warlord_dd2 10-17-2013 06:01

Re: Catching admin actions
 
@ LordOfNothing,

It is necessary, since I wanted to reduce spam in amx logs, and I only need that, so when I search logs for activity of an admin, I can see his attitude towards users as well as amx commands that he has used.

@ Topic,
Anyway, I have handled both problems by calling all necessary actions with "register_clcmd", from where I have done all the filtering that I needed.
example:
register_clcmd("say", "get_text")
register_clcmd("amx_ban", "do_leadersee")
register_clcmd("amx_unban", "do_leadersee")
register_clcmd("amx_kick", "do_leadersee")
register_clcmd("amx_gag", "do_leadersee")
etc...

It is probably not very resource saving, but it does its purpose, and as far as it appears till now, its not slowing down the server either.

OFC, any approach that would be more resource saving would be appreciated :)


All times are GMT -4. The time now is 12:07.

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