Garry's Mod

Garry's Mod

Not enough ratings
Total Statistics for New Custom Roles beta
   
Award
Favorite
Favorited
Unfavorite
Content Type: Addon
Addon Type: Server content
File Size
Posted
Updated
31.394 KB
28 Jun, 2021 @ 5:13am
19 Jul, 2021 @ 6:51pm
13 Change Notes ( view )

Subscribe to download
Total Statistics for New Custom Roles beta

In 1 collection by Squid Matty
Test Serv
164 items
Description
Note: This addon only works with trouble in terrorist town (TTT). However, this addon works with both native TTT and new Custom Roles for TTT.

Description
This addon aims to collect data about rounds of TTT and its players. The statistics can be viewed by pressing the button which is available when a player is dead, in spectator mode or at the end of the round.

Statistics include:
Each player's % win rate as each role
Number of times each player has played each role
Each players most successful traitor pairings
Server-wide average role win rates
Number of rounds each player has played
How often each player is the first person killed
How many innocents each player has killed as the detective
How many innocents each player has killed as an innocent
How much cumulative fall damage each player has taken

Stats are collected and stored in a .txt file serverside. The client can view these stats but can't change them.

Server console commands
ttt_totalstatistics_reset (clears all currently stored data)
ttt_totalstatistics_printplayerstats (prints the a debug view of everyone's current stats to the console)

DISCLAIMER
This does not work with the old version of Custom Roles at this time.

All credit for the original mod goes to Beans?

Based on: https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=2101272062

Source: https://github.com/squidserv/TTT_Total_Statistics_CR
5 Comments
Khattab 30 Jun, 2021 @ 5:08am 
Most likely because gmod is dead :CunningPepeRed:
Squid Matty  [author] 30 Jun, 2021 @ 4:54am 
@cdozhytb all of that was from the original code. Nothing you brought up was changed or added in this version and there haven't been any complaints or comments about that stuff on that version
Khattab 30 Jun, 2021 @ 2:09am 
If it's the code from that "based on" addon... I just don't want to subscribe to find out...
Khattab 30 Jun, 2021 @ 2:07am 
You should never send the whole table to the client (this is the DoS part). I suggest you to move your data to SQL and to only send stats of a specific player (the only one who requested them). Also implement some sort of caching mechanism or just never receive anything on server from client and send a net message on each round end - this part is also malicious in your current realization, because right now you immediately update your stats table which means that players can see whos killing counters are updated (ez traitor revealing strategy btw).
Khattab 30 Jun, 2021 @ 2:07am 
I don't see any reason why this should be an ENT, but it's not the main problem.
Unprotected unoptimized networking - you really shouldn't subscribe to this addon. Anyone can delete this statistics and anyone can easily DoS your server (two reasons to not only unsubscribe, but to report).
Equipment stats? Use server-side hooks and function only (because its server-side statistics). If you must use client-side - something is wrong with your realization. Literally anyone with injector can spam servers with nils or just random huge strings by your TotalStatistics_SendClientEquipmentName net message.