Sunucu tanitimi
csb-playtime-tracker / README.md
2 lines 1.5 KiB Markdown Source Rendered Raw Permalink History

CSB Playtime Tracker counts how long each SteamID has spent on your server. Time is accumulated in seconds, flushed to nVault once a minute and again on disconnect, so a crash loses at most 60 seconds. say /time shows a player their total hours and minutes; say /toptime shows a small ladder of the online players by time played.

The plugin also registers a native, csb_get_playtime(id), that returns a player's live total in seconds — VIP, rewards or rank plugins can call it to unlock perks after so many hours.

Features

  • Per-SteamID second-accurate accumulation, persisted in nVault.
  • One-minute periodic flush plus flush on disconnect and on map end.
  • say /time and say /toptime (top 5 of the online players).
  • csb_get_playtime(id) native for other plugins.

Using the native

native csb_get_playtime(id);
// hours = csb_get_playtime(id) / 3600;

Installation

  1. Enable the nvault module in addons/amxmodx/configs/modules.ini.
  2. Compile csb_playtime_tracker.sma, copy it to addons/amxmodx/plugins/ and add it to plugins.ini. Load it before any plugin that calls its native.
  3. Change the map. The vault file csb_playtime.vault appears in addons/amxmodx/data/vault/.