示例#1
0
 public static void CMD_ListPlayers(OwnPlayer player)
 {
     foreach (OwnPlayer target in Alt.GetAllPlayers())
     {
         player.SendChatMessage(target.DisplayName);
     }
 }
示例#2
0
 public static void CMD_getParkedCars(OwnPlayer player)
 {
     foreach (OwnVehicle target in parkedCars)
     {
         player.SendChatMessage(target.Model.ToString());
     }
 }
示例#3
0
        public static void CMD_CreateVehicle(OwnPlayer player, string vehName, int r = 0, int g = 0, int b = 0)
        {
            uint vehHash = Alt.Hash(vehName);

            if (!Enum.IsDefined(typeof(VehicleModel), vehHash) && !Enum.IsDefined(typeof(ModCars), vehHash))
            {
                player.SendChatMessage("[Server] Ungültiger Fahrzeugname!");
                return;
            }

            OwnVehicle veh;

            if (player.HasData("ProjectHome_001:vehicle"))
            {
                player.GetData("ProjectHome_001:vehicle", out veh);
                // veh.Remove();    //vorerst entfernt
            }

            //IVehicle veh = Alt.CreateVehicle(vehHash, GetRandomPositionAround(player.Position, 5.0f), player.Rotation);
            veh = new OwnVehicle(vehHash, GetRandomPositionAround(player.Position, 5.0f), player.Rotation);
            veh.PrimaryColorRgb   = new Rgba(Convert.ToByte(r), Convert.ToByte(g), Convert.ToByte(b), 255);
            veh.SecondaryColorRgb = new Rgba(Convert.ToByte(r), Convert.ToByte(g), Convert.ToByte(b), 255);

            player.SetData("ProjectHome_001:vehicle", veh);

            veh.License = veh.Model.ToString() + veh.Id.ToString(); //nur testweise
            veh.Owner   = player.DisplayName;

            player.SendChatMessage(vehName + " wurde gespawnt! Kennzeichen: " + veh.License);
        }
示例#4
0
        public static void LoadPlayer(OwnPlayer player)
        {
            try
            {
                MySqlConnection connection = OwnDatabase.DB.GetConnection();
                connection.Open();

                MySqlCommand command = connection.CreateCommand();
                command.CommandText = "SELECT * FROM users WHERE name=@name LIMIT 1";

                command.Parameters.AddWithValue("@name", player.DisplayName);

                using (MySqlDataReader reader = command.ExecuteReader())
                {
                    if (reader.HasRows)
                    {
                        reader.Read();
                        player.Db_Id = reader.GetInt16("id");
                        player.Cash  = reader.GetUInt32("cash");
                    }
                }

                connection.Close();
            }
            catch (Exception e)
            {
                Alt.Log("LoadPlayer: " + e.StackTrace);
                Alt.Log("LoadPlayer: " + e.Message);
            }
        }
示例#5
0
 public static void CMD_GoThere(OwnPlayer player, string name)
 {
     foreach (OwnPlayer target in Alt.GetAllPlayers())
     {
         if (name == target.DisplayName)
         {
             player.SetPosition(target.GetPosition());
         }
     }
 }
示例#6
0
 public static void CMD_KickPlayer(OwnPlayer player, string name)
 {
     foreach (OwnPlayer target in Alt.GetAllPlayers())
     {
         if (name == target.DisplayName)
         {
             target.Kick("Deine Verbindung wurde getrennt");
         }
     }
 }
示例#7
0
        public static void CMD_FixVeh(OwnPlayer player)
        {
            if (!player.IsInVehicle || player.Seat != 1)
            {
                return;
            }
            OwnVehicle veh = (OwnVehicle)player.Vehicle;

            veh.Repair();
        }
示例#8
0
        public static void CMD_Engine(OwnPlayer player)
        {
            if (!player.IsInVehicle || player.Seat != 1)
            {
                return;
            }
            OwnVehicle veh = (OwnVehicle)player.Vehicle;

            veh.ToggleEngine();
        }
示例#9
0
        public static void CMD_getLicense(OwnPlayer player)
        {
            if (!player.IsInVehicle || player.Seat != 1)
            {
                return;
            }
            OwnVehicle veh = (OwnVehicle)player.Vehicle;

            player.SendChatMessage(veh.License);
        }
示例#10
0
        [Command("togglesiren")] //aktiviert/deaktiviert nur die Sirene ganz normal, wo ist der Sound?
        public static void CMD_ToggleSiren(OwnPlayer player)
        {
            if (!player.IsInVehicle || player.Seat != 1)
            {
                return;
            }

            OwnVehicle veh = (OwnVehicle)player.Vehicle;

            veh.SirenActive = !veh.SirenActive;
        }
示例#11
0
        public void OnChatMessage(OwnPlayer player, string msg)
        {
            if (msg.Length == 0 || msg[0] == '/')
            {
                return;
            }

            foreach (OwnPlayer target in Alt.GetAllPlayers())
            {
                target.SendChatMessage($"{player.DisplayName} sagt: {msg}");
            }
        }
