AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   logfile (Help) (https://forums.alliedmods.net/showthread.php?t=329983)

Id0x. 01-15-2021 11:24

logfile (Help)
 
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)



Napoleon_be 01-15-2021 12:09

Re: logfile (Help)
 
Try increasing the text[] array size.

Id0x. 01-15-2021 13:21

Re: logfile (Help)
 
Quote:

Originally Posted by Napoleon_be (Post 2732720)
Try increasing the text[] array size.

Give me an example please

OciXCrom 01-15-2021 15:20

Re: logfile (Help)
 
Code:
new text[charsmax(name)]

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

Code:
new text[128]


All times are GMT -4. The time now is 14:09.

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