Added function onTarget(cid, target)

First time using git, also new to C++.