- Home /
i need a player list help please
heres my script i need it to check the player list to make sure that there is player listed before you can log in
#pragma strict
var playercount = 0;
var usernames : String = "";
var passwords : String = "";
var user : String = "";
var pass : String = "";
var create : boolean = false;
var home : boolean = true;
var playeradded : boolean = false;
var player = "";
var logged : boolean = false;
var playerlist = new Array();
function Update()
{
if(playeradded)
{
player = usernames + passwords;
}
}
function OnGUI()
{
if(home)
{
GUI.Box(Rect(0, 0, 100, 50), playercount.ToString());
if(GUI.Button(Rect(0, 50, 100, 50), "create"))
{
create = true;
home = false;
}
user = GUI.TextField(Rect(100, 0, 100, 25), user);
pass = GUI.TextField(Rect(100, 25, 100, 25), pass);
if(GUI.Button(Rect(100, 50, 100, 50), "log in"))
{
if(player == user + pass)
{
logged = true;
}
else
{
logged = false;
}
}
}
if(create)
{
usernames = GUI.TextField(Rect(0, 0, 100, 25), usernames);
passwords = GUI.TextField(Rect(0, 25, 100, 25), passwords);
if(GUI.Button(Rect(0, 50, 50, 50), "home"))
{
home = true;
create = false;
}
if(GUI.Button(Rect(50, 50, 50, 50), "create"))
{
playercount += 1;
playeradded = true;
home = true;
create = false;
}
}
}
Comment
Your answer
Follow this Question
Related Questions
Need some help with Array searching logic 1 Answer
Lists: Avoiding ArgumentOutOfRangeException: Argument is out of range errors 1 Answer
A node in a childnode? 1 Answer
unique list of 10 random numbers 4 Answers
How do I check for strings in an array to match up with the index of another array? 1 Answer