示例#12
0
 public static void CMD_GetOwner(OwnPlayer player, string license)
 {
     foreach (OwnVehicle target in Alt.GetAllVehicles())
     {
         if (target.License == license)
         {
             player.SendChatMessage("Der Besitzer ist: " + target.Owner);
             return;
         }
         player.SendChatMessage("kein Fahrzeug mit diesem Kennzeichen");
     }
 }
示例#13
0
 public static void OnPlayerDead(OwnPlayer player, IEntity killer, uint weapon)
 {
     if ((killer is OwnPlayer killerPlayer))
     {
         if (killerPlayer == player)
         {
             player.SendChatMessage("Du hast dich selbst ermordet!");
         }
         else
         {
             killerPlayer.SendChatMessage("Du hast " + player.Name + " getötet!");
             player.SendChatMessage(killerPlayer?.Name + " hat dich umgebracht!");
         }
     }
示例#14
0
 [Command("ausparken")] //test
 public static void CMD_ausparken(OwnPlayer player, string license)
 {
     foreach (OwnVehicle target in parkedCars)
     {
         if (target.License == license)
         {
             OwnVehicle veh = new OwnVehicle(target.Model, GetRandomPositionAround(player.Position, 5.0f), player.Rotation);
             parkedCars.Remove(target);
             player.SendChatMessage("Fahrzeug wurde ausgeparkt");
             return;
         }
     }
     player.SendChatMessage("kein Fahrzeug mit diesem Kennzeichen eingeparkt");
 }
示例#15
0
        // TODO: Implementation
        public OwnPlayer GetOwnPlayer()
        {
            try
            {
                var ownPlayer = new OwnPlayer {
                    Name = _stepExecutionService.Execute <string>("GetPlayerName")
                };
                _stepExecutionService.Execute("ClickPlayerInformationButton");
                var villageRows = (IEnumerable <ProfileVillageRow>)_stepExecutionService.Execute("GetVillageRows");
                if (villageRows.Count() == 1)
                {
                    var x = new OwnVillage {
                    };
                }
                else
                {
                }

                throw new NotImplementedException();

                return(ownPlayer);
            }
            catch (BotCheckException bce)
            {
                _featureLoggingService.LogBotCheck(MethodBase.GetCurrentMethod().Name, bce.CurrentStep);
                throw;
            }
            catch (Exception e)
            {
                string errorMessage  = string.Empty;
                bool   plemionaError = false;

                if (_stepExecutionService.Execute <bool>("IsErrorMessagePresent"))
                {
                    plemionaError = true;
                    errorMessage  = _stepExecutionService.Execute <string>("GetErrorMessage");
                }
                else
                {
                    errorMessage = e.Message;
                    _featureLoggingService.LogException(e, MethodBase.GetCurrentMethod().Name);
                }

                TryToReturnToVillageView();

                throw new FeatureException(plemionaError, errorMessage);
            }
        }
示例#16
0
        [Command("doorstight")] //Türen verriegelbar
        public static void CMD_Doortight(OwnPlayer player)
        {
            if (!player.IsInVehicle || player.Seat != 1)
            {
                return;
            }

            OwnVehicle veh = (OwnVehicle)player.Vehicle;

            veh.SetDoorState(0, 0); // 0 = Fahrertür //!Convert.ToByte(g)!
            veh.SetDoorState(1, 0); // 1= Beifahrertür
            veh.SetDoorState(2, 0); // Türen hinten vsl. links
            veh.SetDoorState(3, 0); // Türen hinten vsl. rechts
            veh.SetDoorState(4, 0); // evtl. Motorhaube
            veh.SetDoorState(5, 0); // evtl. Kofferraum
        }
示例#17
0
        [Command("doorswide")] //Türen nicht verriegelbar
        public static void CMD_DoorWide(OwnPlayer player)
        {
            if (!player.IsInVehicle || player.Seat != 1)
            {
                return;
            }

            OwnVehicle veh = (OwnVehicle)player.Vehicle;

            veh.SetDoorState(0, 1); // 0 = Fahrertür
            veh.SetDoorState(1, 1); // 1= Beifahrertür
            veh.SetDoorState(2, 1); // Türen hinten vsl. links
            veh.SetDoorState(3, 1); // Türen hinten vsl. rechts
            veh.SetDoorState(4, 1); // evtl. Motorhaube
            veh.SetDoorState(5, 1); // evtl. Kofferraum
        }
示例#18
0
        public static void CMD_RemoveVehicle(OwnPlayer player, string vehName)
        {
            uint vehHash = Alt.Hash(vehName);

            foreach (OwnVehicle target in Alt.GetAllVehicles())
            {
                if (player.Position.Distance(target.Position) <= 5 && target.Model == vehHash)
                {
                    //parkedCars.Add(new OwnVehicle(target.Model, target.Position, target.Rotation , target.FuelType)); //speichere eine Kopie des Fahrzeugs, spawned direkt ein neues Fahrzeug
                    player.SendNotification("Fahrzeug wurde eingeparkt"); //funktioniert nur bei manchen
                    target.Remove();
                    return;
                }
            }
            player.SendChatMessage("kein Fahrzeug mit diesem Kennzeichen eingeparkt");
        }
示例#19
0
 public static void CMD_CommandList(OwnPlayer player)
 {
     player.SendChatMessage("/veh [1-255] [1-255] [1-255] = Fahrzeugspawn.");
     player.SendChatMessage("/pos = Zeigt deine aktuellen Koordinaten.");
     player.SendChatMessage("/go [x] [y] [z] = Spawnt dich zu den eingegebenen Koordinaten.");
     player.SendChatMessage("/engine oder Tastendruck [M] = Motor anschalten/ausschalten.");
     player.SendChatMessage("/fixveh = Fahrzeugreperatur.");
     player.SendChatMessage("/player = Liste aller Spieler die sich auf dem Server befinden.");
     player.SendChatMessage("/team [1-4] = Hier kannst du eines von 4 Teams wählen.");
     player.SendChatMessage("/SCiD = Hier kannst du dir deine Social-Club ID anzeigen lassen.");
     player.SendChatMessage("/remveh [Bsp.FBI2] = entfernt Fahrzeug innerhalb von 5 Metern.");
     player.SendChatMessage("/doorlock verschließt Türen von innen");
     player.SendChatMessage("/doorunlock öffnet Türen von innen");
     player.SendChatMessage("/getHere [Name] portet Spieler XY zu mir");
     player.SendChatMessage("/goThere [Name] portet mich zum Spieler XY");
     player.SendChatMessage("/kick [Name] kickt den Spieler XY");
 }
示例#20
0
        [Command("doorunlock")] //schließt das nächste Fahrzeuge auf
        public static void CMD_DoorUnlock(OwnPlayer player)
        {
            float      dist = 99;
            OwnVehicle tmp  = null;

            foreach (OwnVehicle target in Alt.GetAllVehicles())
            {
                if (player.Position.Distance(target.Position) < dist)
                {
                    dist = player.Position.Distance(target.Position);
                    tmp  = target;
                }
                target.LockState = VehicleLockState.Unlocked;
            }
            if (tmp == null)
            {
                player.SendChatMessage("kein Fahrzeug in deiner Nähe");
            }
        }
示例#21
0
        public static void UpdatePlayer(OwnPlayer player)
        {
            try
            {
                MySqlConnection connection = OwnDatabase.DB.GetConnection();
                connection.Open();

                MySqlCommand command = connection.CreateCommand();
                command.CommandText = "UPDATE users SET name=@name, cash=@cash WHERE id=@id";

                command.Parameters.AddWithValue("@id", player.Db_Id);
                command.Parameters.AddWithValue("@name", player.DisplayName);
                command.Parameters.AddWithValue("@cash", player.Cash);

                command.ExecuteNonQuery();
                connection.Close();
            }
            catch (Exception e)
            {
                Alt.Log("UpdatePlayer: " + e.StackTrace);
                Alt.Log("UpdatePlayer: " + e.Message);
            }
        }
示例#22
0
 public void OnCommandNotFound(OwnPlayer player, string cmd)
 {
     player.SendChatMessage("{FF0000}[Server] {FFFFFF}Befehl konnte nicht gefunden werden!");
 }
示例#23
0
 public static void CMD_NoClipStop(OwnPlayer player)
 {
     player.Emit("noclip:stop");
 }
示例#24
0
 public static void CMD_ToggleRagdoll(OwnPlayer player)
 {
     player.IsInRagdoll = !player.IsInRagdoll;
 }
示例#25
0
 public static void CMD_SetWeather(OwnPlayer player, WeatherType weather)
 {
     player.SetWeather(weather);
 }
示例#26
0
 public static void CMD_SocialClubId(OwnPlayer player)
 {
     player.SendChatMessage(player.SocialClubId.ToString());
 }
示例#27
0
 public static void CMD_GoToPos(OwnPlayer player, float x, float y, float z)
 {
     player.SetPosition(x, y, z);
 }
示例#28
0
 public static void CMD_LocateMyPos(OwnPlayer player)
 {
     player.SendChatMessage(player.GetPosition().X.ToString() + " // " + player.GetPosition().Y.ToString() + " // " + player.GetPosition().Z.ToString());
 }
示例#29
0
 public static void CMD_Team(OwnPlayer player, int team)
 {
     player.SetTeam(team);
 }
示例#30
0
 [Command("getSpeed")] //wirft immer 0 zurück, selbst im freien Fall
 public static void CMD_GetSpeed(OwnPlayer player)
 {
     player.SendChatMessage(player.MoveSpeed.ToString());
 }