public static void CMD_ListPlayers(OwnPlayer player) { foreach (OwnPlayer target in Alt.GetAllPlayers()) { player.SendChatMessage(target.DisplayName); } }
public static void CMD_getParkedCars(OwnPlayer player) { foreach (OwnVehicle target in parkedCars) { player.SendChatMessage(target.Model.ToString()); } }
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); }
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); } }
public static void CMD_GoThere(OwnPlayer player, string name) { foreach (OwnPlayer target in Alt.GetAllPlayers()) { if (name == target.DisplayName) { player.SetPosition(target.GetPosition()); } } }
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"); } } }
public static void CMD_FixVeh(OwnPlayer player) { if (!player.IsInVehicle || player.Seat != 1) { return; } OwnVehicle veh = (OwnVehicle)player.Vehicle; veh.Repair(); }
public static void CMD_Engine(OwnPlayer player) { if (!player.IsInVehicle || player.Seat != 1) { return; } OwnVehicle veh = (OwnVehicle)player.Vehicle; veh.ToggleEngine(); }
public static void CMD_getLicense(OwnPlayer player) { if (!player.IsInVehicle || player.Seat != 1) { return; } OwnVehicle veh = (OwnVehicle)player.Vehicle; player.SendChatMessage(veh.License); }
[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; }
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}"); } }
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"); } }
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!"); } }
[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"); }
// 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); } }
[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 }
[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 }
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"); }
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"); }
[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"); } }
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); } }
public void OnCommandNotFound(OwnPlayer player, string cmd) { player.SendChatMessage("{FF0000}[Server] {FFFFFF}Befehl konnte nicht gefunden werden!"); }
public static void CMD_NoClipStop(OwnPlayer player) { player.Emit("noclip:stop"); }
public static void CMD_ToggleRagdoll(OwnPlayer player) { player.IsInRagdoll = !player.IsInRagdoll; }
public static void CMD_SetWeather(OwnPlayer player, WeatherType weather) { player.SetWeather(weather); }
public static void CMD_SocialClubId(OwnPlayer player) { player.SendChatMessage(player.SocialClubId.ToString()); }
public static void CMD_GoToPos(OwnPlayer player, float x, float y, float z) { player.SetPosition(x, y, z); }
public static void CMD_LocateMyPos(OwnPlayer player) { player.SendChatMessage(player.GetPosition().X.ToString() + " // " + player.GetPosition().Y.ToString() + " // " + player.GetPosition().Z.ToString()); }
public static void CMD_Team(OwnPlayer player, int team) { player.SetTeam(team); }
[Command("getSpeed")] //wirft immer 0 zurück, selbst im freien Fall public static void CMD_GetSpeed(OwnPlayer player) { player.SendChatMessage(player.MoveSpeed.ToString()); }