Hi! Here is a guide I made on how to put a password on your mac servers! (In JavaScript)
Why not whitelists?
Here are some benefits of using this over whitelists:
- If someone has multiple accounts (like one admin account, and one playing account), they can join!
- If you have a friend that does not play, if they download the game they can join your server (with the password)!
- I will add more to this eventually
Setting up the password
First, put this code in your welcome message:
(Make sure the code is enclosed in HTML script tags!)
var password = âpromptâ
while (password != âYourPassWordHereâ) {
password = window.prompt(âPassword?â)
}
Replace âYourPassWordHereâ with your password.
I forgot my password
How to recover your password:
- Go on your WingySam Mac Server Portal
- Navigate to the world where you forgot your password
- Look at the welcome message.
- Log back into your world!
Done with your password?
Here is how to keep your code, but make it inactive.
First, you have to âcomment outâ your code. Like this:
/*
var password = âpromptâ
while (password != âtestâ) {
password = window.prompt(âPassword?â)
}
*/
Notice how we put /* on the first line and */ on the last line. That is how you make a multi-line comment in JavaScript.
Well, youâre done! You learned how to set up and de-activate your password. Congratulations!
Note: While this will stop most people, note that it IS hackable!