Giter VIP home page Giter VIP logo

playerstats's Introduction

PlayerStats

Nuget Nuget

PlayerStats is a plugin for OpenMod. It enriches your server by saving and displaying player statistics. a range of in-game performance metrics, and other pertinent data.

Downloading/Updating

Run on console openmod install Hath.PlayerStats after installing OpenMod

Discord Integration

PlayerStats can send player statistics to Discord. Here's a preview:

Discord Integration

To enable Discord integration, make sure to set the Enabled option to true in the configuration:

Discord:
  Enabled: true // <---
  WebhookURL: "your-discord-webhook-url"
  Embed:
    Top: 5
    SortBy: "Accuracy"

Configuration

# See https://github.com/HathHub/PlayerStats
MySQL:
    ConnectionString: "Server=localhost;Port=3306;Database=dbname;User=username;Password=password;"
    TableName: "HathPlayerStats"

Messages:
  Stats: "[Stats for {PlayerName} #{Position}]\n Kills: {Kills} Deaths: {Deaths} Headshots: {Headshots} Accuracy: {Accuracy}\n Messages: {Messages} Zombies: {Zombies} Megas: {MegaZombies}\nFish: {Fish} Animals: {Animals} Harvests: {Harvests} Resources: {Resources}"
  RankingHeader: "<b>[Top 5 players]</b>"
  Ranking: "#{Position} {PlayerName}: Kills: {Kills} Deaths: {Deaths} Headshots: {Headshots} Accuracy: {Accuracy}"

Ranking:
  SortBy: "Kills"
  Limit: "5"

Discord:
  Enabled: true
  Interval: 60
  Embeds:
    - MyKillsEmbed:
      Top: 3
      SortBy: "Kills"
      Webhook: ""      
      MessageID: 214124531553
      Header: "asd"
      Description: "asd"
      Field:
        Inline: true
        Name: "๐Ÿฅ‡**#{Position}**"
        Value: "๐Ÿ‘ค **[{PlayerName}](https://steamcommunity.com/profiles/{SteamID})**
                > ๐Ÿชฆ **{Kills}** Kills"
    - MyHeadshotsEmbed:
      Top: 3
      SortBy: "Headshots"
      Webhook: ""      
      MessageID: 214124531553
      Header: "asd"
      Description: "asd"
      Field:
        Inline: true
        Name: "๐Ÿฅ‡**#{Position}**"
        Value: "๐Ÿ‘ค **[{PlayerName}](https://steamcommunity.com/profiles/{SteamID})**
                > ๐Ÿ’€ **{Headshots}** Headshots"

Rewards:
  - Variable: "Kills"
    Threshold: 100
    Commands:
      - "give {PlayerID} 363"
      - "give {PlayerID} 17"
    Global: false
    Messages:
      - "Congratulations! You've reached 100 kills and earned a Maplestrike and Drum."

  - Variable: "Headshots"
    Threshold: 50
    Commands:
      - "give {PlayerID} 363"
      - "give {PlayerID} 17"
    Global: true
    Messages:
      - "Sharpshooter Alert! {PlayerName} achieved 50 headshots and earned a Maplestrike. Everyone, cheer!"
  • {PlayerID}: Represents the player's SteamID64.
  • {PlayerName}: Represents the player's name in various messages.
  • {Position}: Represents the player's position in the ranking.
  • {Kills}: Represents the number of kills a player has.
  • {Deaths}: Represents the number of deaths a player has.
  • {Headshots}: Represents the number of headshots a player has.
  • {Accuracy}: Represents the accuracy of a player.
  • {Messages}: Represents the number of messages sent by a player.
  • {Zombies}: Represents the number of zombies killed by a player.
  • {MegaZombies}: Represents the number of mega zombies killed by a player.
  • {Fish}: Represents the number of fish caught by a player.
  • {Animals}: Represents the number of animals killed by a player.
  • {Harvests}: Represents the number of harvests performed by a player.
  • {Resources}: Represents the number of resources gathered by a player.

