Your old client connection is called a ghost
If the network you're on uses nickserv, the standard format to get rid of a ghost is /msg nickserv ghost <nick> <password>
Replace <nick> with the nick that the ghosted connection is using, and <password> with the registered password for that nick.
This can't be done using an ON TEXT event, but can be scripted as an alias or using the ON INPUT event.
Personally, I prefer the alias option for something like this
alias ghost {
if !$1 { .echo -a Usage /ghost <nick> <password> }
else { .msg nickserv ghost $$1-2 }
}
To activate the alias, type /ghost