idk why it isn't working for you, but try this and see if it helps:
Code:
alias buildsent "sentrygun; wait; loc1; bind mouse3 detsent"
alias detsent "detdismantlesentry; wait; loc2; bind mouse3 buildsent"
alias loc1 "say_team building sentry at %sl"
alias loc2 "say_team sentry blown at %sl"
bind "mouse3" "buildsent"