Snowball Catch 1.0.0 (olds.ro)
==============================
An add-on for Snow Wars game modes. A player who presses USE just as a
snowball reaches them from the front catches it instead of being hit, and
the ball goes into their own supply. The window is short (0.2 seconds by
default) and there is a cooldown after each catch, so catching rewards skill
without making anyone safe from every throw. A catch plays the stock pickup
sound and shows "Caught!" in chat.
Requirements
- ReGameDLL_CS, Metamod-r and ReAPI
- AMX Mod X 1.10 or newer with the hamsandwich module (it ships with
AMX Mod X)
- A Snow Wars core (the game mode plugin) that:
* throws snowballs as info_target entities with one classname
(olds_catch_class, "snowball" by default),
* hits players in the snowball's own touch function (for example ReAPI
SetTouch or a Ham_Touch hook), and
* provides this native, which adds snowballs to a player's supply:
native olds_snow_give(id, amount);
A core with a different give native needs a one-line wrapper registered
in the core's plugin_natives() under this name. Without such a core the
plugin still loads, logs one line and changes nothing.
- Tested on ReGameDLL_CS 5.30.0.814, ReAPI 5.29.0.358 and AMX Mod X
1.10.0.5490
Install
1. Compile scripting/olds_snowcatch.sma with amxxpc 1.10 and copy
olds_snowcatch.amxx to addons/amxmodx/plugins/. The compiler needs
ReAPI's include files (reapi.inc and reapi_*.inc) in
addons/amxmodx/scripting/include/.
2. Copy data/lang/olds_snowcatch.txt to addons/amxmodx/data/lang/.
3. Copy configs/plugins/olds_snowcatch.cfg to addons/amxmodx/configs/plugins/.
4. Add olds_snowcatch.amxx to addons/amxmodx/configs/plugins.ini.
How a catch works
- The press: the USE key (E), or the console command olds_catch for
players who bind it to another key (bind mouse3 olds_catch).
- The ball must touch the player at most olds_catch_window seconds after
the press, come from within olds_catch_angle degrees of the middle of the
player's view, and the player's last catch must be at least olds_catch_cd
seconds ago. A player never catches their own ball.
- A caught ball is removed before it can hit, and the player gets one
snowball through olds_snow_give.
Settings (addons/amxmodx/configs/plugins/olds_snowcatch.cfg)
olds_catch_enable 1 1 = on, 0 = off
olds_catch_class "snowball" classname of the core's snowball entities
olds_catch_window 0.2 seconds a press stays good for (0.05 - 2)
olds_catch_cd 2.0 seconds between two catches of a player (0 - 30)
olds_catch_angle 60 degrees to each side of the view a caught
ball can come from (10 - 180)
Commands
olds_catch (client console) counts as a USE press
olds_catch_status (server console) each player's catches since they
joined, and the settings in use
Files
The catch sound is the stock items/gunpickup2.wav, so nothing is
downloaded. Texts are in data/lang/olds_snowcatch.txt (English).
Credits and licence
Written from scratch by alexit (olds.ro workshop) for workshop card
IDEA-E12DDC50F6CA3427.
Licence: GPL-3.0-or-later.