[Include] nStatistics v0.1 [ UPTIME - SERVER MONITOR ]
#1

nStatistics v0.1
Functions:
pawn Код:
NS_TotalUptime(&days, &hours, &minutes, &seconds); // Returns total uptime, days, hours, minutes and seconds.
NS_Uptime(&days, &hours, &minutes, &seconds); // Returns uptime, days, hours minutes and seconds.
NS_DateFromFirstUse(type); // Returns date when nstatistics first initialized.
NS_DateFromServerStart(type); // Save as above except when the server was started.
NS_TimeFromFirstUse(); // Returns time from first use, etc "5 minutes", "1 day" etc.
NS_UptimeString(); // Same as above function but for current uptime, not total.
NS_TotalUptimeString(); // Same as above but for total.
NS_SaveData(); // Saves the statistics to file, only to be used by the include.
NS_SaveData(); // Loads the statistics to file, only to be used by the include.
NS_AddToUptime(); // Total uptime timer, only to be used by the include.
NS_ReturnData(type); // Returns data based on type, types are listed below.
ReturnData types:
pawn Код:
#define NS_TYPE_STARTSTAMP  0
#define NS_TYPE_DEATHS  1
#define NS_TYPE_CONNECTIONS  2
#define NS_TYPE_WEAPONS  3
#define NS_TYPE_VEHICLES  4
#define NS_TYPE_PLAYERTEXT  5
#define NS_TYPE_TOTALUPTIME 6
#define NS_TYPE_KICKBANS 7
NS_DateFromFirstUse/NS_DateFromServerStart - types:
pawn Код:
type unset will print >> 09.07.2009-23:34:11
type 1 will print >> 09/07/2009, 23:34:11
type 2 will print >> July 09, 2009, 23:34:11
type 3 will print >> 9 Jul 2009, 23:34
How do I use this in my script?
Put
pawn Код:
#include <nstatistics>
at the top of your script and the include will start immediately.

Example Usage:



pawn Код:
new string[512];
format(string, sizeof(string), "Start Unix Stamp: %10d\nDeaths: %d\nConnections: %d\nWeapons Given: %d\nVehicles Created: %d\nPlayer Text: %d\nTotal Uptime: %d\nKicks/Bans: %d\nUptime String: %s\nTotal Uptime String: %s\n\nsince %s \n[ %s ago ]",
NS_ReturnData(NS_TYPE_STARTSTAMP),
NS_ReturnData(NS_TYPE_DEATHS),
NS_ReturnData(NS_TYPE_CONNECTIONS),
NS_ReturnData(NS_TYPE_WEAPONS),
NS_ReturnData(NS_TYPE_VEHICLES),
NS_ReturnData(NS_TYPE_PLAYERTEXT),
NS_ReturnData(NS_TYPE_TOTALUPTIME),
NS_ReturnData(NS_TYPE_KICKBANS),
NS_UptimeString(),
NS_TotalUptimeString(),
NS_DateFromFirstUse(1),
NS_TimeFromFirstUse());
ShowPlayerDialog(playerid,2562,DIALOG_STYLE_MSGBOX,"Server Statistics",string,"Close","");
Note
  • This won't work if you restart the server by closing the executable instead of using rcon gmx.
  • If you want to restart the log just remove nstatistics.txt from your scriptfiles and reload your server.
  • It won't log filterscript actions, only mode.
Download
Download - Pastebin
Reply
#2

Yes, great this just gave me ideas ! nice job
Reply
#3

Thank you...
I was just about to spend some time and script this for my script. You sir, are amazing
Reply
#4

yea he is amazing
Reply
#5

Another nice release by you.
Reply
#6

Quote:
Originally Posted by Chrillzen
Посмотреть сообщение
Another nice release by you.
Thank you sir.
Reply
#7

Nice work Norn.
Reply
#8

Nice Job Mate
Reply
#9

Now can see server stats. Good. 5/5
Reply
#10

Nice release!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)