[Release] Player total online time counter - FILE or SQL SAVE

The title basically explains what this script does, this script was created at the request of someone here in the forum and as the idea is good and can be useful for many who intend to count and save the total time played by each player on the server, I decided to release it.

This script counts the total online time played on the server, not the online time in the current session.

Donwload V2 :nerd_face:

Here

Donwload :nerd_face:

WARNING

!!!I!!!I!!! I DONT RECOMEND YOU USING THIS SQL VERSION USE THE Online Time SQL V2 !!!I!!!I!!!

SQL Version: onlinetime_sql.rar (2.3 KB)

File .txt Version:onlinetime_file.rar (2.7 KB)

Read the info below, you will like it :innocent:

Where the time is saved?

I made two versions of this script one version is a My SQL save, another version is a .txt file where is saved the time.

How it works?

/ot or /onlinetime
Will display the total online time played on the server by the player/source who executed the command.

/ot [ID] or /onlinetime [ID]
Will display to the player/source who executed the command the total online time played on the server by the ID written in the executed command.

MySQL Installation:

  1. Drag the resource “onlinetime_sql” to your server resource folder.

  2. Add this line to your server.cfg file: “start onlinetime_sql”

  3. Copy and paste in your database the SQL code in sql.sql file.

  4. Start your server!

To use the MySQL you will need the mysql-async in your server: mysql-async

File .txt Installation:

  1. Drag the resource “onlinetime_file” to your server resource folder.

  2. Add this line to your server.cfg file: “start onlinetime_file”

  3. Start your server!

WARNING: Dont change the folder “tempo” inside this resource, or you will get some errors! :sob:

THIS IS NO LONGER REQUIRED AFTER THE UPDATE
WARNING: In this version dont change the resource folder name, or you are going to get a error.
If you do it be sure to change the diretory in the lines 14, 16, 47, 51, 109, 112 in the server.lua.
Also, dont restart this version in live server.

Detailed Suport:

My Discord

ScreenShots

ok1
ok2

Thanks to:

@Clatanii for the idea :stuck_out_tongue_winking_eye:
Take some ideas about the files saves from EasyAdmin made by @Blumlaut
Solved a big problem with files saves with the @Vespura help in this topic
@Flatracer for helping me to discover certain natives that helped to solve the fact of having to configure the script to be able to be used, that is, it helped in the automation of this script!
Thanks to @ryu2kk for helping in the test

16 Likes

This reminds me of a GMOD extension. I will be adding this to my server and I will upload screenshots.

1 Like

Seems like it gives an error no matter what. You said if I change the title of the folder using the text version it will give you an error. I didn’t do this but I still get an error. I also spams console with 0s about 15 times every time I start it. Picture attached.
Edit: It constantly spams console.
https://gyazo.com/d2e8dd10c33b42ca6de439c8b1845fd1

Your server directory has to be changed on line 17:

io.input("C:\\FXServer\\resources\\onlinetime_file\\tempo\\".. identifiernr .. "-tempo.txt")

This is where my server is?

On your C drive? Send a picture of your server directory. (I mean path)

C:\Users\Administrator\Desktop\FiveMServer
Would I have to change the name of the folder?

See you need to change line 17 to:

io.input("C:\\Users\\Administrator\\Desktop\\FiveMServer\\resources\\onlinetime_file\\tempo\\".. identifiernr .. "-tempo.txt")

Seems to still give an error.

Edit, I see the new istructions and followed them and it still gives an error.

Change line 17 and 60 to where your server is located, like @Scott_UK said. It will work, follow the steps in the topic, now edited.

Use these two natives, so there will be no problem anymore with changing the resource name:

SAVE_RESOURCE_FILE(char* resourceName, char* fileName, char* data, int dataLength)
LOAD_RESOURCE_FILE(char* resourceName, char* fileName)

3 Likes

archive need repair bro!

Looks good. Keep it up

2 Likes

Updated file Version

  • You dont need no more to rename the lines to make it work! Thanks to @Flatracer to all the help!

  • All of erros solved, 100% fixed and working!

  • Better way to get the player time, with no more console erros.

EDITED:

  • Added some sreenshots!
3 Likes

lol downloaded it a minute before the update. Great update tho :slight_smile:

1 Like

Thanks @FAXES and @Element_55, hope you enjoy @FAXES

2 Likes

Awesome release man!!

1 Like

Awesome job! But is it possible to change so the /ot command shows the server online time and not the player?

1 Like

This is a script I’m currently working on. :slight_smile: Hopefully in the next day or so

Nice, would like if its SQL based. Add me on Discord and send me a link when you are done!

GameMaster10009#7903

1 Like