Promuj serwer

Fix: flags can be picked up again

Browse Source
The touch hook was registered on the flag's custom class name, which Ham Sandwich cannot hook, so it failed at map start and flags could not be picked up. It now hooks info_target (what the flags are created as) and only reacts to the two flags.
Daemon666 committed parent 4560b50279 commit 08635e7dec7d502285cae26aad31a48da0646adc
1 changed file with 4 additions and 2 deletions
+4 -2 addons/amxmodx/scripting/csb_ctf.sma M
@@ -47,7 +47,9 @@ public plugin_init()
47 47
48 48 g_pEnabled = register_cvar("csb_ctf_enabled", "1")
49 49
50 - RegisterHam(Ham_Touch, FLAG_CLASS, "fwFlagTouch")
50 + /* flags are info_targets renamed to FLAG_CLASS: Ham hooks need the real
51 + entity class, and the handler keeps only touches of the two flags */
52 + RegisterHam(Ham_Touch, "info_target", "fwFlagTouch")
51 53 register_event("DeathMsg", "eventDeath", "a", "1>0")
52 54
53 55 g_iHudSync = CreateHudSyncObj()
@@ -144,7 +146,7 @@ public fwFlagTouch(flag, other)
144 146
145 147 new i = pev(flag, pev_iuser1)
146 148
147 - if (i < 0 || i > 1)
149 + if (i < 0 || i > 1 || flag != g_iFlagEnt[i])
148 150 return HAM_IGNORED
149 151
150 152 new team = get_user_team(other)
151 153