Esempio n. 1
0
 public async Task LSPDAppSearchVehiclePlate(IPlayer player, string targetPlate)
 {
     try
     {
         if (player == null || !player.Exists || targetPlate == "")
         {
             return;
         }
         int charId = User.GetPlayerOnline(player);
         if (charId <= 0)
         {
             return;
         }
         if (player.HasPlayerHandcuffs() || player.HasPlayerRopeCuffs())
         {
             HUDHandler.SendNotification(player, 4, 5000, "Wie willst du das mit Handschellen/Fesseln machen?"); return;
         }
         if (!ServerFactions.IsCharacterInAnyFaction(charId))
         {
             HUDHandler.SendNotification(player, 4, 5000, "Fehler: Du bist in keiner Fraktion."); return;
         }
         if (ServerFactions.GetCharacterFactionId(charId) != 2 && ServerFactions.GetCharacterFactionId(charId) != 1)
         {
             HUDHandler.SendNotification(player, 4, 5000, "Fehler: Du bist nicht im L.S.P.D. oder der Justiz angestellt."); return;
         }
         if (!ServerFactions.IsCharacterInFactionDuty(charId))
         {
             HUDHandler.SendNotification(player, 4, 5000, "Fehler: Du bist nicht im Dienst."); return;
         }
         if (!ServerVehicles.ExistServerVehiclePlate(targetPlate))
         {
             HUDHandler.SendNotification(player, 3, 5000, "Fehler: Das angegebene Kennzeichen wurde nicht gefunden."); return;
         }
         int vehicleId = ServerVehicles.GetVehicleIdByPlate(targetPlate);
         if (vehicleId <= 0)
         {
             return;
         }
         int ownerId = ServerVehicles.GetVehicleOwnerById(vehicleId);
         if (ownerId <= 0)
         {
             return;
         }
         string owner      = Characters.GetCharacterName(ownerId);
         string vehName    = ServerVehicles.GetVehicleNameOnHash(ServerVehicles.GetVehicleHashById(vehicleId));
         string manufactor = ServerVehicles.GetVehicleManufactorOnHash(ServerVehicles.GetVehicleHashById(vehicleId));
         string buyDate    = $"{ServerVehicles.GetVehicleBuyDate(vehicleId).ToString("d", CultureInfo.CreateSpecificCulture("de-DE"))}";
         string trunk      = $"{ServerVehicles.GetVehicleTrunkCapacityOnHash(ServerVehicles.GetVehicleHashById(vehicleId))}kg";
         string tax        = $"{ServerAllVehicles.GetVehicleTaxes(ServerVehicles.GetVehicleHashById(vehicleId))}$";
         string maxfuel    = $"{ServerVehicles.GetVehicleFuelLimitOnHash(ServerVehicles.GetVehicleHashById(vehicleId))}";
         string fuelType   = ServerVehicles.GetVehicleFuelTypeOnHash(ServerVehicles.GetVehicleHashById(vehicleId));
         player.EmitLocked("Client:Tablet:SetLSPDAppSearchVehiclePlateData", owner, vehName, manufactor, buyDate, trunk, maxfuel, tax, fuelType);
         HUDHandler.SendNotification(player, 2, 1500, $"Fahrzeugabfrage durchgeführt: {targetPlate}");
     }
     catch (Exception e)
     {
         Alt.Log($"{e}");
     }
 }