public static void SendInvitationServer(int fromClient, Packet packet) { var id = packet.ReadInt(); var username = packet.ReadString(); //Who SENT THE INVITATION var toUserName = packet.ReadString(); // Who is THE INVITE FOR if (Dictionaries.dictionaries.PlayersByName.ContainsKey(toUserName)) { var sendToID = Dictionaries.dictionaries.PlayersByName[toUserName]; ServerSend.SendInvite(fromClient, username, toUserName, sendToID); } else { //The given user was not online ServerConsoleWriter.WriteUserLog(Dictionaries.dictionaries.PlayersById[fromClient], $"Tried to invite {toUserName} but this user was not online"); } }
private IEnumerator LoginStart(string user, string pass) { var form = new WWWForm(); form.AddField("user", user); form.AddField("pass", pass); var www = new WWW(Constants.SqlNameServer + "login.php", form); yield return(www); if (www.text[0] == '0' && !Dictionaries.dictionaries.PlayersByName.ContainsKey(user)) //AVOID THE SAME USER FROM LOGIN IN TWICE { //Allow Login Dictionaries.dictionaries.PlayersByName.Add(user, id); Dictionaries.dictionaries.PlayersById.Add(id, user); ServerSend.LoginResult(id, true, "noError", int.Parse(www.text.Split('\t')[1])); ServerConsoleWriter.WriteUserLog(user, $"New log started {user}"); Dictionaries.dictionaries.PlayerDataHolders.Add(id, new PlayerDataHolder(id, user)); } else { ServerSend.LoginResult(id, false, www.text, -9); } }