ID:1351833
 
(See the best response by Danny Roe.)
Hi everyone,

I have always wanted to make my own game and so i found byond. I think for now mostly of the codings i learned but i dont know how i can get a logging system the way i want.

As the title already says i want people to create an account and then loggin to it by username and password, after that they have 3 slots to create or load their characters.

Could someone perhaps help me with this?
I already made a skin for it so it would be made so you type it in and click login and the system checks the username and password.

I really hope someone can explain to me with help of some code as example how i could do this or maybe show me the whole thing?

Greetings,
Dmasterzz (Programming apprentice :p)

Best response
3 Slot Save Demo
Password Login Demo

Found in the Developer Resources section of the website.
I'm not certain why you're choosing not to leverage the key system?
In response to DivineTraveller
One advantage is allowing players to load their character using any key. But I can only see this as being useful for people who regularly play using Guest keys from more than one computer.
Right, but one huge disadvantage to that is allowing the developer free reign over how those passwords exist and are stored. If the developer is using a database, hashing, salting, etc - fine. I suspect that won't often be the case, and that they'll be stored instead in plaintext. This can lead to "hacking" and other unsavory things.
In response to DivineTraveller
Right. I've never liked the idea of using a Username & Password Login System within a BYOND game because far too many people use the same password for many things. Someone gaining access to a players character on a game is one thing, but having access to their BYOND account, emails, social media or worse is something else entirely.

First i wanna say thank you for the two demos i managed to make it myself now.
Second i would agree that the developer could use the passwords, which i would never do but i havent thought of that so i put a little something in for the players to remind that they should use a different password then they use on byond or any other online website/programm.

Once again thank you both, your comments made me think alot about this.
Code:
/*
Login
*/

mob
Login()
winshow(src, "Main", 0)
winshow(src, "Create", 0)
winshow(src, "Start", 1)
var
username
password
lastx
lasty
lastz
proc
login_check(mob/M as mob)
var/username=winget(usr,"username","text")
if(!username)
winset(src,"Create.Info","text=\"You have to atleast type in the username..")
else
if(fexists("players/[username]/.sav"))
winset(src,"Create.Info","text=\"Username is already in use..")
else
var/password=winget(usr,"password","text")
usr.Save(src)
winset(src,"Create.Info","text=\"Your character [username] has been created!")

Save(mob/M as mob)
var/savefile/F=new("players/[M.username]/.sav")
F["lastx"]<<M.lastx
F["lasty"]<<M.lasty
F["lastz"]<<M.lastz
F["password"]<<M.password
Write(F)

Load(mob/M as mob)
var/savefile/F=new("players/[M.username]/.sav")
if(fexists("players/[username]/.sav"))
F["lastx"] >> M.lastx
F["lasty"] >> M.lasty
F["lastz"] >> M.lastz
F["password"] >> M.password
loc=locate(lastx,lasty,lastz)
M.Read(F)
del(F)
Logout()
usr.Save()
del(src)

mob/verb
CreateWindow()
set hidden=1
winshow(src, "Start", 0)
winshow(src, "Create", 1)
winset(src,"Create.Info","text=\"Its highly recommended to use a different password then you use on byond!")
Create()
set hidden=1
login_check()


Problem description:
I thought i got it but now i saw a little problem when i create a character it does say its created, but when i logout and then start the game again and try to create the same character it doesnt say its already in use it just creates it again.
Where did i put something wrong?

Still nobody around who can help me with this?
Does the file exist in the directory?
yes it does but it saves some null file
I think I may see the problem.

Your using local.username and local.password, then you are saving using mob.username, mob.password. You need to set mob.username so that you can use it in your save.
you should hash the passwords

http://puu.sh/48GHF.png