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

logfile (Help)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Id0x.
Junior Member
Join Date: Dec 2020
Old 01-15-2021 , 11:24   logfile (Help)
Reply With Quote #1

Why not give complete information ( SteamID: XX | IP: XX )

HTML Code:
L 16:15:31: ** Name: <Warrior>
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <geoip>

new const szLogDir[] = "addons/amxmodx/logs/ConnectLogger"

public plugin_init()
{
    if(!
dir_exists(szLogDir)) mkdir(szLogDir)
}
public 
client_putinserver(id)
{
    if(!
is_user_bot(id) && is_user_connected(id))
        
set_task(2.0,"Save",id)
}
public 
Save(id)
{
    new 
name[32]
    
get_user_name(idnamecharsmax(name))

    new 
authid[32]
    
get_user_authid(idauthid31)

    new 
ip[32]
    
get_user_ip(idip31)
    
    new 
logfile[50];
    new 
text[charsmax(name)]
    
    static 
datestr[11]
    
get_time("%Y-%m-%d"datestr10)
    new 
timestr[9]
    
get_time("%H:%M:%S"timestr8)

    
formatex(logfilecharsmax(logfile), "%s/%s"szLogDirdatestr)
    
formatex(textcharsmax(text), "L %s: ** Name: %s | SteamID: %s | IP: %s **"timestrnameauthidip)
    
write_file(logfiletext)

Id0x. is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 01-15-2021 , 12:09   Re: logfile (Help)
Reply With Quote #2

Try increasing the text[] array size.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Id0x.
Junior Member
Join Date: Dec 2020
Old 01-15-2021 , 13:21   Re: logfile (Help)
Reply With Quote #3

Quote:
Originally Posted by Napoleon_be View Post
Try increasing the text[] array size.
Give me an example please
Id0x. is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-15-2021 , 15:20   Re: logfile (Help)
Reply With Quote #4

Code:
new text[charsmax(name)]

How do you expect to store that entire text in a string of 32 characters?

Code:
new text[128]
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Reply


Thread Tools
Display Modes

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


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