Forward Pass Throw 1.0.0 (olds.ro)
==================================
American Football add-on. The ball carrier holds +attack2 to charge a throw and
releases it to throw the ball along his crosshair.
- a teammate who touches the ball in flight catches it: a completed pass,
reported in chat with the distance in units;
- an opponent who touches it first intercepts it and becomes the carrier;
- a ball that hits the ground untouched is an incomplete pass and stays
loose for the core to handle.
Each possession allows one forward pass; it resets when the ball changes sides.
Requirements
- AMX Mod X 1.10.0.5490 or newer, with ReAPI (ReGameDLL_CS)
- the American Football core (library "olds_afootball"), with the natives
and the forward below; without it the plugin loads and stays idle
Install
1. Compile scripting/olds_pass.sma (scripting/include/olds_afootball.inc
next to it) and copy olds_pass.amxx to addons/amxmodx/plugins/.
2. Copy data/lang/olds_pass.txt to addons/amxmodx/data/lang/.
No downloads: the ball model belongs to the core; the charge shows with the
stock progress bar and the throw plays the stock
sound/weapons/knife_slash1.wav.
Settings (addons/amxmodx/configs/plugins/olds_pass.cfg, made on first run)
olds_pass_enable 1 forward passes on/off
olds_pass_min 400 throw speed with no charge
olds_pass_max 900 throw speed at full charge
olds_pass_charge 1.5 seconds of +attack2 for a full charge
olds_pass_cooldown 1.0 seconds between two throws of one player
Players
hold +attack2, release charge and throw (carrier only)
say /passes per player: completed/attempts, incomplete,
interceptions made (this map)
What the core provides (include/olds_afootball.inc)
olds_af_get_carrier() the carrier, 0 = nobody
olds_af_drop_ball() detaches the ball from the carrier and returns it
olds_af_set_carrier(id) gives the ball to a player (a catch)
forward olds_af_ball_pickup(id, ball) asked before a pick-up (ET_STOP);
the plugin refuses pick-ups while a pass is in the air
How it works
- RG_CBasePlayer_PreThink reads how long the carrier holds +attack2; on
release the speed is olds_pass_min..olds_pass_max by the hold time (full at
olds_pass_charge). The ball gets MOVETYPE_TOSS, a solid box (the thrower
does not collide with it) and velocity = aim vector * speed.
- A touch hook, active only while a pass is in the air, decides: a player
(not the thrower) catches or intercepts; the world or a solid brush ends
the pass as incomplete (triggers are ignored). A pass that touches nothing
for 6 seconds also ends as incomplete. The ball's solid type is then
restored for the core.
- Possession is the carrier's team; when it changes the pass is available
again. A round restart (RG_CSGameRules_RestartRound) resets it.
- Statistics are kept per player (SteamID; bots and LAN ids by name) for the
map.