Coder Social home page Coder Social logo

k4ryuu / cs2_playtimetracker Goto Github PK

View Code? Open in Web Editor NEW
18.0 1.0 0.0 1.92 MB

The Playtime Tracker plugin is a tool for tracking and displaying player statistics in your Counter-Strike 2 (CS2) server. This plugin allows the players to check their playtime, team-specific playtime, and death or alive playtime.

License: GNU General Public License v3.0

C# 100.00%
counter-strike-2 cs2 cssharp extension metamod plugin

cs2_playtimetracker's Introduction

GitHub tag (with filter) GitHub Repo stars GitHub issues GitHub GitHub contributors GitHub all releases GitHub last commit (branch)

Warning

This plugin has been moved to https://github.com/K4ryuu/K4-System


K4ryuu

CS2 Playtime Tracker

An awesome CS2 server addon created with CounterStrikeSharp

Download ยท Report Bug ยท Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact

About The Project

The Playtime Tracker plugin is a tool for tracking and displaying player statistics in your Counter-Strike 2 (CS2) server. This plugin allows the players to check their playtime, team-specific playtime, and death or alive playtime.

(back to top)

Dependencies

To use this server addon, you'll need the following dependencies installed:

  • CounterStrikeSharp: CounterStrikeSharp allows you to write server plugins in C# for Counter-Strike 2/Source2/CS2
  • MySQL Database (Version 5.2 or higher): This project requires a MySQL database to store and manage data. You can host your own MySQL server or use a third-party hosting service. Make sure it's at least version 5.2 or higher.

(back to top)

Support My Work

I offer various ways to support my journey:

  • ๐Ÿ’ฌ Request Private Paid Jobs: Got a specific project in mind? Let's chat, and I'll provide a quote.
  • ๐ŸŽ Subscribe to My Tiers: Join one of my subscription tiers for exclusive benefits, early access to projects, and personalized support.
  • โ˜• Buy Me a Coffee: One-time donations keep me motivated and my creativity flowing.
  • ๐Ÿ’ผ Shop from My Paid Resources: Explore and purchase resources I've crafted for private use.

Your support keeps my creative engine running and allows me to share knowledge with the community. Thanks for being part of my journey.

(back to top)

Getting Started

Follow these steps to install and use the addon:

Prerequisites

Before you begin, ensure you have the following prerequisites:

  • A working CS2 (Counter-Strike 2) server.
  • CounterStrikeSharp is up to date and is running on your server.
  • A compatible MySQL database (Version 5.2 or higher) set up and configured.

(back to top)

Installation

  1. Download the Addon: Start by downloading the addon from the GitHub Releases Page. Choose the latest release version.

  2. Extract the Addon: After downloading, extract the contents of the addon to the counterstrikesharp/plugins directory on your server. Inside the plugins folder, you should have a folder named exactly as the project dll. From the releases, you find it pre zipped with the correct name.

  3. Configuration: The configuration file (if there is any), will be generated automatically to the same folder after the plugin firt started succesfully.

(back to top)

Usage

The addon provides several commands and console variables (convars) to customize and interact with its features. Here is the list of the key commands and convars you can use:

Commands

  • !playtime Check the current playtime of the player
  • !mytime Check the current playtime of the player
  • !time Check the current playtime of the player

(back to top)

Roadmap

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the GPL-3.0 License. See LICENSE.md for more information.

(back to top)

Contact

(back to top)

cs2_playtimetracker's People

Contributors

k4ryuu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

cs2_playtimetracker's Issues

[BUG] After using the command, it throws errors

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.Collections.Generic.KeyNotFoundException: The given key '238' was not present in the dictionary.
   at K4ryuuPlaytimePlugin.PlaytimePlugin.OnClientConnect(EventPlayerConnectFull event, GameEventInfo info) in /Users/sples/Documents/GitHub/CS2_PlaytimeTracker/src/K4ryuuPlaytimeTracker.cs:line 71
   at InvokeStub_GameEventHandler`1.Invoke(Object, Object, IntPtr*)
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
   --- End of inner exception stack trace ---
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at CounterStrikeSharp.API.Core.FunctionReference.<>c__DisplayClass3_0.<.ctor>b__0(fxScriptContext* context) in /__w/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/FunctionReference.cs:line 81
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.Collections.Generic.KeyNotFoundException: The given key '238' was not present in the dictionary.
   at K4ryuuPlaytimePlugin.PlaytimePlugin.OnClientTeam(EventPlayerTeam event, GameEventInfo info) in /Users/sples/Documents/GitHub/CS2_PlaytimeTracker/src/K4ryuuPlaytimeTracker.cs:line 117
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
   --- End of inner exception stack trace ---
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at CounterStrikeSharp.API.Core.FunctionReference.<>c__DisplayClass3_0.<.ctor>b__0(fxScriptContext* context) in /__w/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/FunctionReference.cs:line 81
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.Collections.Generic.KeyNotFoundException: The given key '238' was not present in the dictionary.
   at K4ryuuPlaytimePlugin.PlaytimePlugin.OnClientSpawn(EventPlayerSpawn event, GameEventInfo info) in /Users/sples/Documents/GitHub/CS2_PlaytimeTracker/src/K4ryuuPlaytimeTracker.cs:line 91
   at InvokeStub_GameEventHandler`1.Invoke(Object, Object, IntPtr*)
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
   --- End of inner exception stack trace ---
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at CounterStrikeSharp.API.Core.FunctionReference.<>c__DisplayClass3_0.<.ctor>b__0(fxScriptContext* context) in /__w/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/FunctionReference.cs:line 81
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.Collections.Generic.KeyNotFoundException: The given key '238' was not present in the dictionary.
   at K4ryuuPlaytimePlugin.PlaytimePlugin.OnClientSpawn(EventPlayerSpawn event, GameEventInfo info) in /Users/sples/Documents/GitHub/CS2_PlaytimeTracker/src/K4ryuuPlaytimeTracker.cs:line 91
   at InvokeStub_GameEventHandler`1.Invoke(Object, Object, IntPtr*)
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
   --- End of inner exception stack trace ---
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at CounterStrikeSharp.API.Core.FunctionReference.<>c__DisplayClass3_0.<.ctor>b__0(fxScriptContext* context) in /__w/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/FunctionReference.cs:line 81

Error with new version

The plugin stopped working after the update.

at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at CounterStrikeSharp.API.Core.FunctionReference.<>c__DisplayClass3_0.<.ctor>b__0(fxScriptContext* context) in /__w/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/FunctionReference.cs:line 81
SteamNetworkingSockets lock held for 5.7ms.  (Performance warning.)  ServiceThread
This is usually a symptom of a general performance problem such as thread starvation.
"MinnDe<0><[U:1:756741]><TERRORIST>" OnPreResetRound => CTMDBG, team 2  will switch 0 117.39
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.Collections.Generic.KeyNotFoundException: The given key '0' was not present in the dictionary.
at K4ryuuPlaytimePlugin.PlaytimePlugin.OnClientSpawn(EventPlayerSpawn event, GameEventInfo info) in /Users/sples/Documents/GitHub/CS2_PlaytimeTracker/src/K4ryuuPlaytimeTracker.cs:line 95
at InvokeStub_GameEventHandler`1.Invoke(Object, Object, IntPtr*)
at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)

