Raised This Month: $ Target: $400
 0% 

Log code fails


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 07-19-2011 , 15:08   Re: Log code fails
Reply With Quote #1

Quote:
Originally Posted by Arkshine View Post
Maybe because the path maplogs has to be created before. (either manually, either using mkdir)
It worked, thanks

For anyone who wants the fixed code:

PHP Code:
    new iszLogpath[64], szMapname[32], szBuffer[128]
    
get_mapname(szMapnamecharsmax(szMapname))
    
get_time("%Y%m%d"szBuffercharsmax(szBuffer))
    
get_localinfo("amxx_basedir"szLogpathcharsmax(szLogpath))
    
add(szLogpathcharsmax(szLogpath), "/maplogs")
    
    if(!
dir_exists(szLogpath)) 
        
mkdir(szLogpath)
    
    do
    {
        if(
iformatex(g_szMapLogNamecharsmax(g_szMapLogName), "%s/%s_%s(%d).log"szLogpathszMapnameszBufferi+1)
        else  
formatex(g_szMapLogNamecharsmax(g_szMapLogName), "%s/%s_%s.log"szLogpathszMapnameszBuffer)
        
        
i++
    }
    while(
file_exists(g_szMapLogName))
    
    
log_to_file(g_szMapLogName"Map Started ^"%s^""szMapname
This will create a log for everymap that you play on your server.
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross

Last edited by meTaLiCroSS; 07-22-2011 at 20:03.
meTaLiCroSS is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 07-19-2011 , 15:26   Re: Log code fails
Reply With Quote #2

Quote:
Originally Posted by meTaLiCroSS View Post
This will create a log for everymap that you play on your server.
But nothing is logged to it except that the map started.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 07-19-2011 , 15:29   Re: Log code fails
Reply With Quote #3

Quote:
Originally Posted by Exolent[jNr] View Post
But nothing is logged to it except that the map started.
That's logic. You can use this for everthing that you want, lol. In my case, I did this for logging certain functions that can crash my server, and do a log before executing it.
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS 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 01:08.


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