Raised This Month: $51 Target: $400
 12% 

[REQ] Admin Information


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
speedykiller2012
Senior Member
Join Date: Jun 2014
Old 07-17-2016 , 15:37   [REQ] Admin Information
Reply With Quote #1

Hello AlliedModders,

I Need a Plugin that Creates Logs whenever an admin Connect to the server and when ever he leaves
+ His Time spend at the server today

Like this:
Nick : abc
Connect time :- 12:00
Disconnect Time :- 2:00

Thats Little Too Hard for u Guys i Guess!!

But please this plugin means lot to me !!
speedykiller2012 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 07-17-2016 , 19:22   Re: [REQ] Admin Information
Reply With Quote #2

That's pretty easy actually. I'll try and make it on my phone, so go easy on me if it doesn't work.

PHP Code:
#include <amxmodx>

#define PLUGIN_VERSION "1.0"
#define FLAG_ADMIN ADMIN_SLAY

enum _:Info
{
    
eName[32],
    
eJoinTime[9],
    
eLeaveTime[9]
}

new const 
g_szLogFile[] = "AdminInfo.log"
new g_szInfo[33][Info]

public 
plugin_init()
    
register_plugin("Admin Information"PLUGIN_VERSION"OciXCrom")

public 
client_putinserver(id)
{
    if(!(
get_user_flags(id) & FLAG_ADMIN))
        return

    
get_user_name(idg_szInfo[id][eName], charsmax(g_szInfo[][eName]))
    
get_time("%X"g_szInfo[id][eJoinTime], charsmax(g_szInfo[][eJoinTime]))
}

public 
client_disconnect(id)
{
    if(!(
get_user_flags(id) & FLAG_ADMIN))
        return

    
get_time("%X"g_szInfo[id][eLeaveTime], charsmax(g_szInfo[][eLeaveTime]))
    
log_to_file(g_szLogFile"Nick: %s | Connect Time: %s | Disconnect Time: %s",
    
g_szInfo[id][eName], g_szInfo[id][eJoinTime], g_szInfo[id][eLeaveTime])

__________________

Last edited by OciXCrom; 07-18-2016 at 02:14.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
speedykiller2012
Senior Member
Join Date: Jun 2014
Old 07-17-2016 , 19:59   Re: [REQ] Admin Information
Reply With Quote #3

Quote:
Originally Posted by OciXCrom View Post
That's pretty easy actually. I'll try and make it on my phone, so go easy on me if it doesn't work.

PHP Code:
#include <amxmodx>

#define PLUGIN_VERSION "1.0"
#define FLAG_ADMIN ADMIN_SLAY

enum _:Info
{
    
eName[32],
    
eJoinTime[9],
    
eLeaveTime[9]
}

new const 
g_szLogFile[] = "AdminInfo.log"
new g_szInfo[33][Info]

public 
plugin_init()
    
register_plugin("Admin Information"PLUGIN_VERSION"OciXCrom")

public 
client_putinserver(id)
{
    if(!(
get_user_flags(id) & FLAG_ADMIN))
        return

    
get_user_name(idg_szInfo[id][eName], charsmax(g_szInfo[id][eName]))
    
get_time("%X"g_szInfo[id][eJoinTime], charsmax(g_szInfo[id][eJoinTime]))
}

public 
client_disconnect(id)
{
    if(!(
get_user_flags(id) & FLAG_ADMIN))
        return

    
get_time("%X"g_szInfo[id][eLeaveTime], charsmax(g_szInfo[id][eLeaveTime]))
    
log_to_file(g_szLogFile"Nick: %s | Connect Time: %s | Disconnect Time: %s",
    
g_szInfo[id][eName], g_szInfo[id][eJoinTime], g_szInfo[id][eLeaveTime])


Error: Expected token: "]", but found "-identifier-" on line 24
Error: Invalid expression, assumed zero on line 24
Error: Invalid expression, assumed zero on line 24
Error: Too many error messages on one line on line 24

Compilation aborted.
4 Errors.
speedykiller2012 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 07-18-2016 , 02:14   Re: [REQ] Admin Information
Reply With Quote #4

Try now.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
SomewhereLost
AlliedModders Donor
Join Date: Mar 2014
Location: Tomorrowland
Old 07-18-2016 , 03:16   Re: [REQ] Admin Information
Reply With Quote #5

If admin connects and disconnects from server several times in a day, how will it look like?
Isn't it better just to count the hours of spending in a server in one day?
__________________
SomewhereLost is offline
Send a message via Skype™ to SomewhereLost
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-18-2016 , 21:19   Re: [REQ] Admin Information
Reply With Quote #6

It depends on the purpose of the request. Since he requested logging of connections and disconnections, he got what he asked for.
__________________

Last edited by fysiks; 07-18-2016 at 21:20.
fysiks is offline
xxxperts
Senior Member
Join Date: Oct 2013
Location: India
Old 07-19-2016 , 00:39   Re: [REQ] Admin Information
Reply With Quote #7

This will create a folder named "admin_log_files" in "/addons/amxmodx/data"
and logs folder will have text file named with date of entries
example: 09-03-2016.txt

Output


Code


EDIT: Sorry. I forgot to mention that you have to create folder named "admin_log_files" in "/addons/amxmodx/data"

Update. You dont need to create folder manually.

Thanks to OciXCrom
Attached Files
File Type: sma Get Plugin or Get Source (admin_login_logout.sma - 428 views - 1.9 KB)
__________________
All my work is here

Last edited by xxxperts; 07-20-2016 at 00:51.
xxxperts is offline
SomewhereLost
AlliedModders Donor
Join Date: Mar 2014
Location: Tomorrowland
Old 07-19-2016 , 02:53   Re: [REQ] Admin Information
Reply With Quote #8

Sounds just like what I've said. I'll test it out.
__________________
SomewhereLost is offline
Send a message via Skype™ to SomewhereLost
speedykiller2012
Senior Member
Join Date: Jun 2014
Old 07-19-2016 , 15:24   Re: [REQ] Admin Information
Reply With Quote #9

Quote:
Originally Posted by OciXCrom View Post
Try now.
Thankyou Bro <3
speedykiller2012 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 07-19-2016 , 15:59   Re: [REQ] Admin Information
Reply With Quote #10

Quote:
Originally Posted by xxxperts View Post
EDIT: Sorry. I forgot to mention that you have to create folder named "admin_log_files" in "/addons/amxmodx/data"
You can use mkdir(const dirname[]) to create a folder after checking whether it exists or not with dir_exists(const dirname[]).
__________________

Last edited by OciXCrom; 07-19-2016 at 15:59.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
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 08:11.


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