slash car vorschlag umgesetzt

This commit is contained in:
2020-08-04 17:55:29 +02:00
parent f47033c654
commit 0c0c3db98d
3 changed files with 22 additions and 4 deletions

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using GTANetworkAPI;
using ReallifeGamemode.Database.Entities;
using ReallifeGamemode.Server.Extensions;
@@ -34,9 +35,21 @@ namespace ReallifeGamemode.Server.Commands
public void CmdUserCar(Player player)
{
if (!player.IsLoggedIn()) return;
if (!player.IsInVehicle) return;
Vehicle pVeh = player.Vehicle;
Vehicle pVeh = null;
if (player.IsInVehicle)
{
pVeh = player.Vehicle;
} else
{
pVeh = NAPI.Pools.GetAllVehicles().Where(v => v.Position.DistanceTo(player.Position) <= 5).FirstOrDefault();
}
if (pVeh == null)
{
return;
}
if (pVeh.GetServerVehicle() is ServerVehicle veh)
{