Raised This Month: $ Target: $400
 0% 

Natives


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Intouchable
Senior Member
Join Date: Mar 2012
Old 05-16-2012 , 10:07   Re: Natives
Reply With Quote #1

Quote:
Originally Posted by <VeCo> View Post
log_to_file saves everything in one file, it doesn't create seperate files for different days.

Sorry, I want to tell you conversely, that i need to log every day separat, opposed total one for all days.

Last edited by Intouchable; 05-16-2012 at 10:07.
Intouchable is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-16-2012 , 21:23   Re: Natives
Reply With Quote #2

Quote:
Originally Posted by Intouchable View Post
Sorry, I want to tell you conversely, that i need to log every day separat, opposed total one for all days.
Then you just use log_to_file() with a different name every day.
__________________
fysiks is offline
Intouchable
Senior Member
Join Date: Mar 2012
Old 05-18-2012 , 09:30   Re: Natives
Reply With Quote #3

Quote:
Originally Posted by fysiks View Post
Then you just use log_to_file() with a different name every day.
PHP Code:
 new szFile[100]
 
formatex(szFilecharsmax(szFile), "%s"GetLogFileName("kick"))
 
log_amx("bb:%s"szFile)
log_to_file(szFile"[KICK] ADMININSTRATOR %s <%s> (%s) kicked player %s <%s> (%s) už %s!"clANameclAIPclASteamidclPNameclPIPclPSteamidszReason)

register_native("GetLogFileName""_GetLogFileName")


public 
_GetLogFileName(const szName[])
{
 new 
iSize ArraySize(Logs), szFile[100]
 
 for(new 
0iSizei++)
 {
  
ArrayGetString(LogsiszFilecharsmax(szFile))
  
  if(
strfind(szFileszName) != -1)
   break
 }
 return 
szName

Obtain this:
L 05/17/2012 - 16:13:04: [amx_log_natives.amxx] aa:AdminCommandsLogs/Kicks20120517
L 05/17/2012 - 16:13:04: [admincmd.amxx] bb:8ļ

It's okey working, but when getting file name obtain nonsense...

Last edited by Intouchable; 05-18-2012 at 09:31.
Intouchable is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-18-2012 , 10:21   Re: Natives
Reply With Quote #4

PHP Code:
 new szFile[100]
 
GetLogFileName("kick"szFilecharsmax(szFile))
 
log_amx("bb:%s"szFile)
log_to_file(szFile"[KICK] ADMININSTRATOR %s <%s> (%s) kicked player %s <%s> (%s) už %s!"clANameclAIPclASteamidclPNameclPIPclPSteamidszReason
PHP Code:
public plugin_natives()
 
register_native("GetLogFileName""_GetLogFileName")

public 
_GetLogFileName(iPlugin iParams)
{
 new 
szName[/* name size */]
 
get_string(1szNamecharsmax(szName))
 
 new 
szFile[100]
 new 
ret fnGetLogFileName(szNameszFilecharsmax(szFile))
 
 
set_string(2szFileret)
 
 return 
ret
}

fnGetLogFileName(const szName[], szOutput[], iOutputLen)
{
 new 
iSize ArraySize(Logs), szFile[100]
 
 for(new 
0iSizei++)
 {
  
ArrayGetString(LogsiszFilecharsmax(szFile))
  
  if(
strfind(szFileszName) != -1)
   return 
copy(szOutputiOutputLenszFile)
 }
 return 
0

__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Intouchable
Senior Member
Join Date: Mar 2012
Old 05-18-2012 , 11:31   Re: Natives
Reply With Quote #5

Quote:
Originally Posted by Exolent[jNr] View Post
PHP Code:
 new szFile[100]
 
GetLogFileName("kick"szFilecharsmax(szFile))
 
log_amx("bb:%s"szFile)
log_to_file(szFile"[KICK] ADMININSTRATOR %s <%s> (%s) kicked player %s <%s> (%s) už %s!"clANameclAIPclASteamidclPNameclPIPclPSteamidszReason
PHP Code:
public plugin_natives()
 
register_native("GetLogFileName""_GetLogFileName")

public 
_GetLogFileName(iPlugin iParams)
{
 new 
szName[/* name size */]
 
get_string(1szNamecharsmax(szName))
 
 new 
szFile[100]
 new 
ret fnGetLogFileName(szNameszFilecharsmax(szFile))
 
 
set_string(2szFileret)
 
 return 
ret
}

fnGetLogFileName(const szName[], szOutput[], iOutputLen)
{
 new 
iSize ArraySize(Logs), szFile[100]
 
 for(new 
0iSizei++)
 {
  
ArrayGetString(LogsiszFilecharsmax(szFile))
  
  if(
strfind(szFileszName) != -1)
   return 
copy(szOutputiOutputLenszFile)
 }
 return 
0

Thanks.

Last edited by Intouchable; 05-18-2012 at 11:39.
Intouchable 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 00:22.


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