Jump to content

Easy Stats - A simple solution to add stats to any DCS Mission or Multiplayer Server (Moose Required!) - By Element


ElementLT

Recommended Posts

Easy Stats - A simple solution to add player stats to any DCS Mission or Multiplayer Server

 

stats.png

 

EasyStats by Element
Brought to you by: The Fraternity
Current Version: 1.0.1
Released: 12-09-2020

 

Features

- Highly Customizable with knowledge of Lua and MOOSE Framework.
- Tracks Air 2 Air Kills, Air 2 Ground Kills, and even Scenery Obj kills 
- Easily add basic player stats to any mission or multiplayer server.
- Data is stored based on player name(see config section) or client multiplayer name for servers.
- Option to store data based in UID IF you can provide it.
- Data is stored in json files. 
- Pilots can use the F10 Menu to display real time stats within game.
- View last 10 kills within Mission
- JSON Data can be used in websites, discord bots, or even your own MOOSE code/scripts with the included function(s). 
 

REQUIREMENTS:
  - MOOSE
  - EasyStats.lua (included)
 

Current Data Logged:
  joinDate (unix timestamp)
  MostRecentModule

  last_visit (unix timestamp)
  visit_count
  kill_count, view last 10 kills within mission
  flight_time (in seconds)
  takeoffs 
  landings 
  ejections
  crashes
  deaths

_________________________

 

