The "long code" is the server's ip address. It should look something like 81.169.171.13:33333
The server name just tells with server it is.
If they tell you the IP you just open the console (hit ยง) and type "connect <IP>", which would be for example "Connect 81.169.171.13:33333"
If they tell you the server's name, you open main menu and look for the server in the server list.
When you are connecting, you have to enter the password. Simply type "Password <password>" in the console. That could be for example "Password match"
Also, the second thing you said is called SPAMMING. Please, don't do it. Anyway, people do it by binding keys.
Bind <key> <command>