[Include] PlayerAverage Calc. v1.0
#1

Introduction
Hello. This simple library contains a function to retrieve the average of players over a particular time.

How does it work
You can choose to calculate a new player average each second, minute, or hour. Modify the define "TIME_USED" in the include if you'd like to change the default (= each second). It even saves the average when you shut down your server (it saves the amount of checks, and the total amount of players. Average is calculated by dividing the players with the amount of checks using floatdiv).

You can retrieve the average by using the function 'GetServerAveragePlayers()'. This returns a float, the average calculated players.

Download
Click here to download version 1

Is there anything you need to know?
Yeah, credits to Dracoblue for Dini. Also, I planned to make all measures of central tendency in the future (average, mode, median). For now you have the first one.

Jochem
Reply
#2

This is more a snippet than an include. You just used Dini as a crap saving method, some variables and hooking....Improve it.... Waiting for it

Edit: Why timer? If players joins and the server restarts (including crashes etc...) the average will not save.
Reply
#3

Quote:
Originally Posted by TheArcher
Посмотреть сообщение
This is more a snippet than an include. You just used Dini as a crap saving method, some variables and hooking....Improve it.... Waiting for it

Edit: Why timer? If players joins and the server restarts (including crashes etc...) the average will not save.
Dini is good for this as I do not need to save COMPLETE userdata files.

For the rest, you should take a closer look at the code. It's crash-safe.
Reply
#4

Quote:
Originally Posted by Jochemd
Посмотреть сообщение
Dini is good for this as I do not need to save COMPLETE userdata files.

For the rest, you should take a closer look at the code. It's crash-safe.
I'm not talking about the include-crash but the server itself for unknown reasons. It could happen, trust me re-write it .
Reply
#5

Oh come on dini is not the source of aids. Yes, it is slower than y_ini or the native functions, but it's definitely not going to make your server crash or eat your bandwith. Stop hating on it all the time, optimization is totally overrated.

OT: I'm wondering why you're using timers, I could think of a way more effective and accurate way to do this without missing any players at all !
Reply
#6

Quote:
Originally Posted by Hiddos
Посмотреть сообщение
Oh come on dini is not the source of aids. Yes, it is slower than y_ini or the native functions, but it's definitely not going to make your server crash or eat your bandwith. Stop hating on it all the time, optimization is totally overrated.

OT: I'm wondering why you're using timers, I could think of a way more effective and accurate way to do this without missing any players at all !
LOL dude optimizing the server is what you have to do! Faster = best am I right? Why should I use out-dated scripts? I'm not hating this though, I appreciate the effort but if you really want to help the community, do something serious then.
Reply
#7

Quote:
Originally Posted by TheArcher
Посмотреть сообщение
LOL dude optimizing the server is what you have to do! Faster = best am I right? Why should I use out-dated scripts? I'm not hating this though, I appreciate the effort but if you really want to help the community, do something serious then.
Think before you post. I usually use DINI for small files, I don't see the reason why to use some complex INI includes instead of using DINI when you just need to save a couple lines. Yeah, DINI is outdated but that doesn't mean it's not useful!

This is pretty nice include also, I've been looking for something like this.
Reply
#8

Quote:
Originally Posted by Marricio
Посмотреть сообщение
Think before you post. I usually use DINI for small files, I don't see the reason why to use some complex INI includes instead of using DINI when you just need to save a couple lines. Yeah, DINI is outdated but that doesn't mean it's not useful!

This is pretty nice include also, I've been looking for something like this.
Think that I am using YINI instead of DINI. Why should I create files with different includes? One faster and the other is slower and outdated.
Reply
#9

Quote:
Originally Posted by TheArcher
Посмотреть сообщение
Think that I am using YINI instead of DINI. Why should I create files with different includes? One faster and the other is slower and outdated.
Yeah, using dini instead of y_ini will surely cost me a whole lot of time, I don't think I can miss 1.5 miliseconds of my life.
Reply
#10

Quote:
Originally Posted by TheArcher
Посмотреть сообщение
Think that I am using YINI instead of DINI. Why should I create files with different includes? One faster and the other is slower and outdated.
Like Jochemd said.. you won't die for 1.5 ms of your life. I run a 70,000 lines script that has a mix between FINI and DINI, and the script works great for me! It's up to you if you don't want to use DINI, replace it for YINI if that's what you want. I don't see any problem this script using DINI for small files, I see it better than using YINI for this type of stuff due people being more acquainted of DINI than Y_INI.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)