You check "id" (yourself), not the targeted player, which is "player" in this case. Basically you only need is_user_connected(player) and the flag check. You can't possibly aim a dead player, so you don't need is_user_alive and there's definitely no need to check if you are connected.