fahrzeug respawn /respaenvehicle (optional id sonst nächstes fahrzeug)
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Net.Http;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using GTANetworkAPI;
|
using GTANetworkAPI;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
@@ -1170,6 +1171,46 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Command("respawnvehicle")]
|
||||||
|
public void CmdAdminRespawnVehicle(Player player, int? id = null)
|
||||||
|
{
|
||||||
|
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
|
||||||
|
{
|
||||||
|
ChatService.NotAuthorized(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Vehicle veh = null;
|
||||||
|
|
||||||
|
if (id == null)
|
||||||
|
{
|
||||||
|
var nearestVeh = NAPI.Pools.GetAllVehicles().Where(v => v.Position.DistanceTo(player.Position) <= 5).FirstOrDefault();
|
||||||
|
veh = nearestVeh;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
veh = VehicleManager.GetVehicleFromId(id.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (veh == null)
|
||||||
|
{
|
||||||
|
ChatService.ErrorMessage(player, "Dieses Fahrzeug wurde nicht gefunden");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ServerVehicle serverVehicle = VehicleManager.GetServerVehicleFromVehicle(veh);
|
||||||
|
|
||||||
|
if (serverVehicle == null)
|
||||||
|
{
|
||||||
|
ChatService.ErrorMessage(player, $"Dieses Fahrzeug kann nur gelöscht werden: ~m~/vdestroy {veh.Handle.Value}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Vehicle newVeh = serverVehicle.Spawn(veh);
|
||||||
|
newVeh.Repair();
|
||||||
|
newVeh.Rotation = new Vector3(0, 0, serverVehicle.Heading);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion ALevel1
|
#endregion ALevel1
|
||||||
|
|
||||||
#region ALevel2
|
#region ALevel2
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
ticket_amount = player.GetData<int>("ticket_amount");
|
ticket_amount = player.GetData<int>("ticket_amount");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(player.HasData("pay_amount"))
|
if (player.HasData("pay_amount"))
|
||||||
{
|
{
|
||||||
pay_amount = player.GetData<int>("pay_amount");
|
pay_amount = player.GetData<int>("pay_amount");
|
||||||
}
|
}
|
||||||
@@ -444,10 +444,12 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
{
|
{
|
||||||
pistol_Amount = weapon.Ammount;
|
pistol_Amount = weapon.Ammount;
|
||||||
}
|
}
|
||||||
else if(weapon.WeaponModel == "Pistol50"){
|
else if (weapon.WeaponModel == "Pistol50")
|
||||||
|
{
|
||||||
pistol50_Amount = weapon.Ammount;
|
pistol50_Amount = weapon.Ammount;
|
||||||
}
|
}
|
||||||
else if(weapon.WeaponModel == "Pistol_MK2") {
|
else if (weapon.WeaponModel == "Pistol_MK2")
|
||||||
|
{
|
||||||
Pistol_mk2_Amount = weapon.Ammount;
|
Pistol_mk2_Amount = weapon.Ammount;
|
||||||
}
|
}
|
||||||
else if (weapon.WeaponModel == "Combatpistol")
|
else if (weapon.WeaponModel == "Combatpistol")
|
||||||
|
|||||||
Reference in New Issue
Block a user