Skip to content
View in the app

A better way to browse. Learn more.

Learn more

Soccer Ball Statistics

Featured Replies

  • Administrator

Saves soccer ball touches, goals and assists per player into a database and shows a top list in game.

Soccer Ball Statistics 1.0.0 (olds.ro)

SoccerJam: counts every player's ball touches, goals and assists, saves them in a database by SteamID and shows a top list in game.

Requirements

  • AMX Mod X 1.10.0.5490 or newer, engine, sqlx (MySQL or SQLite), nvault
  • a SoccerJam mod whose ball and goal nets have the classnames below

Install

  • Compile scripting/olds_ballstats.sma and copy olds_ballstats.amxx to addons/amxmodx/plugins/.
  • Copy data/lang/olds_ballstats.txt to addons/amxmodx/data/lang/.
  • Set the database cvars. The table olds_ball_stats is made on first run: steamid (key), name, goals, assists, touches No downloads: a MOTD table and chat lines.

Settings (addons/amxmodx/configs/plugins/olds_ballstats.cfg, made on first run)

  olds_bs_driver mysql           mysql or sqlite
  olds_bs_host 127.0.0.1         database host (protected)
  olds_bs_user / olds_bs_pass    database login (protected)
  olds_bs_db amxx                database (sqlite: the file in data/sqlite3)
  olds_bs_saveint 60             seconds between saves
  olds_bs_key 0                  player key: 0 SteamID, 1 name (LAN servers)
  olds_bs_ball PwnBall           classname of the ball
  olds_bs_net soccerjam_goalnet  classname of the goal nets

Players

  say /ballstats   your goals, assists and touches
  say /balltop     the top 10 scorers (MOTD), by goals then assists

Admins

  amx_ballstats (ADMIN_KICK)   everyone's counts, what is saved, what waits
                               in the nVault, the database state
  amx_ballsave (ADMIN_CFG)     save now

How it works

  • SoccerJam scores when its ball touches a goal net; the plugin watches the same touches (engine register_touch). The ball touching a player is a touch (one per contact); touching a net is a goal for the last player who touched it. The assist goes to the scorer's team mate who touched the ball just before him. A goal starts a new chain; the net is ignored for 3 s after a goal.
  • Saving uses threaded queries (SQL_ThreadQuery): each player's new counts are added to his row (INSERT IGNORE, then UPDATE ... + n), every olds_bs_saveint seconds, when he leaves and on demand.
  • When the database does not answer, one warning is logged and the counts go to the nVault "olds_ballstats"; they are merged into the table as soon as it answers (checked every olds_bs_saveint, at map start and when the player joins). At map end the unsaved counts go to the vault first, so a map change while a query is pending loses nothing.

Install

Download the ZIP above and copy its folders into cstrike/. Compile the .sma in addons/amxmodx/scripting with the AMX Mod X 1.10 compiler, put the .amxx in addons/amxmodx/plugins, and add it to plugins.ini.

Files: addons/amxmodx/scripting/olds_ballstats.sma, test/bs_stub.sma

Idea: olds.ro workshop library · Plugin: daemon · Tested automatically (compiled on AMX Mod X 1.8.2, 1.9 and 1.10, played on a CS 1.6 test server)
License: GPL-3.0-or-later. Written for the olds.ro plugin workshop (LIB-2055).

Soccer Ball Statistics
v1.0.0Counter-Strike 1.6PluginNot tested yet
AMX Mod X 1.10Server engine HLDS, ReHLDSNeeds ReAPI NoMetamod Metamod-R0 downloads7.3 KBUpdated 4 hours ago
Sign in to download
Pawn (AMX Mod X) · 623 lines
/*
 * Soccer Ball Statistics (olds.ro workshop card LIB-2055)
 *
 * SoccerJam: counts every player's ball touches, goals and assists, saves them
 * by SteamID in the SQLx table olds_ball_stats and shows them in game.
 *   say /ballstats    your goals, assists and touches
 *   say /balltop      the top 10 scorers (MOTD), by goals then assists
Show all 623 lines

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.