Page 1 of 1

how do you make a passworded game

PostPosted: Thu Feb 01, 2007 10:51 pm
by Kooldudese
how do you make a game with a username and password thing, where when you type a conbination of username and password it would work when you press login but if its not a real combination of the two than it would not work?

PostPosted: Fri Feb 02, 2007 2:52 pm
by Troodon
I don't know how to do this, but you should save a variable to the username and password and then check if it's correct when clicking login. I'm not however good with text variables.

PostPosted: Sat Feb 03, 2007 4:01 pm
by Sgt. Sparky
make a text actor and allow input, add for the draw actor event of a read actor this script:
Code: Select all
strcpy(text , Reader.text);

or somhing like that and for the draw actor event have
Code: Select all
strcpy(text , Password);
if(password == a953)Level = 2;
that should work but if it does not just change it aroung a bit till you like it :D

PostPosted: Sat Feb 03, 2007 5:31 pm
by Sgt. Sparky
I will make a Demo :D

PostPosted: Sat Feb 03, 2007 7:34 pm
by Troodon
I think I got the idea, but thanks. :D

PostPosted: Sat Feb 03, 2007 8:06 pm
by Sgt. Sparky
okay, But I am making the login thingie for everyone to use as a base for a multiplayer Game :D

PostPosted: Sun Feb 04, 2007 3:03 am
by Sgt. Sparky
well here is the code if you want it:
Code: Select all
if (strcmp(LoginName.text, Name) == 0 && strcmp(LoginPass.text, Pass) == 0)
{
 SendActivationEvent("Work");
 Accepted = 1;
}
if (strcmp(LoginName.text, Name) > 0 , strcmp(LoginPass.text, Pass) > 0)
{
 strcpy(Work.text, "Denied,\nwrong username or password");
 Accepted = 0;
}
if (Accepted == 0)PlaySound2("data/buuuuh!.wav", 0.622222, 1, 0.000000);
if (Accepted == 1)PlaySound2("data/explode2.wav", 1.000000, 1, 0.000000);
Work.transp = 0;
allthough you do need to make a var called accepted :D
and here is code for the actors that set the vars(name and password)
Code: Select all
if (Set == 1)
{
 strcpy(Name, text);
 saveVars("Name", "MyNameAndPassword");
 strcpy(Pass, text);
 saveVars("Pass", "MyNameAndPassword");
}

PostPosted: Sun Feb 04, 2007 1:32 pm
by makslane
If Name is a string, remove the & :

Code: Select all
strcpy(Name, text);

PostPosted: Sun Feb 04, 2007 2:50 pm
by Sgt. Sparky
okay! :D