Easy Installation 
All Steps are REQUIRED
 
  1. Edit your MissionScripting.lua ("C:\Program Files\Eagle Dynamics\DCS World\Scripts") so EasyStats may create and save data.
     Comment out sanitizeModule('os'), sanitizeModule('io'), sanitizeModule('lfs'), and require
     It should look something like this...
    
    do
      --sanitizeModule('os')
      --sanitizeModule('io')
      --sanitizeModule('lfs')
      require = nil
      loadlib = nil
    end
    
    **make available these functions at your own risk.**
  
  2. Load Moose.lua then EasyStats.lua into your mission at MissionStart via the DCS Mission Editor or in your lua scripts
     (don't forget the edit user config section in EasyStats)

me_install.jpg
  
  And That's It! Enjoy the live stats! 

_________________________
Download Easy Stats




_________________________
Change Log / Updates

12-5-2020
- removed config option SinglePlayerPilotName as its irrelevant will use Name in Log Book
- added config option to display message/notification to pilot after every kill

12-9-2020
- now track static & Scenery Object kills

1-2-2021
- fixed a couple bugs


5-25-2021 Ver 1.3 Fixed a few bugs

EasyStats ver 1.3.rar


Edited by ElementLT
update text
Coming Soon...
The Fraternity Returns : https://thefraternitysim.com/
Link to comment
Share on other sites

  • ElementLT changed the title to Easy Stats - A simple solution to add stats to any DCS Mission or Multiplayer Server (Moose Required!) - By Element
5 hours ago, HC_Official said:

would I be right in thinking this was not tested on a server before you released it ?

No sir I tested this on my server with 3 different missions 

 

matter fact my dev server should be online for a while if you care to test it out. All is good on my end what seems to be your issue?
@HC_Official

Dev Server: 136.55.80.214:10309

 


Edited by ElementLT
Coming Soon...
The Fraternity Returns : https://thefraternitysim.com/
Link to comment
Share on other sites

hmm interesting, so when you examined your DCS.log you got no errors listed at all?

 

double slash error listed when it is trying to write file2
2020-12-10 19:33:13.972 ERROR   VFS: VFS_open_write: CreateFile(C:\Users\jesus_christ\Saved Games\DCS.openbeta_server\\EasyStats\stats\Kills\Kasimir.json): The system cannot find the path specified.

2020-12-10 19:33:13.972 INFO    SCRIPTING: Error in SCHEDULER function:[string "D:\games\EasyStats.lua"]:418: attempt to index local 'file2' (a nil value)
2020-12-10 19:33:13.972 INFO    SCRIPTING: stack traceback:
    [string "D:\games\3Develop_Moose_h.lua"]:8133: in function <[string "D:\games\3Develop_Moose_h.lua"]:8129>
    [string "D:\games\EasyStats.lua"]:418: in function 'WriteKillToJsonFile'
    [string "D:\games\EasyStats.lua"]:578: in function 'LogKill'
    [string "D:\games\EasyStats.lua"]:195: in function 'EventFunction'
    [string "D:\games\3Develop_Moose_h.lua"]:8478: in function <[string "D:\games\3Develop_Moose_h.lua"]:8477>
    [C]: in function 'xpcall'
    [string "D:\games\3Develop_Moose_h.lua"]:8476: in function 'onEvent'
    [string "Scripts/World/EventHandlers.lua"]:13: in function <[string "Scripts/World/EventHandlers.lua"]:11>

 

think a nil check will maybe need to be added in the code

2020-12-10 19:36:29.264 INFO    SCRIPTING: Error in SCHEDULER function:[string "D:\games\EasyStats.lua"]:201: attempt to concatenate field 'target_name' (a nil value)
2020-12-10 19:36:29.264 INFO    SCRIPTING: stack traceback:
    [string "D:\games\3Develop_Moose_h.lua"]:8133: in function <[string "D:\games\3Develop_Moose_h.lua"]:8129>
    [string "D:\games\EasyStats.lua"]:201: in function 'EventFunction'
    [string "D:\games\3Develop_Moose_h.lua"]:8478: in function <[string "D:\games\3Develop_Moose_h.lua"]:8477>
    [C]: in function 'xpcall'
    [string "D:\games\3Develop_Moose_h.lua"]:8476: in function 'onEvent'
    [string "Scripts/World/EventHandlers.lua"]:13: in function <[string "Scripts/World/EventHandlers.lua"]:11>

 

        --data
        KillDataTable.player_name = playerName
        KillDataTable.player_module = PlayerUnit:GetTypeName()--player module used
        KillDataTable.player_coalition = EventData.IniCoalition
        if type(EventData.TgtTypeName) == "number" then
          KillDataTable.target_name = "Scenery Object"
        elseif EventData.TgtTypeName == nil then
                    KillDataTable.target_name = "Unknown"
        else
          KillDataTable.target_name = EventData.TgtTypeName
        end
        KillDataTable.target_unit_name = EventData.TgtUnitName
        KillDataTable.target_coalition= EventData.TgtCoalition
        KillDataTable.timestamp = os.time(os.date("!*t"))
        
        EasyStats.LogKill(player_name,StatsFile,KillDataTable)

Click here for tutorials for using Virpil Hardware and Software

 

Click here for Virpil Flight equipment dimensions and pictures.

.

Link to comment
Share on other sites

that is very strange @HC_Official as I am not seeing any of this. Did you install the script  per my instructions , did you make any changes, using the latest version? 
 

feel free to join my discord, i have a channel for all my scripts 
 

Discord Support


Edited by ElementLT
Coming Soon...
The Fraternity Returns : https://thefraternitysim.com/
Link to comment
Share on other sites

loading it dynamically dont want to embedd it in the mission , no changes apart from the one to fix the nil error fix I am testing out, using latest version from this thread


Edited by HC_Official

Click here for tutorials for using Virpil Hardware and Software

 

Click here for Virpil Flight equipment dimensions and pictures.

.

Link to comment
Share on other sites

5 hours ago, HC_Official said:

loading it dynamically dont want to embedd it in the mission , no changes apart from the one to fix the nil error fix I am testing out, using latest version from this thread

 

hmmm oh okay...i wouldn't think loading it dynamically would be much of a difference but try doing it the standard way just to see how it works out. 
 

Coming Soon...
The Fraternity Returns : https://thefraternitysim.com/
Link to comment
Share on other sites

dynamic loading makes no difference (I am also loading ths before any other scripts (moose loads first of course)

 

2020-12-11 18:02:42.545 INFO    SCRIPTING:    685(     1)/E:                          BASE00000.function(** EasyStats by Element Ver 1.1 Loaded **)

 

Click here for tutorials for using Virpil Hardware and Software

 

Click here for Virpil Flight equipment dimensions and pictures.

.

Link to comment
Share on other sites

6 hours ago, HC_Official said:

dynamic loading makes no difference (I am also loading ths before any other scripts (moose loads first of course)

 

2020-12-11 18:02:42.545 INFO    SCRIPTING:    685(     1)/E:                          BASE00000.function(** EasyStats by Element Ver 1.1 Loaded **)

 

Then I'm not sure what the issue could be 🤷‍♂️ let's dig a bit deeper. What type of Target are you killing that clearly isn't registering for you?

Coming Soon...
The Fraternity Returns : https://thefraternitysim.com/
Link to comment
Share on other sites

first error is due to an extra slash in the file path , the double slash shown below

2020-12-12 00:22:54.076 ERROR   VFS: VFS_open_write: CreateFile(C:\Users\marks\Saved Games\DCS.openbeta_server\\EasyStats\stats\Kills\Prril.json): The system cannot find the path specified.

 

lord only knows what kill is causing this, it is a busy server with 25+ people on it, could be anything, but from checking last nights log it does look better, the nil check I put in seems to work

this is new

____________________

2020-12-12 00:47:24.377 INFO    Scripting: event:type=eject,t=48998.643,initiatorPilotName=ACE**88,initiatorMissionID=1953,
2020-12-12 00:47:24.377 INFO    Scripting: event:targetPilotName=ACE**88,type=kill,weapon=Mi-26,target=FA-18C_hornet,t=48998.643,initiatorMissionID=1000213,targetMissionID=1953,
2020-12-12 00:47:24.377 INFO    SCRIPTING: Error in SCHEDULER function:[string "D:\games\EasyStats.lua"]:180: attempt to index local 'PlayerUnit' (a nil value)
2020-12-12 00:47:24.377 INFO    SCRIPTING: stack traceback:
    [string "D:\games\3Develop_Moose_h.lua"]:8133: in function <[string "D:\games\3Develop_Moose_h.lua"]:8129>
    [string "D:\games\EasyStats.lua"]:180: in function 'EventFunction'
    [string "D:\games\3Develop_Moose_h.lua"]:8478: in function <[string "D:\games\3Develop_Moose_h.lua"]:8477>
    [C]: in function 'xpcall'
    [string "D:\games\3Develop_Moose_h.lua"]:8476: in function 'onEvent'
    [string "Scripts/World/EventHandlers.lua"]:13: in function <[string "Scripts/World/EventHandlers.lua"]:11>
2020-12-12 00:47:24.378 INFO    Scripting: event:amount=50,t=48998.643,type=score,initiatorMissionID=,

line 180 = if PlayerUnit:GetGroup():GetName() == player_unit:GetGroup():GetName() then
___________________

 

 


Edited by HC_Official

Click here for tutorials for using Virpil Hardware and Software

 

Click here for Virpil Flight equipment dimensions and pictures.

.

Link to comment
Share on other sites

On 12/12/2020 at 7:23 AM, HC_Official said:

first error is due to an extra slash in the file path , the double slash shown below

2020-12-12 00:22:54.076 ERROR   VFS: VFS_open_write: CreateFile(C:\Users\marks\Saved Games\DCS.openbeta_server\\EasyStats\stats\Kills\Prril.json): The system cannot find the path specified.

 

lord only knows what kill is causing this, it is a busy server with 25+ people on it, could be anything, but from checking last nights log it does look better, the nil check I put in seems to work

this is new

____________________

2020-12-12 00:47:24.377 INFO    Scripting: event:type=eject,t=48998.643,initiatorPilotName=ACE**88,initiatorMissionID=1953,
2020-12-12 00:47:24.377 INFO    Scripting: event:targetPilotName=ACE**88,type=kill,weapon=Mi-26,target=FA-18C_hornet,t=48998.643,initiatorMissionID=1000213,targetMissionID=1953,
2020-12-12 00:47:24.377 INFO    SCRIPTING: Error in SCHEDULER function:[string "D:\games\EasyStats.lua"]:180: attempt to index local 'PlayerUnit' (a nil value)
2020-12-12 00:47:24.377 INFO    SCRIPTING: stack traceback:
    [string "D:\games\3Develop_Moose_h.lua"]:8133: in function <[string "D:\games\3Develop_Moose_h.lua"]:8129>
    [string "D:\games\EasyStats.lua"]:180: in function 'EventFunction'
    [string "D:\games\3Develop_Moose_h.lua"]:8478: in function <[string "D:\games\3Develop_Moose_h.lua"]:8477>
    [C]: in function 'xpcall'
    [string "D:\games\3Develop_Moose_h.lua"]:8476: in function 'onEvent'
    [string "Scripts/World/EventHandlers.lua"]:13: in function <[string "Scripts/World/EventHandlers.lua"]:11>
2020-12-12 00:47:24.378 INFO    Scripting: event:amount=50,t=48998.643,type=score,initiatorMissionID=,

line 180 = if PlayerUnit:GetGroup():GetName() == player_unit:GetGroup():GetName() then
___________________

 

 

 

sent you a custom EasyStats.lua

Coming Soon...
The Fraternity Returns : https://thefraternitysim.com/
Link to comment
Share on other sites

  • 3 weeks later...

I'm seeing these errors quite often in my dcs.log and it looks to be this script as it's the only one where the line count matches:

 

1:39:03 PM.376  INFO  SCRIPTING  Error in SCHEDULER function:[string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis000034C4.lua"]:203: attempt to concatenate field 'target_name' (a nil value) 
1:39:03 PM.376  INFO  SCRIPTING  stack traceback: [string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis000040CA.lua"]:8063: in function <[string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis000040CA.lua"]:8059> [string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis000034C4.lua"]:203: in function 'EventFunction' [string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis000040CA.lua"]:8408: in function <[string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis000040CA.lua"]:8407> [C]: in function 'xpcall' [string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis000040CA.lua"]:8406: in function 'onEvent' [string "Scripts/World/EventHandlers.lua"]:13: in function <[string "Scripts/World/EventHandlers.lua"]:11> 

10:16:30 PM.115  INFO  SCRIPTING  Error in SCHEDULER function:[string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis000000F7.lua"]:182: attempt to index a nil value 
10:16:30 PM.115  INFO  SCRIPTING  stack traceback: [string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis00000D9A.lua"]:8063: in function <[string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis00000D9A.lua"]:8059> [string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis000000F7.lua"]:182: in function 'EventFunction' [string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis00000D9A.lua"]:8408: in function <[string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis00000D9A.lua"]:8407> [C]: in function 'xpcall' [string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis00000D9A.lua"]:8406: in function 'onEvent' [string "Scripts/World/EventHandlers.lua"]:13: in function <[string "Scripts/World/EventHandlers.lua"]:11> 


1:38:50 PM.644  INFO  SCRIPTING  Error in SCHEDULER function:[string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis000034C4.lua"]:203: attempt to concatenate field 'target_name' (a nil value) 
1:38:54 PM.140  INFO  SCRIPTING  Error in SCHEDULER function:[string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis000034C4.lua"]:203: attempt to concatenate field 'target_name' (a nil value) 
1:39:03 PM.376  INFO  SCRIPTING  Error in SCHEDULER function:[string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis000034C4.lua"]:203: attempt to concatenate field 'target_name' (a nil value) 
1:39:05 PM.317  INFO  SCRIPTING  Error in SCHEDULER function:[string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis000034C4.lua"]:203: attempt to concatenate field 'target_name' (a nil value) 
1:39:07 PM.267  INFO  SCRIPTING  Error in SCHEDULER function:[string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis000034C4.lua"]:203: attempt to concatenate field 'target_name' (a nil value) 
1:39:19 PM.707  INFO  SCRIPTING  Error in SCHEDULER function:[string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis000034C4.lua"]:203: attempt to concatenate field 'target_name' (a nil value) 
10:16:30 PM.115  INFO  SCRIPTING  Error in SCHEDULER function:[string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis000000F7.lua"]:182: attempt to index a nil value 
10:19:14 PM.472  INFO  SCRIPTING  Error in SCHEDULER function:[string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis000000F7.lua"]:182: attempt to index a nil value 
10:21:21 PM.637  INFO  SCRIPTING  Error in SCHEDULER function:[string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis000000F7.lua"]:182: attempt to index local 'PlayerUnit' (a nil value)

 

Link to comment
Share on other sites

  • 3 weeks later...

Just tested and version 1.2 works fine. However it seems not work when setting Skill "Client" and playing in a "Single Player" mission. Not sure if that is addressed before.

 

I would like to propose a few enhancement:

   Report Carrier Landings.

   Night (or low visibility landings, instrument landings)

 

Regards...


Edited by Wingthor

Moose framework contributor

Link to comment
Share on other sites

On 1/1/2021 at 6:33 AM, chevelle970 said:

I'm seeing these errors quite often in my dcs.log and it looks to be this script as it's the only one where the line count matches:

 


1:39:03 PM.376  INFO  SCRIPTING  Error in SCHEDULER function:[string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis000034C4.lua"]:203: attempt to concatenate field 'target_name' (a nil value) 
1:39:03 PM.376  INFO  SCRIPTING  stack traceback: [string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis000040CA.lua"]:8063: in function <[string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis000040CA.lua"]:8059> [string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis000034C4.lua"]:203: in function 'EventFunction' [string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis000040CA.lua"]:8408: in function <[string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis000040CA.lua"]:8407> [C]: in function 'xpcall' [string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis000040CA.lua"]:8406: in function 'onEvent' [string "Scripts/World/EventHandlers.lua"]:13: in function <[string "Scripts/World/EventHandlers.lua"]:11> 

10:16:30 PM.115  INFO  SCRIPTING  Error in SCHEDULER function:[string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis000000F7.lua"]:182: attempt to index a nil value 
10:16:30 PM.115  INFO  SCRIPTING  stack traceback: [string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis00000D9A.lua"]:8063: in function <[string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis00000D9A.lua"]:8059> [string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis000000F7.lua"]:182: in function 'EventFunction' [string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis00000D9A.lua"]:8408: in function <[string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis00000D9A.lua"]:8407> [C]: in function 'xpcall' [string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis00000D9A.lua"]:8406: in function 'onEvent' [string "Scripts/World/EventHandlers.lua"]:13: in function <[string "Scripts/World/EventHandlers.lua"]:11> 


1:38:50 PM.644  INFO  SCRIPTING  Error in SCHEDULER function:[string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis000034C4.lua"]:203: attempt to concatenate field 'target_name' (a nil value) 
1:38:54 PM.140  INFO  SCRIPTING  Error in SCHEDULER function:[string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis000034C4.lua"]:203: attempt to concatenate field 'target_name' (a nil value) 
1:39:03 PM.376  INFO  SCRIPTING  Error in SCHEDULER function:[string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis000034C4.lua"]:203: attempt to concatenate field 'target_name' (a nil value) 
1:39:05 PM.317  INFO  SCRIPTING  Error in SCHEDULER function:[string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis000034C4.lua"]:203: attempt to concatenate field 'target_name' (a nil value) 
1:39:07 PM.267  INFO  SCRIPTING  Error in SCHEDULER function:[string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis000034C4.lua"]:203: attempt to concatenate field 'target_name' (a nil value) 
1:39:19 PM.707  INFO  SCRIPTING  Error in SCHEDULER function:[string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis000034C4.lua"]:203: attempt to concatenate field 'target_name' (a nil value) 
10:16:30 PM.115  INFO  SCRIPTING  Error in SCHEDULER function:[string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis000000F7.lua"]:182: attempt to index a nil value 
10:19:14 PM.472  INFO  SCRIPTING  Error in SCHEDULER function:[string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis000000F7.lua"]:182: attempt to index a nil value 
10:21:21 PM.637  INFO  SCRIPTING  Error in SCHEDULER function:[string "C:\Users\xxxxxxx\AppData\Local\Temp\DCS.openbeta_server\/~mis000000F7.lua"]:182: attempt to index local 'PlayerUnit' (a nil value)

 

Happens when its an AI kill due to if 

PlayerGroup:GetName() == playerGroup:GetName() then

...
KillDataTable.target_name = EventData.TgtTypeName is never reached, and MESSAGE:New(KillDataTable.target_name.." destroyed",5):ToGroup(PlayerGroup) holds a nil value...

 

But putting

          --show kill message
          if ES_Settings.PilotKillNotification == true then
            MESSAGE:New(KillDataTable.target_name.." destroyed",5):ToGroup(PlayerGroup)
          end

inside the if PlayerGroup:GetName() == playerGroup:GetName() then clause seems to take away the error: So:

function EasyStatsEnemyGroup:OnEventKill(EventData)
      BASE:I("------------ Extracted EVENTS.Kill---------------\n" .. PVPCrashHandler.TableSerialization(EventData))
      KillDataTable = {}
      local PlayerUnit = EventData.IniUnit
      local PlayerGroup= EventData.IniGroup
      local TargetUnit = EventData.TgtDCSUnit
      if PlayerGroup:GetName() == playerGroup:GetName() then
        
          --data
          KillDataTable.player_name = playerName
          KillDataTable.player_module = PlayerUnit:GetTypeName()--player module used
          KillDataTable.player_coalition = EventData.IniCoalition
          if type(EventData.TgtTypeName) == "number" then
              KillDataTable.target_name = "Scenery Object"
            else
              KillDataTable.target_name = EventData.TgtTypeName
          end
          if KillDataTable.target_name == nil then
            KillDataTable.target_name = UNIT:FindByName(EventData.IniUnit.UnitName):GetTypeName()
          end

          KillDataTable.target_unit_name = EventData.TgtUnitName
          KillDataTable.target_coalition= EventData.TgtCoalition
          KillDataTable.timestamp = os.time(os.date("!*t"))
          
          EasyStats.LogKill(player_name,StatsFile,KillDataTable)
          
          --show kill message
          if ES_Settings.PilotKillNotification == true then
            MESSAGE:New(KillDataTable.target_name.." destroyed",5):ToGroup(PlayerGroup)
          end
          
        end
    end

 


Edited by Wingthor
A good one

Moose framework contributor

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...
On 12/9/2020 at 6:30 AM, ElementLT said:

Easy Stats - A simple solution to add player stats to any DCS Mission or Multiplayer Server

 

stats.png

 

EasyStats by Element
Brought to you by: The Fraternity
Current Version: 1.0.1
Released: 12-09-2020

 

Features

- Highly Customizable with knowledge of Lua and MOOSE Framework.
- Tracks Air 2 Air Kills, Air 2 Ground Kills, and even Scenery Obj kills 
- Easily add basic player stats to any mission or multiplayer server.
- Data is stored based on player name(see config section) or client multiplayer name for servers.
- Option to store data based in UID IF you can provide it.
- Data is stored in json files. 
- Pilots can use the F10 Menu to display real time stats within game.
- View last 10 kills within Mission
- JSON Data can be used in websites, discord bots, or even your own MOOSE code/scripts with the included function(s). 
 

REQUIREMENTS:
  - MOOSE
  - EasyStats.lua (included)
 

Current Data Logged:
  joinDate (unix timestamp)
  MostRecentModule

  last_visit (unix timestamp)
  visit_count
  kill_count, view last 10 kills within mission
  flight_time (in seconds)
  takeoffs 
  landings 
  ejections
  crashes
  deaths

_________________________

 

Easy Installation 
All Steps are REQUIRED
 
  1. Edit your MissionScripting.lua ("C:\Program Files\Eagle Dynamics\DCS World\Scripts") so EasyStats may create and save data.
     Comment out sanitizeModule('os'), sanitizeModule('io'), sanitizeModule('lfs'), and require
     It should look something like this...
    
    do
      --sanitizeModule('os')
      --sanitizeModule('io')
      --sanitizeModule('lfs')
      require = nil
      loadlib = nil
    end
    
    **make available these functions at your own risk.**
  
  2. Load Moose.lua then EasyStats.lua into your mission at MissionStart via the DCS Mission Editor or in your lua scripts
     (don't forget the edit user config section in EasyStats)

me_install.jpg
  
  And That's It! Enjoy the live stats! 

_________________________
Download Easy Stats




_________________________
Change Log / Updates

12-5-2020
- removed config option SinglePlayerPilotName as its irrelevant will use Name in Log Book
- added config option to display message/notification to pilot after every kill

12-9-2020
- now track static & Scenery Object kills

1-2-2021
- fixed a couple bugs

EasyStats ver 1.2.rar 990.69 kB · 53 downloads

 

Hello @ElementLT, is this still being developed/supported?  Does v1.2 have fixes for the issues raised above?

 

Thanks!  This looks really interesting.

Link to comment
Share on other sites

  • 2 years later...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...