View Single Post
Author Message
almostagreatcoder
Member
Join Date: Oct 2015
Old 09-13-2016 , 15:13   [ANY] Simple Player Counter 0.5.3 (2016-09-13)
Reply With Quote #1

Simple Player Counter

This is a simple plugin serving a very specific purpose: it keeps track of the players that are currently playing on a server by maintaining zero to three files, located in the game's root folder:
  • numberofplayers.txt -> you will find the number of currently connected clients here
  • listofplayers.txt -> holds a list of all players currently connected
  • idlenow.txt -> indicates when no one is connected

Why would you need that? Well - you don't necessarily, I think. For me, I was looking for a simple way to check my server's activity by just logging in via SSH and looking into some files (so you don't have to start the game itself). I also use the idlenow.txt file to automatically update the server when no one is connected.

Maybe there are other, even more simple ways to check how many clients are connected (and that can also be used in an automatic update script running periodically)? I don't really know, to be honest. But for me this was kind of fun to write my first SourceMod plugin, so here we are!

CVars
  • sm_spc_version -> the plugin's version, obviously...
  • sm_spc_countplayersfile -> File name for keeping track of the number of connected players. If set to "", the file will not be generated
  • sm_spc_listplayersfile -> File name for generating the list of players. Again: "" means no file.
  • sm_spc_idlefile -> File name for indicating when the server has no players. "" = no such file.

Installation

Plain & easy: put the simpleplayercounter.smx into your SourceMod config folder and Bob's your uncle. If you want to rename or disable one or more of the files described above, just edit the file .../cfg/sourcemod/plugin.simpleplayercounter.cfg (after having loaded the plugin at least once).

Download

You will always find the most recent version on GitHub!
https://github.com/almostagreatcoder...player_counter
Attached Files
File Type: smx simpleplayercounter.smx (5.6 KB, 294 views)
File Type: sp Get Plugin or Get Source (simpleplayercounter.sp - 715 views - 4.6 KB)

Last edited by almostagreatcoder; 09-15-2016 at 08:46. Reason: ...
almostagreatcoder is offline