[BUG] after use !time console throws exceptions

Describe the bug
After u type a command (!time or !mytime) you will get exceptions in console.

To Reproduce
OS: Ubuntu 22.04
CSSharp Version used: https://github.com/roflmuffin/CounterStrikeSharp/actions/runs/6772103962
Install plugin, restart server, edit database config JSON and restart server.

Typing !time / !mytime will throw this exceptions:

Console:

L 11/06/2023 - 22:50:05: MatchStatus: Team "TERRORIST" is unset.
23:50:08
L 11/06/2023 - 22:50:05: MatchStatus: Score: 0:0 on map "jb_improSystem.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.Collections.Generic.KeyNotFoundException: The given key '0' was not present in the dictionary.
at K4ryuuPlaytimePlugin.PlaytimePlugin.SaveClientTime(CCSPlayerController player) in /Users/sples/Documents/GitHub/CS2_PlaytimeTracker/src/K4ryuuPlaytimeTracker.cs:line 156
at K4ryuuPlaytimePlugin.PlaytimePlugin.OnCommandCheckPlaytime(CCSPlayerController player, CommandInfo command) in /Users/sples/Documents/GitHub/CS2_PlaytimeTracker/src/K4ryuuPlaytimeTracker.cs:line 42
at CounterStrikeSharp.API.Core.BasePlugin.<>c__DisplayClass31_0.<AddCommand>b__0(Int32 i, IntPtr ptr) in /__w/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/BasePlugin.cs:line 166
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
--- End of inner exception stack trace ---
at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at CounterStrikeSharp.API.Core.FunctionReference.<>c__DisplayClass3_0.<.ctor>b__0(fxScriptContext* context) in /__w/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/FunctionReference.cs:line 70
23:50:10
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.Collections.Generic.KeyNotFoundException: The given key '0' was not present in the dictionary.
at K4ryuuPlaytimePlugin.PlaytimePlugin.SaveClientTime(CCSPlayerController player) in /Users/sples/Documents/GitHub/CS2_PlaytimeTracker/src/K4ryuuPlaytimeTracker.cs:line 156
at K4ryuuPlaytimePlugin.PlaytimePlugin.OnCommandCheckPlaytime(CCSPlayerController player, CommandInfo command) in /Users/sples/Documents/GitHub/CS2_PlaytimeTracker/src/K4ryuuPlaytimeTracker.cs:line 42
at CounterStrikeSharp.API.Core.BasePlugin.<>c__DisplayClass31_0.<AddCommand>b__0(Int32 i, IntPtr ptr) in /__w/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/BasePlugin.cs:line 166
at InvokeStub_Action`2.Invoke(Object, Object, IntPtr*)
at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
--- End of inner exception stack trace ---
at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at CounterStrikeSharp.API.Core.FunctionReference.<>c__DisplayClass3_0.<.ctor>b__0(fxScriptContext* context) in /__w/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/FunctionReference.cs:line 70
23:50:14
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.Collections.Generic.KeyNotFoundException: The given key '0' was not present in the dictionary.
at K4ryuuPlaytimePlugin.PlaytimePlugin.OnClientSpawn(EventPlayerSpawn event, GameEventInfo info) in /Users/sples/Documents/GitHub/CS2_PlaytimeTracker/src/K4ryuuPlaytimeTracker.cs:line 93
at InvokeStub_GameEventHandler`1.Invoke(Object, Object, IntPtr*)
at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
--- End of inner exception stack trace ---
at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at CounterStrikeSharp.API.Core.FunctionReference.<>c__DisplayClass3_0.<.ctor>b__0(fxScriptContext* context) in /__w/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/FunctionReference.cs:line 70

[REQ] Metamod

woudnt it be better to use metamod for thi splugin and some other of ur plugins since most of us are using cs2fixes and counterstrikesharp doesnt work together with cs2fixes

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.