inGameUI event handlers are pretty much the last EHs which are still not stackable. Since they are now actually useful with the new parameters added in A3 v1.49, let's solve this problem once and for all:
_id = inGameUIAddEventHandler ["Action", { code }];
inGameUIRemoveEventHandler ["Action", _id];
inGameUIRemoveAllEventHandlers "Action";