Fix: flags can be picked up again
Browse SourceThe 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.
1 changed file
with 4 additions and 2 deletions
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 |









