Promoveaza serverul

Fix: the ball can be kicked again

Browse Source
The touch hook was registered on the ball's custom class name, which Ham Sandwich cannot hook, so it failed at map start and players could not kick the ball. It now hooks info_target (what the ball is created as) and only reacts to the ball.
Daemon666 committed parent 5c3b6a124f commit ea2ad846c3810ad309e65fd4e96501822860ef6d
1 changed file with 4 additions and 2 deletions
+4 -2 addons/amxmodx/scripting/csb_soccerjam.sma M
@@ -48,7 +48,9 @@ public plugin_init()
48 48 g_pPower = register_cvar("csb_soccer_power", "3.5")
49 49 g_pGoalRadius = register_cvar("csb_soccer_goalradius", "120.0")
50 50
51 - RegisterHam(Ham_Touch, BALL_CLASS, "fwBallTouch")
51 + /* the ball is an info_target renamed to BALL_CLASS: Ham hooks need the
52 + real entity class, and the handler keeps only touches of the ball */
53 + RegisterHam(Ham_Touch, "info_target", "fwBallTouch")
52 54
53 55 g_iHudSync = CreateHudSyncObj()
54 56
@@ -162,7 +164,7 @@ resetBall()
162 164
163 165 public fwBallTouch(ball, other)
164 166 {
165 - if (!g_bReady || other < 1 || other > 32 || !is_user_alive(other))
167 + if (ball != g_iBall || !g_bReady || other < 1 || other > 32 || !is_user_alive(other))
166 168 return HAM_IGNORED
167 169
168 170 if (get_gametime() - g_fLastKick < 0.15)
169 171