Have you tried adding a scoreboard to detect whether he has the flag? Look at how to get and store player name? This time, attempt to /clear the flag.
I've answered a question looking to identify a player, and perform something at their death.
Long story short, follow the instructions to make the gate and to identify the players, but replace the
/clear command in the second step with:
/clear @p[score_playerID=1,score_playerID_min=1] minecraft:Wool 14 0
and the identifier with something else like... Say:
/scoreboard objectives create hasWool dummy hasWool
/scoreboard players set @p[score_playerID=1,score_playerID_min=1] hasWool 1
/scoreboard players set @p[score_playerID=1,score_playerID_min=1] hasWool 0
in order to identify whether someone has the flag or not. (This only works with
/gamerule keepinventory true.)
Next, when the player dies, simply do your command, since you know that they're dead, and they have the wool.
These commands all work, but the problem is: if the player is dead, they can't execute commands. You can't /execute as a player if the player is dead.
Let's say we'll use a Creeper to be the placeholder for the
Run the conditional flip-flop gates (outlined in that first answer), testing for
/testfor @a[score_h=0,hasWool_min=1] (looks for a player who's dead and had the wool.
When a player is dead and has the wool (condition sets to true), run
/tp @e[type=Creeper] @p[score_h=0,hasWool_min=1], make that creeper place the block
/execute @e[type=Creeper] ~ ~ ~ setblock ~ ~1 ~ wool 14 and teleport away
/tp @e[type=Creeper] 0 0 0.
The false condition is up to you; you can either make it teleport the creeper back (since it's already done when the true condition runs anyway)
Just make sure that command is executed before they are respawn (or gets teleported to the respawn point)
Note: You can't directly
@a as when you use
/clear @a minecraft:Wool 14 0, it'll output true to everyone, even if only one person has it, while
@p just gets messy. (You're detecting the closest player)