Plugin Commands:

  1. /ranking

    • Description: View the top players on the server.
    • Permissions: HathPlayerStats:commands.ranking
  2. /stats [playername]

    • Description: View detailed statistics for a player (optional playername parameter).
    • Permissions: HathPlayerStats:commands.stats

Permissions:

  • HathPlayerStats:commands.ranking: Allows access to the /ranking command.
  • HathPlayerStats:commands.stats: Allows access to the /stats command.

NuGet Dependencies

This plugin requires the following NuGet packages:

playerstats's People

Contributors

hathhub avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

playerstats's Issues

ERRs

[11:50:23 ERR][OpenMod.Core.Plugins.PluginActivator] Failed to load plugin: HathPlayerStats v0.1.0
System.TypeInitializationException: The type initializer for 'MySql.Data.MySqlClient.Replication.ReplicationManager' threw an exception. ---> System.TypeInitializationException: The type initializer for 'MySql.Data.MySqlClient.MySqlConfiguration' threw an exception. ---> System.Configuration.ConfigurationErrorsException: Configuration system failed to initialize ---> System.PlatformNotSupportedException: Operation is not supported on this platform.
  at System.Configuration.ClientConfigPaths..ctor (System.String exePath, System.Boolean includeUserConfig) [0x00050] in <0e721f564ffa49e6b1d97ad7b9fda1f2>:0
  at System.Configuration.ClientConfigPaths.GetPaths (System.String exePath, System.Boolean includeUserConfig) [0x00018] in <0e721f564ffa49e6b1d97ad7b9fda1f2>:0
  at System.Configuration.ClientConfigurationHost.get_ConfigPaths () [0x0000a] in <0e721f564ffa49e6b1d97ad7b9fda1f2>:0
  at System.Configuration.ClientConfigurationHost.GetStreamName (System.String configPath) [0x0006d] in <0e721f564ffa49e6b1d97ad7b9fda1f2>:0
  at System.Configuration.ClientConfigurationHost.get_IsAppConfigHttp () [0x00000] in <0e721f564ffa49e6b1d97ad7b9fda1f2>:0
  at System.Configuration.Internal.DelegatingConfigHost.get_IsAppConfigHttp () [0x00006] in <0e721f564ffa49e6b1d97ad7b9fda1f2>:0
  at System.Configuration.ClientConfigurationSystem..ctor () [0x00051] in <0e721f564ffa49e6b1d97ad7b9fda1f2>:0
  at System.Configuration.ConfigurationManager.EnsureConfigurationSystem () [0x00024] in <0e721f564ffa49e6b1d97ad7b9fda1f2>:0
   --- End of inner exception stack trace ---
  at System.Configuration.ConfigurationManager.EnsureConfigurationSystem () [0x00060] in <0e721f564ffa49e6b1d97ad7b9fda1f2>:0
  at System.Configuration.ConfigurationManager.PrepareConfigSystem () [0x0000a] in <0e721f564ffa49e6b1d97ad7b9fda1f2>:0
  at System.Configuration.ConfigurationManager.GetSection (System.String sectionName) [0x0000a] in <0e721f564ffa49e6b1d97ad7b9fda1f2>:0
  at MySql.Data.MySqlClient.MySqlConfiguration..cctor () [0x00000] in <89e64804b6d24b8788777419c246846f>:0
   --- End of inner exception stack trace ---
  at MySql.Data.MySqlClient.Replication.ReplicationManager..cctor () [0x0001e] in <89e64804b6d24b8788777419c246846f>:0
   --- End of inner exception stack trace ---
  at MySql.Data.MySqlClient.MySqlConnection.Open () [0x00245] in <89e64804b6d24b8788777419c246846f>:0
  at ShimmyMySherbet.MySQL.EF.Models.ConnectionProviders.TransientConnectionProvider.GetConnection (System.Boolean autoOpen, System.Boolean forceNew) [0x0000f] in <3362f374d68640f0ab07076fb5a533d4>:0
  at ShimmyMySherbet.MySQL.EF.Models.ConnectionProviders.TransientConnectionProvider.Open () [0x00000] in <3362f374d68640f0ab07076fb5a533d4>:0
  at ShimmyMySherbet.MySQL.EF.Core.MySQLEntityClient.Connect (System.String& errorMessage) [0x00006] in <3362f374d68640f0ab07076fb5a533d4>:0
  at PlayerStats.HathPlayerStats.OnLoadAsync () [0x000a2] in <32b25a6e0b704476966b98aae3d3eb97>:0
  at Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask`1[TStateMachine].GetResult (System.Int16 token) [0x00000] in <b570aeb885074593be3f1a2137ad3fbd>:0
  at OpenMod.UnityEngine.Plugins.OpenModUnityEnginePlugin.LoadAsync () [0x00116] in /_/unityengine/OpenMod.UnityEngine/Plugins/OpenModUnityEnginePlugin.cs:32
  at MySql.Data.MySqlClient.MySqlConnection.Open () [0x00245] in <89e64804b6d24b8788777419c246846f>:0
  at ShimmyMySherbet.MySQL.EF.Models.ConnectionProviders.TransientConnectionProvider.GetConnection (System.Boolean autoOpen, System.Boolean forceNew) [0x0000f] in <3362f374d68640f0ab07076fb5a533d4>:0
  at ShimmyMySherbet.MySQL.EF.Models.ConnectionProviders.TransientConnectionProvider.Open () [0x00000] in <3362f374d68640f0ab07076fb5a533d4>:0
  at ShimmyMySherbet.MySQL.EF.Core.MySQLEntityClient.Connect (System.String& errorMessage) [0x00006] in <3362f374d68640f0ab07076fb5a533d4>:0
  at PlayerStats.HathPlayerStats.OnLoadAsync () [0x000a2] in <32b25a6e0b704476966b98aae3d3eb97>:0
  at Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask`1[TStateMachine].GetResult (System.Int16 token) [0x00000] in <b570aeb885074593be3f1a2137ad3fbd>:0
  at OpenMod.UnityEngine.Plugins.OpenModUnityEnginePlugin.LoadAsync () [0x00116] in /_/unityengine/OpenMod.UnityEngine/Plugins/OpenModUnityEnginePlugin.cs:32
  at MySql.Data.MySqlClient.MySqlConnection.Open () [0x00245] in <89e64804b6d24b8788777419c246846f>:0
  at ShimmyMySherbet.MySQL.EF.Models.ConnectionProviders.TransientConnectionProvider.GetConnection (System.Boolean autoOpen, System.Boolean forceNew) [0x0000f] in <3362f374d68640f0ab07076fb5a533d4>:0
  at ShimmyMySherbet.MySQL.EF.Models.ConnectionProviders.TransientConnectionProvider.Open () [0x00000] in <3362f374d68640f0ab07076fb5a533d4>:0
  at ShimmyMySherbet.MySQL.EF.Core.MySQLEntityClient.Connect (System.String& errorMessage) [0x00006] in <3362f374d68640f0ab07076fb5a533d4>:0
  at PlayerStats.HathPlayerStats.OnLoadAsync () [0x000a2] in <32b25a6e0b704476966b98aae3d3eb97>:0
  at Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask`1[TStateMachine].GetResult (System.Int16 token) [0x00000] in <b570aeb885074593be3f1a2137ad3fbd>:0
  at OpenMod.UnityEngine.Plugins.OpenModUnityEnginePlugin.LoadAsync () [0x00116] in /_/unityengine/OpenMod.UnityEngine/Plugins/OpenModUnityEnginePlugin.cs:32
  at OpenMod.Core.Plugins.PluginActivator.TryActivatePluginAsync (System.Reflection.Assembly assembly) [0x00365] in /_/framework/OpenMod.Core/Plugins/PluginActivator.cs:230

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.