Exemplo n.º 1
0
 private static void OnPlayerDisconnect(Client client, DisconnectionType type, string reason)
 {
     if (readyClients.Contains(client))
     {
         readyClients.Remove(client);
     }
 }
Exemplo n.º 2
0
        private Task OnPlayerDisconnected(Client client, DisconnectionType disconnectionType, string reason)
        {
            var name = client.Name;

            Log("Removing driver {name}", args: name);

            return(Task.Run(() =>
            {
                //Get driver
                var driver = Drivers.FirstOrDefault(x => x.Client == client);
                if (driver != null)
                {
                    //Remove vehicles
                    foreach (var vehicle in driver.Vehicles)
                    {
                        driver.DeleteVehicle(vehicle);
                    }

                    //Remove driver
                    Drivers.Remove(driver);
                    Log("Removed vehicles for {name}", args: name);
                }
                else
                {
                    Log("Driver not found on disconnecting {name}", args: name);
                }
            }));
        }
Exemplo n.º 3
0
        public void OnPlayerDisconnected(Client player, DisconnectionType type, string reason)
        {
            Vector3 PlayerPos = NAPI.Entity.GetEntityPosition(player);
            float   posX      = PlayerPos.X;
            float   posY      = PlayerPos.Y;
            float   posZ      = PlayerPos.Z;
            //TO DO: GET PLAYER ID in proper way instead of login assign id to user on login
            string          user            = player.Name;
            MySql           newConnection   = new MySql();
            MySqlConnection mysqlConnection = newConnection.Initialize();
            MySqlCommand    command         = mysqlConnection.CreateCommand();

            newConnection.OpenConnection();

            command.CommandText = "SELECT * FROM accounts WHERE login = @username ";
            command.Parameters.AddWithValue("@username", user);
            MySqlDataReader reader2 = command.ExecuteReader();

            reader2.Read();
            int character1ID = reader2.GetInt32("character1");

            reader2.Close();
            command.CommandText = "UPDATE charac SET posX = @posX , posY = @posY, posZ = @posZ WHERE id = @id;";
            command.Parameters.AddWithValue("@id", character1ID);
            command.Parameters.AddWithValue("@posX", posX);
            command.Parameters.AddWithValue("@posY", posY);
            command.Parameters.AddWithValue("@posZ", posZ);
            command.ExecuteNonQuery();
            newConnection.CloseConnection();
        }
Exemplo n.º 4
0
 public static void OnPlayerDisconnected(Client player, DisconnectionType type, string reason)
 {
     if (spawnTimerList.TryGetValue(player.SocialClubName, out Timer spawnTimer) == true)
     {
         spawnTimer.Dispose();
         spawnTimerList.Remove(player.SocialClubName);
     }
 }
Exemplo n.º 5
0
 public static void OnPlayerDisconnected(Client player, DisconnectionType type, string reason)
 {
     if (garbageTimerList.TryGetValue(player.Value, out var garbageTimer))
     {
         garbageTimer.Dispose();
         garbageTimerList.Remove(player.Value);
     }
 }
 /// <inheritdoc />
 public DisconnectionInfo(DisconnectionType type, WebSocketCloseStatus?closeStatus,
                          string closeStatusDescription, string subProtocol, Exception exception)
 {
     Type                   = type;
     CloseStatus            = closeStatus;
     CloseStatusDescription = closeStatusDescription;
     SubProtocol            = subProtocol;
     Exception              = exception;
 }
Exemplo n.º 7
0
 public static void OnPlayerDisconnected(Client player, DisconnectionType type, string reason)
 {
     // Deleting player's attached label
     if (NAPI.Data.HasEntityData(player, EntityData.PLAYER_AME) == true)
     {
         TextLabel label = NAPI.Data.GetEntityData(player, EntityData.PLAYER_AME);
         NAPI.Entity.DetachEntity(label);
         NAPI.Entity.DeleteEntity(label);
     }
 }
Exemplo n.º 8
0
 public void OnPlayerDisconnect(Player player, DisconnectionType type, string reason)
 {
     try
     {
         if (PlayerList.Any(x => x.Value.Handle.Value == player.Handle.Value))
         {
             PlayerList[PlayerList.First(x => x.Value.Handle.Value == player.Handle.Value).Key] = null;
         }
     }
     catch { }
 }
Exemplo n.º 9
0
        public void Disconnect(Client player, DisconnectionType type, string reason)
        {
            NAPI.Util.ConsoleOutput($"{player.Name} hat den Server verlassen.");
            if (!player.HasData("User"))
            {
                return;
            }
            AccountModel acc = player.GetData("User");

            acc.Save();
        }
 public LdpDisconnectRequest SetDisconnectRequest(DisconnectionType type)
 {
     var response = LdpDisconnectRequest.CreateBuilder();
     response.Type = type;
     return response.Build();
 }