Annoying problem: I have a client and server, when the client logs onto the server it sends its name and if the name is new the server logs it to a list. After logsing the list that the element is created from is rest so it can be used again but the element gets deleted as well
import System.Collections.Generic;
#pragma strict
public static var ReadName : String = "";
public var Accounts : List.<Player> = new List.<Player>();
var EmptyAccount : Player;
function Start () {
}
function Update () {
if (Network.peerType == NetworkPeerType.Server) {
if (ReadName != "") {
var NewAccount = true;
for (var i : int; i < Accounts.Count; i++) {
Debug.Log(Accounts*);*
_ if (Accounts == ReadName) {_
* NewAccount = false;*
* }*
* }*
* if (NewAccount) {*
* Debug.Log(โNewAccountโ);*
* EmptyAccount.Username = ReadName;*
* Accounts.Add(EmptyAccount);*
* NewAccount = false;*
* }*
* ReadName = โโ;*
* EmptyAccount.Username = โโ;*
* }*
* }*
}
function BoucePlayer () {
}
function OnConnectedToServer () {
}
Player class information:
#pragma strict
public class Player {
//User referance variables
public var Username : String;
public var RankName : String;
public var Safe : boolean;
public var LookLockbool : boolean;
public var LookLock : int;
public var Combo : int;
var Invintory : ItemDirectory[];
}
Please help its a problem that is plaguing me!