Merge branch 'develop' of ssh://development.life-of-german.org:451/log-gtav/reallife-gamemode into develop

This commit is contained in:
VegaZ
2018-12-23 20:42:28 +01:00
19 changed files with 236 additions and 77 deletions

View File

@@ -221,9 +221,9 @@ namespace reallife_gamemode.Server.Commands
}
player.SendChatMessage("~m~__________ ~s~Businesses ~m~__________");
foreach (Business.BusinessBase b in BusinessManager.Businesses)
foreach (BusinessBase b in BusinessManager.Businesses.OrderBy(b => b.Id))
{
player.SendChatMessage(b.Id.ToString().PadRight(3) + " | " + b.Name);
player.SendChatMessage(b.Id.ToString().PadRight(3) + " | " + b.Name + (b is CarDealerBusinessBase ? " | Autohaus" : ""));
}
}
#endregion
@@ -676,7 +676,9 @@ namespace reallife_gamemode.Server.Commands
return;
}
target.Position = new Vector3(target.Position.X, target.Position.Y, target.Position.Z + wert);
Vector3 oldPos = target.Position;
target.Position = new Vector3(oldPos.X, oldPos.Y, oldPos.Z + wert);
player.SendChatMessage("Du hast " + target.Name + " geslappt. Höhe: " + wert + "");
}
@@ -1439,8 +1441,8 @@ namespace reallife_gamemode.Server.Commands
}
}
[Command("save", "~m~Benutzung: ~s~/save [Typ = ~g~Blip~s~, ~g~Goto (X)~s~, ~r~Marker~s~, ~r~Ped~s~, ~r~Pickup~s~, ~r~TextLabel~s~, ~g~Vehicle~s~, ~g~FVehicle~s~, ~g~SVehicle~s~] (Beschreibung) = (X)")]
public void CmdAdminSave(Client player, string typ, string description = null)
[Command("save", "~m~Benutzung: ~s~/save [Typ = ~g~Blip~s~, ~g~Goto (X)~s~, ~r~Marker~s~, ~r~Ped~s~, ~r~Pickup~s~, ~r~TextLabel~s~, ~g~Vehicle~s~, ~g~FVehicle~s~, ~g~SVehicle (X)~s~] (Beschreibung) = (X)")]
public void CmdAdminSave(Client player, string typ, string option1 = null, string option2 = null)
{
if (!player.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true)
{
@@ -1453,7 +1455,7 @@ namespace reallife_gamemode.Server.Commands
player.TriggerEvent("saveBlip");
break;
case "goto":
if (description == null)
if (option1 == null)
{
player.SendChatMessage("Für Goto musst du einen dritten Parameter angeben. Beispiel: Ort des Goto-Punktes.");
return;
@@ -1462,11 +1464,11 @@ namespace reallife_gamemode.Server.Commands
{
using (var dbContext = new DatabaseContext())
{
GotoPoint p = dbContext.GotoPoints.FirstOrDefault(x => x.Description == description);
GotoPoint p = dbContext.GotoPoints.FirstOrDefault(x => x.Description == option1);
if (p == null)
{
SaveManager.SaveGotoPoint(player, description);
player.SendNotification("Goto-Punkt ~g~" + description + "~s~ gespeichert.", true);
SaveManager.SaveGotoPoint(player, option1);
player.SendNotification("Goto-Punkt ~g~" + option1 + "~s~ gespeichert.", true);
}
else
{
@@ -1512,12 +1514,38 @@ namespace reallife_gamemode.Server.Commands
case "svehicle":
if (player.IsInVehicle)
{
if(option1 == null || option2 == null)
{
player.SendChatMessage("~m~Benutzung: ~s~/save SVehicle [Carshop Business ID] [Preis]");
return;
}
if(!int.TryParse(option1, out int businessId) || !int.TryParse(option2, out int price))
{
player.SendChatMessage("~m~Benutzung: ~s~/save SVehicle [Carshop Business ID] [Preis]");
return;
}
BusinessBase business = BusinessManager.GetBusiness(businessId);
if(business == null)
{
player.SendChatMessage("~r~[FEHLER]~s~ Dieses Business existiert nicht.");
return;
}
if(!(business is CarDealerBusinessBase))
{
player.SendChatMessage("~r~[FEHLER]~s~ Dieses Business ist kein Fahrzeug-Business.");
return;
}
Vehicle vehicle = player.Vehicle;
int playerSeat = player.VehicleSeat;
vehicle = SaveManager.SaveShopVehicleData(vehicle, (VehicleHash)vehicle.Model, vehicle.DisplayName, vehicle.Position, vehicle.Heading, vehicle.NumberPlate,
Convert.ToByte(vehicle.PrimaryColor), Convert.ToByte(vehicle.SecondaryColor));
Convert.ToByte(vehicle.PrimaryColor), Convert.ToByte(vehicle.SecondaryColor), business, price);
player.SendNotification("Shopfahrzeug ~g~" + vehicle.DisplayName + "~s~ gespeichert.", true);
player.SetIntoVehicle(vehicle, playerSeat);
Vector3 oldPos = player.Position;
player.Position = new Vector3(oldPos.X, oldPos.Y, oldPos.Z + 2.5);
}
else player.SendChatMessage("~m~Du sitzt in keinem Fahrzeug!");
break;