コード例 #1
0
ファイル: SmartphoneHandler.cs プロジェクト: h04X-2K/ValeaRP
 public async Task requestPoliceAppMostWanteds(ClassicPlayer player)
 {
     try
     {
         if (player == null || !player.Exists || player.CharacterId <= 0 || !ServerFactions.IsCharacterInAnyFaction(player.CharacterId) || !ServerFactions.IsCharacterInFactionDuty(player.CharacterId) || (ServerFactions.GetCharacterFactionId(player.CharacterId) != 2 && ServerFactions.GetCharacterFactionId(player.CharacterId) != 12))
         {
             return;
         }
         if (ServerFactions.GetCharacterFactionId(player.CharacterId) == 2 && ServerFactions.GetCharacterFactionRank(player.CharacterId) < 6)
         {
             HUDHandler.SendNotification(player, 3, 2500, "Keine Berechtigung: ab Rang 6."); return;
         }
         string mostWantedList = JsonConvert.SerializeObject(Characters.PlayerCharacters.ToList().Where(x => User.IsCharacterOnline(x.charId) && CharactersWanteds.HasCharacterWanteds(x.charId) && Characters.IsCharacterPhoneEquipped(x.charId)).Select(x => new
         {
             description = $"{x.charname} - {CharactersWanteds.GetCharacterWantedFinalJailTime(x.charId)} Hafteinheiten",
             posX        = $"{Characters.GetCharacterLastPosition(x.charId).X}",
             posY        = $"{Characters.GetCharacterLastPosition(x.charId).Y}",
         }).OrderBy(x => x.description).ToList());
         player.EmitLocked("Client:Smartphone:setPoliceAppMostWanteds", mostWantedList);
     }
     catch (Exception e)
     {
         Alt.Log($"{e}");
     }
 }
コード例 #2
0
ファイル: SmartphoneHandler.cs プロジェクト: h04X-2K/ValeaRP
        public static async Task RequestLSPDIntranet(ClassicPlayer player)
        {
            try
            {
                if (player == null || !player.Exists || player.CharacterId <= 0)
                {
                    return;
                }
                if (!ServerFactions.IsCharacterInAnyFaction(player.CharacterId) || (ServerFactions.GetCharacterFactionId(player.CharacterId) != 2 && ServerFactions.GetCharacterFactionId(player.CharacterId) != 12) || !ServerFactions.IsCharacterInFactionDuty(player.CharacterId))
                {
                    player.EmitLocked("Client:Smartphone:ShowLSPDIntranetApp", false, "[]");
                    return;
                }

                string serverWanteds = JsonConvert.SerializeObject(CharactersWanteds.ServerWanteds_.Select(x => new
                {
                    x.wantedId,
                    x.wantedName,
                    x.paragraph,
                    x.category,
                    x.jailtime,
                    x.ticketfine,
                }).OrderBy(x => x.paragraph).ToList());
                player.EmitLocked("Client:Smartphone:ShowLSPDIntranetApp", true, serverWanteds);
            }
            catch (Exception e)
            {
                Alt.Log($"{e}");
            }
        }
コード例 #3
0
ファイル: Functions.cs プロジェクト: h04X-2K/ValeaRP
 public async Task GiveWeaponLicense(IPlayer player, string targetCharName)
 {
     try
     {
         if (player == null || !player.Exists || targetCharName == "")
         {
             return;
         }
         int charId = User.GetPlayerOnline(player);
         if (charId <= 0)
         {
             return;
         }
         if (player.HasPlayerHandcuffs() || player.HasPlayerRopeCuffs())
         {
             HUDHandler.SendNotification(player, 3, 5000, "Wie willst du das gefesselt machen?"); return;
         }
         if (!ServerFactions.IsCharacterInAnyFaction(charId))
         {
             HUDHandler.SendNotification(player, 3, 5000, "Du bist in keiner Fraktion."); return;
         }
         if (!ServerFactions.IsCharacterInFactionDuty(charId))
         {
             HUDHandler.SendNotification(player, 3, 5000, "Du bist nicht im Dienst."); return;
         }
         if (ServerFactions.GetCharacterFactionId(charId) != 1)
         {
             HUDHandler.SendNotification(player, 3, 5000, "Du bist kein Angehöriger der Justiz."); return;
         }
         if (!Characters.ExistCharacterName(targetCharName))
         {
             HUDHandler.SendNotification(player, 3, 5000, $"Der angegebene Name wurde nicht gefunden ({targetCharName})."); return;
         }
         int targetCharId = Characters.GetCharacterIdFromCharName(targetCharName);
         if (targetCharId <= 0)
         {
             return;
         }
         var targetPlayer = Alt.Server.GetPlayers().ToList().FirstOrDefault(x => x.GetCharacterMetaId() == (ulong)targetCharId);
         if (targetPlayer == null || !targetPlayer.Exists)
         {
             return;
         }
         if (!player.Position.IsInRange(targetPlayer.Position, 5f))
         {
             HUDHandler.SendNotification(player, 3, 5000, "Der Spieler ist nicht in Ihrer Nähe."); return;
         }
         if (CharactersLicenses.HasCharacterLicense(targetCharId, "weaponlicense"))
         {
             HUDHandler.SendNotification(player, 3, 5000, "Der Spieler hat bereits einen Waffenschein."); return;
         }
         CharactersLicenses.SetCharacterLicense(targetCharId, "weaponlicense", true);
         HUDHandler.SendNotification(player, 2, 3500, $"Sie haben dem Spieler {targetCharName} den Waffenschein erfolgreich ausgestellt.");
         HUDHandler.SendNotification(targetPlayer, 2, 3500, $"Ihnen wurde der Waffenschein erfolgreich ausgestellt.");
     }
     catch (Exception e)
     {
         Alt.Log($"{e}");
     }
 }
コード例 #4
0
        public void FactionCMD(IPlayer player, int charId, int id)
        {
            try
            {
                if (player == null || !player.Exists || player.GetCharacterMetaId() <= 0)
                {
                    return;
                }
                if (player.AdminLevel() <= 8)
                {
                    HUDHandler.SendNotification(player, 4, 5000, "Keine Rechte."); return;
                }
                if (ServerFactions.IsCharacterInAnyFaction(charId))
                {
                    ServerFactions.RemoveServerFactionMember(ServerFactions.GetCharacterFactionId(charId), charId);
                }

                ServerFactions.CreateServerFactionMember(id, charId, ServerFactions.GetFactionMaxRankCount(id), charId);
                player.SendChatMessage($"Done.");
            }
            catch (Exception e)
            {
                Alt.Log($"{e}");
            }
        }
コード例 #5
0
ファイル: Functions.cs プロジェクト: h04X-2K/ValeaRP
 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}");
     }
 }
コード例 #6
0
ファイル: Functions.cs プロジェクト: h04X-2K/ValeaRP
 public async Task LSPDAppTakeLicense(IPlayer player, string targetCharname, string licName)
 {
     try
     {
         if (player == null || !player.Exists || targetCharname == "" || licName == "")
         {
             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)
         {
             HUDHandler.SendNotification(player, 4, 5000, "Fehler: Du bist nicht im L.S.P.D. angestellt."); return;
         }
         if (!ServerFactions.IsCharacterInFactionDuty(charId))
         {
             HUDHandler.SendNotification(player, 4, 5000, "Fehler: Du bist nicht im Dienst."); return;
         }
         if (!Characters.ExistCharacterName(targetCharname))
         {
             HUDHandler.SendNotification(player, 3, 5000, "Fehler: Der eingegebene Name wurde nicht gefunden."); return;
         }
         Alt.Log($"{CharactersLicenses.GetFullLicenseName(licName)}");
         if (CharactersLicenses.GetFullLicenseName(licName) == "None")
         {
             return;
         }
         int targetCharId = Characters.GetCharacterIdFromCharName(targetCharname);
         if (targetCharId <= 0)
         {
             return;
         }
         if (!CharactersLicenses.HasCharacterLicense(targetCharId, licName))
         {
             HUDHandler.SendNotification(player, 3, 5000, "Fehler: Der Spieler hat diese Lizenz nicht mehr."); return;
         }
         CharactersLicenses.SetCharacterLicense(targetCharId, licName, false);
         HUDHandler.SendNotification(player, 2, 2000, $"{targetCharname} wurde die Lizenz {CharactersLicenses.GetFullLicenseName(licName)} entzogen.");
         LSPDAppSearchLicense(player, targetCharname);
     }
     catch (Exception e)
     {
         Alt.Log($"{e}");
     }
 }
コード例 #7
0
 public async Task FactionStorageStorageItem(IPlayer player, int factionId, int charId, string itemName, int amount, string fromContainer)
 {
     try
     {
         if (player == null || !player.Exists || factionId <= 0 || charId <= 0 || itemName == "" || itemName == "undefined" || amount <= 0 || fromContainer == "none" || fromContainer == "")
         {
             return;
         }
         int cCharId = User.GetPlayerOnline(player);
         if (cCharId != charId)
         {
             return;
         }
         if (player.HasPlayerHandcuffs() || player.HasPlayerRopeCuffs())
         {
             HUDHandler.SendNotification(player, 3, 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;
         }
         int cFactionId = ServerFactions.GetCharacterFactionId(charId);
         if (cFactionId != factionId)
         {
             return;
         }
         if (!ServerFactions.IsCharacterInFactionDuty(charId))
         {
             HUDHandler.SendNotification(player, 4, 5000, "Fehler: Du bist nicht im Dienst."); return;
         }
         if (!CharactersInventory.ExistCharacterItem(charId, itemName, fromContainer))
         {
             HUDHandler.SendNotification(player, 4, 5000, "Fehler: Diesen Gegenstand besitzt du nicht."); return;
         }
         if (CharactersInventory.GetCharacterItemAmount(charId, itemName, fromContainer) < amount)
         {
             HUDHandler.SendNotification(player, 4, 5000, "Fehler: Du hast nicht genügend Gegenstände davon dabei."); return;
         }
         if (CharactersInventory.IsItemActive(player, itemName))
         {
             HUDHandler.SendNotification(player, 4, 5000, "Fehler: Ausgerüstete Gegenstände können nicht umgelagert werden."); return;
         }
         CharactersInventory.RemoveCharacterItemAmount(charId, itemName, amount, fromContainer);
         ServerFactions.AddServerFactionStorageItem(factionId, charId, itemName, amount);
         LoggingService.NewFactionLog(factionId, charId, 0, "storage", $"{Characters.GetCharacterName(charId)} ({charId}) hat den Gegenstand '{itemName} ({amount}x)' in seinen Spind gelegt.");
     }
     catch (Exception e)
     {
         Alt.Log($"{e}");
     }
 }
コード例 #8
0
ファイル: Functions.cs プロジェクト: h04X-2K/ValeaRP
 public async Task SearchBankAccounts(IPlayer player, string targetCharName)
 {
     try
     {
         if (player == null || !player.Exists || targetCharName == "")
         {
             return;
         }
         int charId = User.GetPlayerOnline(player);
         if (charId <= 0)
         {
             return;
         }
         if (player.HasPlayerHandcuffs() || player.HasPlayerRopeCuffs())
         {
             HUDHandler.SendNotification(player, 3, 5000, "Wie willst du das gefesselt machen?"); return;
         }
         if (!ServerFactions.IsCharacterInAnyFaction(charId))
         {
             HUDHandler.SendNotification(player, 3, 5000, "Du bist in keiner Fraktion."); return;
         }
         if (!ServerFactions.IsCharacterInFactionDuty(charId))
         {
             HUDHandler.SendNotification(player, 3, 5000, "Du bist nicht im Dienst."); return;
         }
         if (ServerFactions.GetCharacterFactionId(charId) != 1)
         {
             HUDHandler.SendNotification(player, 3, 5000, "Du bist kein Angehöriger der Justiz."); return;
         }
         if (!Characters.ExistCharacterName(targetCharName))
         {
             HUDHandler.SendNotification(player, 3, 5000, $"Der angegebene Name wurde nicht gefunden ({targetCharName})."); return;
         }
         int targetCharId = Characters.GetCharacterIdFromCharName(targetCharName);
         if (targetCharId <= 0)
         {
             return;
         }
         var targetBankAccounts = CharactersBank.GetCharacterBankAccounts(targetCharId);
         if (targetBankAccounts == "[]" || targetBankAccounts == "")
         {
             HUDHandler.SendNotification(player, 3, 5000, "Der Spieler hat keine Bankkonten."); return;
         }
         player.EmitLocked("Client:Tablet:SetJusticeAppSearchedBankAccounts", targetBankAccounts);
     }
     catch (Exception e)
     {
         Alt.Log($"{e}");
     }
 }
コード例 #9
0
ファイル: Functions.cs プロジェクト: h04X-2K/ValeaRP
 public async Task LSPDAppSearchLicense(IPlayer player, string targetCharname)
 {
     try
     {
         if (player == null || !player.Exists || targetCharname == "")
         {
             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 (!Characters.ExistCharacterName(targetCharname))
         {
             HUDHandler.SendNotification(player, 3, 5000, "Fehler: Der eingegebene Name wurde nicht gefunden."); return;
         }
         int targetCharId = Characters.GetCharacterIdFromCharName(targetCharname);
         if (targetCharId <= 0)
         {
             return;
         }
         string charName = Characters.GetCharacterName(targetCharId);
         string licArray = CharactersLicenses.GetCharacterLicenses(targetCharId);
         player.EmitLocked("Client:Tablet:SetLSPDAppLicenseSearchData", charName, licArray);
         HUDHandler.SendNotification(player, 2, 1500, $"Lizenzabfrage durchgeführt: {charName}.");
     }
     catch (Exception e)
     {
         Alt.Log($"{e}");
     }
 }
コード例 #10
0
ファイル: Functions.cs プロジェクト: h04X-2K/ValeaRP
 public async Task ViewBankTransactions(IPlayer player, int accNumber)
 {
     try
     {
         if (player == null || !player.Exists || accNumber <= 0)
         {
             return;
         }
         int charId = User.GetPlayerOnline(player);
         if (charId <= 0)
         {
             return;
         }
         if (player.HasPlayerHandcuffs() || player.HasPlayerRopeCuffs())
         {
             HUDHandler.SendNotification(player, 3, 5000, "Wie willst du das gefesselt machen?"); return;
         }
         if (!ServerFactions.IsCharacterInAnyFaction(charId))
         {
             HUDHandler.SendNotification(player, 3, 5000, "Du bist in keiner Fraktion."); return;
         }
         if (!ServerFactions.IsCharacterInFactionDuty(charId))
         {
             HUDHandler.SendNotification(player, 3, 5000, "Du bist nicht im Dienst."); return;
         }
         if (ServerFactions.GetCharacterFactionId(charId) != 1)
         {
             HUDHandler.SendNotification(player, 3, 5000, "Du bist kein Angehöriger der Justiz."); return;
         }
         if (!CharactersBank.ExistBankAccountNumber(accNumber))
         {
             HUDHandler.SendNotification(player, 3, 5000, $"Die ausgewählte Kontonummer existiert nicht ({accNumber})."); return;
         }
         var bankPapers = ServerBankPapers.GetTabletBankAccountBankPaper(accNumber);
         if (bankPapers == "[]" || bankPapers == "")
         {
             HUDHandler.SendNotification(player, 3, 5000, "Dieses Konto besitzt keine Transaktionen."); return;
         }
         player.EmitLocked("Client:Tablet:SetJusticeAppBankTransactions", bankPapers);
     }
     catch (Exception e)
     {
         Alt.Log($"{e}");
     }
 }
コード例 #11
0
        public async Task TowVehicle(IPlayer player, IVehicle vehicle)
        {
            try
            {
                if (player == null || !player.Exists || vehicle == null || !vehicle.Exists)
                {
                    return;
                }
                int charId = (int)player.GetCharacterMetaId();
                int vehId  = (int)vehicle.GetVehicleId();
                if (charId <= 0 || player.HasPlayerRopeCuffs() || player.HasPlayerHandcuffs() || player.IsPlayerUnconscious() || !ServerFactions.IsCharacterInAnyFaction(charId) || !vehicle.Position.IsInRange(Constants.Positions.AutoClubLosSantos_StoreVehPosition, 5f) || vehId <= 0)
                {
                    return;
                }
                if (ServerFactions.GetCharacterFactionId(charId) != 4)
                {
                    return;
                }
                int vehClass = ServerAllVehicles.GetVehicleClass(vehicle.Model);
                switch (vehClass)
                {
                case 0:     //Fahrzeuge
                    ServerVehicles.SetVehicleInGarage(vehicle, true, 10);
                    break;

                case 1:     //Boote
                    break;

                case 2:     //Flugzeuge
                    break;

                case 3:     //Helikopter
                    break;
                }
                ServerFactions.SetFactionBankMoney(4, ServerFactions.GetFactionBankMoney(4) + 1500); //ToDo: Anpassen
                HUDHandler.SendNotification(player, 2, 2000, "Fahrzeug erfolgreich verwahrt.");
                LoggingService.NewFactionLog(4, charId, vehId, "towVehicle", $"{Characters.GetCharacterName(charId)} hat das Fahrzeug mit der ID {vehId} abgeschleppt.");
            }
            catch (Exception e)
            {
                Alt.Log($"{e}");
            }
        }
コード例 #12
0
ファイル: TimerHandler.cs プロジェクト: h04X-2K/ValeaRP
        public static async void OnEntityTimer(object sender, ElapsedEventArgs e)
        {
            try
            {
                Console.WriteLine($"Timer - Thread = {Thread.CurrentThread.ManagedThreadId}");
                Stopwatch stopwatch = new Stopwatch();
                stopwatch.Start();
                foreach (IVehicle Veh in Alt.Server.GetVehicles().ToList())
                {
                    if (Veh == null || !Veh.Exists)
                    {
                        continue;
                    }
                    using (var vRef = new VehicleRef(Veh))
                    {
                        if (!vRef.Exists)
                        {
                            continue;
                        }
                        lock (Veh)
                        {
                            if (Veh == null || !Veh.Exists)
                            {
                                continue;
                            }
                            ulong vehID = Veh.GetVehicleId();
                            if (vehID <= 0)
                            {
                                continue;
                            }
                            ServerVehicles.SaveVehiclePositionAndStates(Veh);
                            if (Veh.EngineOn == true)
                            {
                                ServerVehicles.SetVehicleFuel(Veh, ServerVehicles.GetVehicleFuel(Veh) - 0.03f);
                            }
                        }
                    }
                }

                stopwatch.Stop();
                Alt.Log($"OnEntityTimer: Vehicle Foreach benötigte: {stopwatch.Elapsed}");

                stopwatch.Reset();
                stopwatch.Start();
                foreach (IPlayer player in Alt.Server.GetPlayers().ToList())
                {
                    if (player == null)
                    {
                        continue;
                    }
                    using (var playerReference = new PlayerRef(player))
                    {
                        if (!playerReference.Exists)
                        {
                            return;
                        }
                        if (player == null || !player.Exists)
                        {
                            continue;
                        }
                        lock (player)
                        {
                            if (player == null || !player.Exists)
                            {
                                continue;
                            }
                            int charId = User.GetPlayerOnline(player);
                            if (charId > 0)
                            {
                                Characters.SetCharacterLastPosition(charId, player.Position, player.Dimension);
                                if (User.IsPlayerBanned(player))
                                {
                                    player.kickWithMessage($"Du bist gebannt. (Grund: {User.GetPlayerBanReason(player)}).");
                                }
                                Characters.SetCharacterHealth(charId, player.Health);
                                Characters.SetCharacterArmor(charId, player.Armor);
                                WeatherHandler.SetRealTime(player);
                                if (player.IsInVehicle)
                                {
                                    player.EmitLocked("Client:HUD:GetDistanceForVehicleKM"); HUDHandler.SendInformationToVehicleHUD(player);
                                }
                                Characters.IncreaseCharacterPaydayTime(charId);

                                if (Characters.IsCharacterUnconscious(charId))
                                {
                                    int unconsciousTime = Characters.GetCharacterUnconsciousTime(charId);
                                    if (unconsciousTime > 0)
                                    {
                                        Characters.SetCharacterUnconscious(charId, true, unconsciousTime - 1);
                                    }
                                    else if (unconsciousTime <= 0)
                                    {
                                        Characters.SetCharacterUnconscious(charId, false, 0);
                                        DeathHandler.closeDeathscreen(player);
                                        player.Spawn(new Position(355.54285f, -596.33405f, 28.75768f));
                                        player.Health = player.MaxHealth;
                                    }
                                }

                                if (Characters.IsCharacterFastFarm(charId))
                                {
                                    int fastFarmTime = Characters.GetCharacterFastFarmTime(charId);
                                    if (fastFarmTime > 0)
                                    {
                                        Characters.SetCharacterFastFarm(charId, true, fastFarmTime - 1);
                                    }
                                    else if (fastFarmTime <= 0)
                                    {
                                        Characters.SetCharacterFastFarm(charId, false, 0);
                                    }
                                }

                                if (Characters.IsCharacterInJail(charId))
                                {
                                    int jailTime = Characters.GetCharacterJailTime(charId);
                                    if (jailTime > 0)
                                    {
                                        Characters.SetCharacterJailTime(charId, true, jailTime - 1);
                                    }
                                    else if (jailTime <= 0)
                                    {
                                        if (CharactersWanteds.HasCharacterWanteds(charId))
                                        {
                                            int jailTimes = CharactersWanteds.GetCharacterWantedFinalJailTime(charId);
                                            int jailPrice = CharactersWanteds.GetCharacterWantedFinalJailPrice(charId);
                                            if (CharactersBank.HasCharacterBankMainKonto(charId))
                                            {
                                                int accNumber = CharactersBank.GetCharacterBankMainKonto(charId);
                                                int bankMoney = CharactersBank.GetBankAccountMoney(accNumber);
                                                CharactersBank.SetBankAccountMoney(accNumber, bankMoney - jailPrice);
                                                HUDHandler.SendNotification(player, 1, 7500, $"Durch deine Inhaftierung wurden dir {jailPrice}$ vom Konto abgezogen.");
                                            }
                                            HUDHandler.SendNotification(player, 1, 7500, $"Du sitzt nun für {jailTimes} Minuten im Gefängnis.");
                                            Characters.SetCharacterJailTime(charId, true, jailTimes);
                                            CharactersWanteds.RemoveCharacterWanteds(charId);
                                            player.Position = new Position(1691.4594f, 2565.7056f, 45.556763f);
                                            if (Characters.GetCharacterGender(charId) == false)
                                            {
                                                player.EmitLocked("Client:SpawnArea:setCharClothes", 11, 5, 0);
                                                player.EmitLocked("Client:SpawnArea:setCharClothes", 3, 5, 0);
                                                player.EmitLocked("Client:SpawnArea:setCharClothes", 4, 7, 15);
                                                player.EmitLocked("Client:SpawnArea:setCharClothes", 6, 7, 0);
                                                player.EmitLocked("Client:SpawnArea:setCharClothes", 8, 1, 88);
                                            }
                                            else
                                            {
                                            }
                                        }
                                        else
                                        {
                                            Characters.SetCharacterJailTime(charId, false, 0);
                                            Characters.SetCharacterCorrectClothes(player);
                                            player.Position = new Position(1846.022f, 2585.8945f, 45.657f);
                                            HUDHandler.SendNotification(player, 1, 2500, "Du wurdest aus dem Gefängnis entlassen.");
                                        }
                                    }
                                }

                                if (Characters.GetCharacterPaydayTime(charId) >= 60)
                                {
                                    Characters.IncreaseCharacterPlayTimeHours(charId);
                                    Characters.ResetCharacterPaydayTime(charId);
                                    if (CharactersBank.HasCharacterBankMainKonto(charId))
                                    {
                                        int accountNumber = CharactersBank.GetCharacterBankMainKonto(charId);
                                        CharactersBank.SetBankAccountMoney(accountNumber, CharactersBank.GetBankAccountMoney(accountNumber) + 250); //250$ Stütze
                                        ServerBankPapers.CreateNewBankPaper(accountNumber, DateTime.Now.ToString("d", CultureInfo.CreateSpecificCulture("de-DE")), DateTime.Now.ToString("t", CultureInfo.CreateSpecificCulture("de-DE")), "Eingehende Überweisung", "Staat", "Arbeitslosengeld", "+250$", "Unbekannt");

                                        if (!Characters.IsCharacterCrimeFlagged(charId) && Characters.GetCharacterJob(charId) != "None" && DateTime.Now.Subtract(Convert.ToDateTime(Characters.GetCharacterLastJobPaycheck(charId))).TotalHours >= 12 && !ServerFactions.IsCharacterInAnyFaction(charId))
                                        {
                                            if (Characters.GetCharacterJobHourCounter(charId) >= ServerJobs.GetJobNeededHours(Characters.GetCharacterJob(charId)) - 1)
                                            {
                                                int jobCheck = ServerJobs.GetJobPaycheck(Characters.GetCharacterJob(charId));
                                                Characters.SetCharacterLastJobPaycheck(charId, DateTime.Now);
                                                Characters.ResetCharacterJobHourCounter(charId);
                                                CharactersBank.SetBankAccountMoney(accountNumber, CharactersBank.GetBankAccountMoney(accountNumber) + jobCheck);
                                                ServerBankPapers.CreateNewBankPaper(accountNumber, DateTime.Now.ToString("d", CultureInfo.CreateSpecificCulture("de-DE")), DateTime.Now.ToString("t", CultureInfo.CreateSpecificCulture("de-DE")), "Eingehende Überweisung", "Arbeitsamt", $"Gehalt: {Characters.GetCharacterJob(charId)}", $"+{jobCheck}$", "Unbekannt");
                                                HUDHandler.SendNotification(player, 1, 5000, $"Gehalt erhalten (Beruf: {Characters.GetCharacterJob(charId)} | Gehalt: {jobCheck}$)");
                                            }
                                            else
                                            {
                                                Characters.IncreaseCharacterJobHourCounter(charId);
                                            }
                                        }

                                        if (ServerFactions.IsCharacterInAnyFaction(charId) && ServerFactions.IsCharacterInFactionDuty(charId))
                                        {
                                            int factionid       = ServerFactions.GetCharacterFactionId(charId);
                                            int factionPayCheck = ServerFactions.GetFactionRankPaycheck(factionid, ServerFactions.GetCharacterFactionRank(charId));
                                            if (ServerFactions.GetFactionBankMoney(factionid) >= factionPayCheck)
                                            {
                                                ServerFactions.SetFactionBankMoney(factionid, ServerFactions.GetFactionBankMoney(factionid) - factionPayCheck);
                                                CharactersBank.SetBankAccountMoney(accountNumber, CharactersBank.GetBankAccountMoney(accountNumber) + factionPayCheck);
                                                HUDHandler.SendNotification(player, 1, 5000, $"Du hast deinen Lohn i.H.v. {factionPayCheck}$ erhalten ({ServerFactions.GetFactionRankName(factionid, ServerFactions.GetCharacterFactionRank(charId))})");
                                                ServerBankPapers.CreateNewBankPaper(accountNumber, DateTime.Now.ToString("d", CultureInfo.CreateSpecificCulture("de-DE")), DateTime.Now.ToString("t", CultureInfo.CreateSpecificCulture("de-DE")), "Eingehende Überweisung", $"{ServerFactions.GetFactionFullName(factionid)}", $"Gehalt: {ServerFactions.GetFactionRankName(factionid, ServerFactions.GetCharacterFactionRank(charId))}", $"+{factionPayCheck}$", "Dauerauftrag");
                                                LoggingService.NewFactionLog(factionid, charId, 0, "paycheck", $"{Characters.GetCharacterName(charId)} hat seinen Lohn i.H.v. {factionPayCheck}$ erhalten ({ServerFactions.GetFactionRankName(factionid, ServerFactions.GetCharacterFactionRank(charId))}).");
                                            }
                                            else
                                            {
                                                HUDHandler.SendNotification(player, 3, 5000, $"Deine Fraktion hat nicht genügend Geld um dich zu bezahlen ({factionPayCheck}$).");
                                            }
                                        }

                                        var playerVehicles = ServerVehicles.ServerVehicles_.Where(x => x.id > 0 && x.charid == charId && x.plate.Contains("NL"));
                                        int taxMoney       = 0;
                                        foreach (var i in playerVehicles)
                                        {
                                            if (!i.plate.Contains("NL"))
                                            {
                                                continue;
                                            }
                                            taxMoney += ServerAllVehicles.GetVehicleTaxes(i.hash);
                                        }

                                        if (playerVehicles != null && taxMoney > 0)
                                        {
                                            if (CharactersBank.GetBankAccountMoney(accountNumber) < taxMoney)
                                            {
                                                HUDHandler.SendNotification(player, 3, 5000, $"Deine Fahrzeugsteuern konnten nicht abgebucht werden ({taxMoney}$)");
                                            }
                                            else
                                            {
                                                CharactersBank.SetBankAccountMoney(accountNumber, CharactersBank.GetBankAccountMoney(accountNumber) - taxMoney);
                                                ServerBankPapers.CreateNewBankPaper(accountNumber, DateTime.Now.ToString("d", CultureInfo.CreateSpecificCulture("de-DE")), DateTime.Now.ToString("t", CultureInfo.CreateSpecificCulture("de-DE")), "Ausgehende Überweisung", "Zulassungsamt", $"Fahrzeugsteuer", $"-{taxMoney}$", "Bankeinzug");
                                                HUDHandler.SendNotification(player, 1, 5000, $"Du hast deine Fahrzeugsteuern i.H.v. {taxMoney}$ bezahlt.");
                                            }
                                        }
                                    }
                                    else
                                    {
                                        HUDHandler.SendNotification(player, 3, 5000, $"Dein Einkommen konnte nicht überwiesen werden da du kein Hauptkonto hast.");
                                    }
                                }
                            }
                        }
                    }
                }
                stopwatch.Stop();
                Alt.Log($"OnEntityTimer: Player Foreach benötigte: {stopwatch.Elapsed}");
            }
            catch (Exception ex)
            {
                Alt.Log($"{ex}");
            }
        }
コード例 #13
0
ファイル: Functions.cs プロジェクト: h04X-2K/ValeaRP
 public async Task GiveLicense(IPlayer player, int targetCharId, string licShort)
 {
     try
     {
         if (player == null || !player.Exists || targetCharId <= 0 || licShort == "")
         {
             return;
         }
         int charId = User.GetPlayerOnline(player);
         if (charId <= 0)
         {
             return;
         }
         if (player.HasPlayerHandcuffs() || player.HasPlayerRopeCuffs())
         {
             HUDHandler.SendNotification(player, 3, 5000, "Wie willst du das gefesselt machen?"); return;
         }
         if (!ServerFactions.IsCharacterInAnyFaction(charId))
         {
             HUDHandler.SendNotification(player, 3, 5000, "Du bist in keiner Fraktion."); return;
         }
         if (!ServerFactions.IsCharacterInFactionDuty(charId))
         {
             HUDHandler.SendNotification(player, 3, 5000, "Du bist nicht im Dienst."); return;
         }
         if (ServerFactions.GetCharacterFactionId(charId) != 5)
         {
             HUDHandler.SendNotification(player, 3, 5000, "Du bist kein Angehöriger der Fahrschule."); return;
         }
         var targetPlayer = Alt.Server.GetPlayers().ToList().FirstOrDefault(x => x.GetCharacterMetaId() == (ulong)targetCharId);
         if (targetPlayer == null || !targetPlayer.Exists)
         {
             return;
         }
         if (targetCharId != (int)targetPlayer.GetCharacterMetaId())
         {
             return;
         }
         if (!player.Position.IsInRange(targetPlayer.Position, 5f))
         {
             HUDHandler.SendNotification(player, 3, 5000, "Du bist zu weit entfernt."); return;
         }
         if (!CharactersLicenses.ExistServerLicense(licShort))
         {
             HUDHandler.SendNotification(player, 3, 5000, "Ein unerwarteter Fehler ist aufgetreten."); return;
         }
         if (CharactersLicenses.HasCharacterLicense(targetCharId, licShort))
         {
             HUDHandler.SendNotification(player, 3, 5000, "Der Spieler hat diese Lizenz bereits."); return;
         }
         if (!CharactersBank.HasCharacterBankMainKonto(targetCharId))
         {
             HUDHandler.SendNotification(player, 3, 5000, "Der Spieler besitzt kein Hauptkonto."); return;
         }
         int accNumber = CharactersBank.GetCharacterBankMainKonto(targetCharId);
         int licPrice  = CharactersLicenses.GetLicensePrice(licShort);
         if (CharactersBank.GetBankAccountLockStatus(accNumber))
         {
             HUDHandler.SendNotification(player, 3, 5000, "Das Hauptkonto des Spielers ist gesperrt."); return;
         }
         CharactersBank.SetBankAccountMoney(accNumber, CharactersBank.GetBankAccountMoney(accNumber) - licPrice);
         ServerBankPapers.CreateNewBankPaper(accNumber, DateTime.Now.ToString("d", CultureInfo.CreateSpecificCulture("de-DE")), DateTime.Now.ToString("t", CultureInfo.CreateSpecificCulture("de-DE")), "Ausgehende Überweisung", "Fahrschule", $"Lizenzkauf: {CharactersLicenses.GetFullLicenseName(licShort)}", $"-{licPrice}$", "Bankeinzug");
         CharactersLicenses.SetCharacterLicense(targetCharId, licShort, true);
         ServerFactions.SetFactionBankMoney(5, ServerFactions.GetFactionBankMoney(5) + licPrice);
         HUDHandler.SendNotification(player, 2, 2000, $"Sie haben dem Spieler {Characters.GetCharacterName(targetCharId)} die Lizenz '{CharactersLicenses.GetFullLicenseName(licShort)}' für eine Gebühr i.H.v. {licPrice}$ ausgestellt.");
         HUDHandler.SendNotification(targetPlayer, 2, 2000, $"Ihnen wurde die Lizenz '{CharactersLicenses.GetFullLicenseName(licShort)}' für eine Gebühr i.H.v. {licPrice}$ ausgestellt, diese wurde von Ihrem Hauptkonto abgebucht.");
     }
     catch (Exception e)
     {
         Alt.Log($"{e}");
     }
 }
コード例 #14
0
        public async Task FactionStorageTakeItem(IPlayer player, int factionId, int charId, string itemName, int amount)
        {
            try
            {
                if (player == null || !player.Exists || factionId <= 0 || charId <= 0 || amount <= 0 || itemName == "" || itemName == "undefined")
                {
                    return;
                }
                int cCharId = User.GetPlayerOnline(player);
                if (cCharId != charId)
                {
                    return;
                }
                if (player.HasPlayerHandcuffs() || player.HasPlayerRopeCuffs())
                {
                    HUDHandler.SendNotification(player, 3, 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;
                }
                int cFactionId = ServerFactions.GetCharacterFactionId(charId);
                if (cFactionId != factionId)
                {
                    return;
                }
                if (!ServerFactions.IsCharacterInFactionDuty(charId))
                {
                    HUDHandler.SendNotification(player, 4, 5000, "Fehler: Du bist nicht im Dienst."); return;
                }
                if (!ServerFactions.ExistServerFactionStorageItem(factionId, charId, itemName))
                {
                    HUDHandler.SendNotification(player, 4, 5000, "Fehler: Der Gegenstand existiert im Spind nicht."); return;
                }
                if (ServerFactions.GetServerFactionStorageItemAmount(factionId, charId, itemName) < amount)
                {
                    HUDHandler.SendNotification(player, 4, 5000, "Fehler: Soviele Gegenstände sind nicht im Spind."); return;
                }
                float itemWeight     = ServerItems.GetItemWeight(itemName) * amount;
                float invWeight      = CharactersInventory.GetCharacterItemWeight(charId, "inventory");
                float backpackWeight = CharactersInventory.GetCharacterItemWeight(charId, "backpack");
                if (invWeight + itemWeight > 15f && backpackWeight + itemWeight > Characters.GetCharacterBackpackSize(Characters.GetCharacterBackpack(charId)))
                {
                    HUDHandler.SendNotification(player, 3, 5000, $"Du hast nicht genug Platz in deinen Taschen."); return;
                }
                ServerFactions.RemoveServerFactionStorageItemAmount(factionId, charId, itemName, amount);

                LoggingService.NewFactionLog(factionId, charId, 0, "storage", $"{Characters.GetCharacterName(charId)} ({charId}) hat den Gegenstand '{itemName} ({amount}x)' aus seinem Spind entnommen.");

                if (invWeight + itemWeight <= 15f)
                {
                    HUDHandler.SendNotification(player, 2, 5000, $"Du hast {itemName} ({amount}x) aus deinem Spind genommen (Lagerort: Inventar).");
                    CharactersInventory.AddCharacterItem(charId, itemName, amount, "inventory");
                    return;
                }

                if (Characters.GetCharacterBackpack(charId) != "None" && backpackWeight + itemWeight <= Characters.GetCharacterBackpackSize(Characters.GetCharacterBackpack(charId)))
                {
                    HUDHandler.SendNotification(player, 2, 5000, $"Du hast {itemName} ({amount}x) aus deinem Spind genommen (Lagerort: Rucksack / Tasche).");
                    CharactersInventory.AddCharacterItem(charId, itemName, amount, "backpack");
                    return;
                }
            }
            catch (Exception e)
            {
                Alt.Log($"{e}");
            }
        }
コード例 #15
0
ファイル: SmartphoneHandler.cs プロジェクト: h04X-2K/ValeaRP
        public async Task GiveLSPDIntranetWanteds(ClassicPlayer player, int selectedCharId, string wanteds)
        {
            try
            {
                if (player == null || !player.Exists || player.CharacterId <= 0 || selectedCharId <= 0 || string.IsNullOrWhiteSpace(wanteds) || !ServerFactions.IsCharacterInAnyFaction(player.CharacterId) || !ServerFactions.IsCharacterInFactionDuty(player.CharacterId) || (ServerFactions.GetCharacterFactionId(player.CharacterId) != 2 && ServerFactions.GetCharacterFactionId(player.CharacterId) != 12))
                {
                    return;
                }
                List <int> decompiledWanteds = JsonConvert.DeserializeObject <List <int> >(wanteds);
                if (decompiledWanteds == null)
                {
                    return;
                }
                ClassicPlayer targetPlayer = (ClassicPlayer)Alt.Server.GetPlayers().ToList().FirstOrDefault(x => x != null && x.Exists && ((ClassicPlayer)x).CharacterId == selectedCharId);
                if (targetPlayer == null || !targetPlayer.Exists)
                {
                    HUDHandler.SendNotification(player, 3, 2500, $"Der Spieler ist nicht online ({selectedCharId})");
                    return;
                }

                string givenString = $"{DateTime.Now.ToString("d", CultureInfo.CreateSpecificCulture("de-DE"))} {DateTime.Now.ToString("t", CultureInfo.CreateSpecificCulture("de-DE"))} von {Characters.GetCharacterName(player.CharacterId)}.";

                CharactersWanteds.CreateCharacterWantedEntry(selectedCharId, givenString, decompiledWanteds);
                requestLSPDIntranetPersonWanteds(player, selectedCharId);

                foreach (ClassicPlayer policeMember in Alt.Server.GetPlayers().ToList().Where(x => x != null && x.Exists && ((ClassicPlayer)x).CharacterId > 0 && ServerFactions.IsCharacterInAnyFaction(((ClassicPlayer)x).CharacterId) && (ServerFactions.GetCharacterFactionId(((ClassicPlayer)x).CharacterId) == 2 || ServerFactions.GetCharacterFactionId(((ClassicPlayer)x).CharacterId) == 12)))
                {
                    HUDHandler.SendNotification(policeMember, 1, 3000, $"{Characters.GetCharacterName(player.CharacterId)} hat die Akte von {Characters.GetCharacterName(selectedCharId)} bearbeitet.");
                }
            }
            catch (Exception e)
            {
                Alt.Log($"{e}");
            }
        }
コード例 #16
0
        public async Task WithdrawFactionMoney(IPlayer player, string type, int factionId, int moneyAmount) //Type: faction | company
        {
            try
            {
                if (player == null || !player.Exists || factionId <= 0 || moneyAmount < 1 || type == "")
                {
                    return;
                }
                if (type != "faction" && type != "company")
                {
                    return;
                }
                int charid = User.GetPlayerOnline(player);
                if (charid == 0)
                {
                    return;
                }

                if (type == "faction")
                {
                    if (!ServerFactions.IsCharacterInAnyFaction(charid))
                    {
                        HUDHandler.SendNotification(player, 4, 5000, "Du bist in keiner Fraktion und hast keine Berechtigung dazu."); return;
                    }
                    if (factionId != ServerFactions.GetCharacterFactionId(charid))
                    {
                        HUDHandler.SendNotification(player, 4, 5000, "Ein unerwarteter Fehler ist aufgetreten. [FACTIONBANK-001]"); return;
                    }
                    if (ServerFactions.GetCharacterFactionRank(charid) != ServerFactions.GetFactionMaxRankCount(factionId) && ServerFactions.GetCharacterFactionRank(charid) != ServerFactions.GetFactionMaxRankCount(factionId) - 1)
                    {
                        HUDHandler.SendNotification(player, 3, 5000, "Du hast nicht den benötigten Rang um auf das Fraktionskonto zuzugreifen."); return;
                    }
                    if (ServerFactions.GetFactionBankMoney(factionId) < moneyAmount)
                    {
                        HUDHandler.SendNotification(player, 3, 5000, "Soviel Geld ist auf dem Fraktionskonto nicht vorhanden."); return;
                    }
                    ServerFactions.SetFactionBankMoney(factionId, ServerFactions.GetFactionBankMoney(factionId) - moneyAmount);
                    CharactersInventory.AddCharacterItem(charid, "Bargeld", moneyAmount, "inventory");
                    HUDHandler.SendNotification(player, 2, 5000, $"Du hast erfolgreich {moneyAmount}$ vom Fraktionskonto abgebucht.");
                    LoggingService.NewFactionLog(factionId, charid, 0, "bank", $"{Characters.GetCharacterName(charid)} ({charid}) hat {moneyAmount}$ vom Fraktionskonto abgebucht.");
                    return;
                }
                else if (type == "company")
                {
                    if (!ServerCompanys.IsCharacterInAnyServerCompany(charid))
                    {
                        HUDHandler.SendNotification(player, 4, 5000, "Du bist in keinem Unternehmen und hast keine Berechtigung dazu."); return;
                    }
                    if (factionId != ServerCompanys.GetCharacterServerCompanyId(charid))
                    {
                        HUDHandler.SendNotification(player, 4, 5000, "Ein unerwarteter Fehler ist aufgetreten. [FACTIONBANK-0001]"); return;
                    }
                    if (ServerCompanys.GetCharacterServerCompanyRank(charid) < 1)
                    {
                        HUDHandler.SendNotification(player, 3, 5000, "Du hast nicht den benötigten Rang um auf das Unternehmenskonto zuzugreifen."); return;
                    }
                    if (ServerCompanys.GetServerCompanyMoney(factionId) < moneyAmount)
                    {
                        HUDHandler.SendNotification(player, 3, 5000, "Soviel Geld ist auf dem Unternehmenskonto nicht vorhanden."); return;
                    }
                    ServerCompanys.SetServerCompanyMoney(factionId, ServerCompanys.GetServerCompanyMoney(factionId) - moneyAmount);
                    CharactersInventory.AddCharacterItem(charid, "Bargeld", moneyAmount, "inventory");
                    HUDHandler.SendNotification(player, 2, 5000, $"Du hast erfolgreich {moneyAmount}$ vom Unternehmenskonto abgebucht.");
                    LoggingService.NewCompanyLog(factionId, charid, 0, "bank", $"{Characters.GetCharacterName(charid)} ({charid}) hat {moneyAmount} vom Unternehmenskonto abgebucht.");
                    return;
                }
            }
            catch (Exception e)
            {
                Alt.Log($"{e}");
            }
        }
コード例 #17
0
ファイル: Functions.cs プロジェクト: h04X-2K/ValeaRP
 public async Task LSPDAppSearchPerson(IPlayer player, string targetCharname)
 {
     try
     {
         if (player == null || !player.Exists || targetCharname == "")
         {
             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 (!Characters.ExistCharacterName(targetCharname))
         {
             HUDHandler.SendNotification(player, 3, 5000, "Fehler: Der eingegebene Name wurde nicht gefunden."); return;
         }
         int targetCharId = Characters.GetCharacterIdFromCharName(targetCharname);
         if (targetCharId <= 0)
         {
             return;
         }
         string charName        = Characters.GetCharacterName(targetCharId);
         string gender          = "Unbekannt";
         string birthdate       = Characters.GetCharacterBirthdate(targetCharId);
         string birthplace      = Characters.GetCharacterBirthplace(targetCharId);
         string address         = $"{Characters.GetCharacterStreet(targetCharId)}";
         string job             = Characters.GetCharacterJob(targetCharId);
         string mainBankAccount = "Nicht vorhanden";
         string firstJoinDate   = $"{Characters.GetCharacterFirstJoinDate(targetCharId).ToString("d", CultureInfo.CreateSpecificCulture("de-DE"))}";
         if (job == "None")
         {
             job = "Arbeitslos";
         }
         if (CharactersBank.HasCharacterBankMainKonto(targetCharId))
         {
             mainBankAccount = $"{CharactersBank.GetCharacterBankMainKonto(targetCharId)}";
         }
         if (Characters.GetCharacterGender(targetCharId))
         {
             gender = "Weiblich";
         }
         else
         {
             gender = "Männlich";
         }
         player.EmitLocked("Client:Tablet:SetLSPDAppPersonSearchData", charName, gender, birthdate, birthplace, address, job, mainBankAccount, firstJoinDate);
         HUDHandler.SendNotification(player, 2, 1500, $"Personenabfrage durchgeführt: {charName}.");
     }
     catch (Exception e)
     {
         Alt.Log($"{e}");
     }
 }
コード例 #18
0
        internal static void OpenGarageCEF(IPlayer player, int garageId)
        {
            try
            {
                Stopwatch stopwatch = new Stopwatch();
                stopwatch.Start();

                if (player == null || !player.Exists || garageId == 0)
                {
                    return;
                }
                int charId = User.GetPlayerOnline(player);
                if (charId <= 0)
                {
                    return;
                }
                var garageInfo  = ServerGarages.ServerGarages_.FirstOrDefault(x => x.id == garageId);
                var garageSlots = ServerGarages.ServerGarageSlots_.Where(x => x.garageId == garageId).ToList();
                if (garageInfo == null || !garageSlots.Any())
                {
                    return;
                }
                if (!player.Position.IsInRange(new Position(garageInfo.posX, garageInfo.posY, garageInfo.posZ), 2f))
                {
                    return;
                }
                var  charFaction     = ServerFactions.GetCharacterFactionId(charId);
                var  factionCut      = ServerFactions.GetFactionShortName(charFaction);
                bool charFactionDuty = ServerFactions.IsCharacterInFactionDuty(charId);
                var  inString        = "";
                var  outString       = "";
                var  garageName      = "";
                //0 Auto | 1 Boot | 2 Flugzeug | 3 Heli
                if (garageInfo.type == 0)
                {
                    garageName = $"Fahrzeuggarage: {garageInfo.name}";
                }
                else if (garageInfo.type == 1)
                {
                    garageName = $"Bootsgarage: {garageInfo.name}";
                }
                else if (garageInfo.type == 2)
                {
                    garageName = $"Flugzeuggarage: {garageInfo.name}";
                }
                else if (garageInfo.type == 3)
                {
                    garageName = $"Heligarage: {garageInfo.name}";
                }

                if (garageInfo.name.Contains("Fraktion"))
                {
                    if (charFaction <= 0)
                    {
                        HUDHandler.SendNotification(player, 4, 5000, $"Keine Berechtigung."); return;
                    }
                    var gFactionCut = garageInfo.name.Split(" ")[1]; //Fraktion LSPD Mission Row  <- Beispiel
                    if (gFactionCut != factionCut)
                    {
                        HUDHandler.SendNotification(player, 4, 5000, $"Keine Berechtigung [002]."); return;
                    }
                    /*if(!charFactionDuty) { HUDHandler.SendNotification(player, 4, 5000, $"Keine Berechtigung (nicht im Dienst)."); return; }*/
                    inString  = GetGarageParkInString(player, garageSlots, charId, garageId, true, factionCut, charFaction);
                    outString = GetGarageParkOutString(player, garageId, charId, true, factionCut);
                    player.EmitLocked("Client:Garage:OpenGarage", garageId, garageName, inString, outString);
                    stopwatch.Stop();
                    if (stopwatch.Elapsed.Milliseconds > 30)
                    {
                        Alt.Log($"{charId} - OpenGarageCEF benötigte {stopwatch.Elapsed.Milliseconds}ms");
                    }
                    return;
                }

                inString  = GetGarageParkInString(player, garageSlots, charId, garageId, false, "Zivilist", charFaction); //Array von Fahrzeugen die um die Garage rum zum Einparken stehen
                outString = GetGarageParkOutString(player, garageId, charId, false, "Zivilist");
                Global.mGlobal.VirtualAPI.TriggerClientEventSafe(player, "Client:Garage:OpenGarage", garageId, garageName, inString, outString);


                stopwatch.Stop();
                if (stopwatch.Elapsed.Milliseconds > 30)
                {
                    Alt.Log($"{charId} - OpenGarageCEF benötigte {stopwatch.Elapsed.Milliseconds}ms");
                }
            }
            catch (Exception e)
            {
                Alt.Log($"{e}");
            }
        }
コード例 #19
0
ファイル: SmartphoneHandler.cs プロジェクト: h04X-2K/ValeaRP
        public async Task SearchLSPDIntranetPeople(ClassicPlayer player, string name)
        {
            try
            {
                if (player == null || !player.Exists || player.CharacterId <= 0 || string.IsNullOrWhiteSpace(name) || !ServerFactions.IsCharacterInAnyFaction(player.CharacterId) || !ServerFactions.IsCharacterInFactionDuty(player.CharacterId) || (ServerFactions.GetCharacterFactionId(player.CharacterId) != 2 && ServerFactions.GetCharacterFactionId(player.CharacterId) != 12))
                {
                    return;
                }
                var containedPlayers = Characters.PlayerCharacters.ToList().Where(x => x.charname.ToLower().Contains(name.ToLower()) && User.IsCharacterOnline(x.charId)).Select(x => new
                {
                    x.charId,
                    x.charname,
                }).OrderBy(x => x.charname).Take(15).ToList();

                player.EmitLocked("Client:Smartphone:SetLSPDIntranetSearchedPeople", JsonConvert.SerializeObject(containedPlayers));
            }
            catch (Exception e)
            {
                Alt.Log($"{e}");
            }
        }
コード例 #20
0
        internal static void openShop(IPlayer player, Server_Shops shopPos)
        {
            try
            {
                if (player == null || !player.Exists)
                {
                    return;
                }
                Stopwatch stopwatch = new Stopwatch();
                stopwatch.Start();
                int charId = User.GetPlayerOnline(player);
                if (charId <= 0)
                {
                    return;
                }

                if (shopPos.faction > 0 && shopPos.faction != 0)
                {
                    if (!ServerFactions.IsCharacterInAnyFaction(charId))
                    {
                        HUDHandler.SendNotification(player, 3, 2500, "Kein Zugriff [1]"); return;
                    }
                    if (ServerFactions.GetCharacterFactionId(charId) != shopPos.faction)
                    {
                        HUDHandler.SendNotification(player, 3, 2500, $"Kein Zugriff [{shopPos.faction} - {ServerFactions.GetCharacterFactionId(charId)}]"); return;
                    }
                }

                if (shopPos.neededLicense != "None" && !Characters.HasCharacterPermission(charId, shopPos.neededLicense))
                {
                    HUDHandler.SendNotification(player, 3, 5000, $"Du hast hier keinen Zugriff drauf.");
                    stopwatch.Stop();
                    if (stopwatch.Elapsed.Milliseconds > 30)
                    {
                        Alt.Log($"{charId} - openShop benötigte {stopwatch.Elapsed.Milliseconds}ms");
                    }
                    return;
                }

                if (shopPos.isOnlySelling == false)
                {
                    Global.mGlobal.VirtualAPI.TriggerClientEventSafe(player, "Client:Shop:shopCEFCreateCEF", ServerShopsItems.GetShopShopItems(shopPos.shopId), shopPos.shopId, shopPos.isOnlySelling);
                    stopwatch.Stop();
                    if (stopwatch.Elapsed.Milliseconds > 30)
                    {
                        Alt.Log($"{charId} - openShop benötigte {stopwatch.Elapsed.Milliseconds}ms");
                    }
                    return;
                }
                else if (shopPos.isOnlySelling == true)
                {
                    Global.mGlobal.VirtualAPI.TriggerClientEventSafe(player, "Client:Shop:shopCEFCreateCEF", ServerShopsItems.GetShopSellItems(charId, shopPos.shopId), shopPos.shopId, shopPos.isOnlySelling);
                    stopwatch.Stop();
                    if (stopwatch.Elapsed.Milliseconds > 30)
                    {
                        Alt.Log($"{charId} - openShop benötigte {stopwatch.Elapsed.Milliseconds}ms");
                    }
                    return;
                }
                stopwatch.Stop();
                if (stopwatch.Elapsed.Milliseconds > 30)
                {
                    Alt.Log($"{charId} - openShop benötigte {stopwatch.Elapsed.Milliseconds}ms");
                }
            }
            catch (Exception e)
            {
                Alt.Log($"{e}");
            }
        }
コード例 #21
0
ファイル: SmartphoneHandler.cs プロジェクト: h04X-2K/ValeaRP
        public static async Task requestLSPDIntranetPersonWanteds(ClassicPlayer player, int selectedCharId)
        {
            try
            {
                if (player == null || !player.Exists || player.CharacterId <= 0 || selectedCharId <= 0 || !ServerFactions.IsCharacterInAnyFaction(player.CharacterId) || !ServerFactions.IsCharacterInFactionDuty(player.CharacterId) || (ServerFactions.GetCharacterFactionId(player.CharacterId) != 2 && ServerFactions.GetCharacterFactionId(player.CharacterId) != 12))
                {
                    return;
                }
                string wantedList = JsonConvert.SerializeObject(CharactersWanteds.CharactersWanteds_.Where(x => x.charId == selectedCharId).Select(x => new
                {
                    x.id,
                    x.wantedId,
                    x.givenString,
                }).ToList());

                player.EmitLocked("Client:Smartphone:setLSPDIntranetPersonWanteds", wantedList);
            }
            catch (Exception e)
            {
                Alt.Log($"{e}");
            }
        }
コード例 #22
0
        public async Task buyShopItem(IPlayer player, int shopId, int amount, string itemname)
        {
            if (player == null || !player.Exists || shopId <= 0 || amount <= 0 || itemname == "")
            {
                return;
            }
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            if (player.HasPlayerHandcuffs() || player.HasPlayerRopeCuffs())
            {
                HUDHandler.SendNotification(player, 3, 5000, "Wie willst du das mit Handschellen/Fesseln machen?"); return;
            }
            if (!player.Position.IsInRange(ServerShops.GetShopPosition(shopId), 3f))
            {
                HUDHandler.SendNotification(player, 3, 5000, $"Du bist zu weit vom Shop entfernt."); return;
            }
            int charId = User.GetPlayerOnline(player);

            if (charId == 0)
            {
                return;
            }
            if (ServerShops.GetShopNeededLicense(shopId) != "None" && !Characters.HasCharacterPermission(charId, ServerShops.GetShopNeededLicense(shopId)))
            {
                HUDHandler.SendNotification(player, 3, 5000, $"Du hast hier keinen Zugriff drauf."); return;
            }
            float itemWeight     = ServerItems.GetItemWeight(itemname) * amount;
            float invWeight      = CharactersInventory.GetCharacterItemWeight(charId, "inventory");
            float backpackWeight = CharactersInventory.GetCharacterItemWeight(charId, "backpack");
            int   itemPrice      = ServerShopsItems.GetShopItemPrice(shopId, itemname) * amount;
            int   shopFaction    = ServerShops.GetShopFaction(shopId);

            if (ServerShopsItems.GetShopItemAmount(shopId, itemname) < amount)
            {
                HUDHandler.SendNotification(player, 3, 5000, $"Soviele Gegenstände hat der Shop nicht auf Lager."); return;
            }
            if (invWeight + itemWeight > 15f && backpackWeight + itemWeight > Characters.GetCharacterBackpackSize(Characters.GetCharacterBackpack(charId)))
            {
                HUDHandler.SendNotification(player, 3, 5000, $"Du hast nicht genug Platz in deinen Taschen."); return;
            }

            if (invWeight + itemWeight <= 15f)
            {
                if (shopFaction > 0 && shopFaction != 0)
                {
                    if (!ServerFactions.IsCharacterInAnyFaction(charId))
                    {
                        HUDHandler.SendNotification(player, 3, 2500, "Du hast hier keinen Zugriff drauf [CODE1-2]."); return;
                    }
                    if (ServerFactions.GetCharacterFactionId(charId) != shopFaction)
                    {
                        HUDHandler.SendNotification(player, 3, 2500, $"Du hast hier keinen Zugriff drauf (Gefordert: {shopFaction} - Deine: {ServerFactions.GetCharacterFactionId(charId)}."); return;
                    }
                    if (ServerFactions.GetFactionBankMoney(shopFaction) < itemPrice)
                    {
                        HUDHandler.SendNotification(player, 3, 2500, "Die Frakton hat nicht genügend Geld auf dem Fraktionskonto."); return;
                    }
                    ServerFactions.SetFactionBankMoney(shopFaction, ServerFactions.GetFactionBankMoney(shopFaction) - itemPrice);
                    LoggingService.NewFactionLog(shopFaction, charId, 0, "shop", $"{Characters.GetCharacterName(charId)} hat {itemname} ({amount}x) für {itemPrice}$ erworben.");
                }
                else
                {
                    if (!CharactersInventory.ExistCharacterItem(charId, "Bargeld", "inventory") || CharactersInventory.GetCharacterItemAmount(charId, "Bargeld", "inventory") < itemPrice)
                    {
                        HUDHandler.SendNotification(player, 3, 2500, "Du hast nicht genügend Geld dabei.");
                        return;
                    }
                    CharactersInventory.RemoveCharacterItemAmount(charId, "Bargeld", itemPrice, "inventory");
                }

                CharactersInventory.AddCharacterItem(charId, itemname, amount, "inventory");
                HUDHandler.SendNotification(player, 2, 5000, $"Du hast {itemname} ({amount}x) für {itemPrice} gekauft (Lagerort: Inventar).");
                stopwatch.Stop();
                if (stopwatch.Elapsed.Milliseconds > 30)
                {
                    Alt.Log($"{charId} - buyShopItem benötigte {stopwatch.Elapsed.Milliseconds}ms");
                }
                return;
            }

            if (Characters.GetCharacterBackpack(charId) != "None" && backpackWeight + itemWeight <= Characters.GetCharacterBackpackSize(Characters.GetCharacterBackpack(charId)))
            {
                if (shopFaction > 0 && shopFaction != 0)
                {
                    if (!ServerFactions.IsCharacterInAnyFaction(charId))
                    {
                        HUDHandler.SendNotification(player, 3, 2500, "Du hast hier keinen Zugriff drauf [CODE1]."); return;
                    }
                    if (ServerFactions.GetCharacterFactionId(charId) != shopFaction)
                    {
                        HUDHandler.SendNotification(player, 3, 2500, $"Du hast hier keinen Zugriff drauf (Gefordert: {shopFaction} - Deine: {ServerFactions.GetCharacterFactionId(charId)}."); return;
                    }
                    if (ServerFactions.GetFactionBankMoney(shopFaction) < itemPrice)
                    {
                        HUDHandler.SendNotification(player, 3, 2500, "Die Frakton hat nicht genügend Geld auf dem Fraktionskonto."); return;
                    }
                    ServerFactions.SetFactionBankMoney(shopFaction, ServerFactions.GetFactionBankMoney(shopFaction) - itemPrice);
                    LoggingService.NewFactionLog(shopFaction, charId, 0, "shop", $"{Characters.GetCharacterName(charId)} hat {itemname} ({amount}x) für {itemPrice}$ erworben.");
                }
                else
                {
                    if (!CharactersInventory.ExistCharacterItem(charId, "Bargeld", "inventory") || CharactersInventory.GetCharacterItemAmount(charId, "Bargeld", "inventory") < itemPrice)
                    {
                        HUDHandler.SendNotification(player, 3, 2500, "Du hast nicht genügend Geld dabei.");
                        return;
                    }
                    CharactersInventory.RemoveCharacterItemAmount(charId, "Bargeld", itemPrice, "inventory");
                }

                CharactersInventory.AddCharacterItem(charId, itemname, amount, "backpack");
                HUDHandler.SendNotification(player, 2, 5000, $"Du hast {itemname} ({amount}x) für {itemPrice} gekauft (Lagerort: Rucksack / Tasche).");
                stopwatch.Stop();
                if (stopwatch.Elapsed.Milliseconds > 30)
                {
                    Alt.Log($"{charId} - buyShopItem benötigte {stopwatch.Elapsed.Milliseconds}ms");
                }
                return;
            }
        }
コード例 #23
0
ファイル: SmartphoneHandler.cs プロジェクト: h04X-2K/ValeaRP
        public async Task DeleteLSPDIntranetWanted(ClassicPlayer player, int dbId, int selectedCharId)
        {
            try
            {
                if (player == null || !player.Exists || player.CharacterId <= 0 || dbId <= 0 || !CharactersWanteds.ExistWantedEntry(dbId) || !ServerFactions.IsCharacterInAnyFaction(player.CharacterId) || !ServerFactions.IsCharacterInFactionDuty(player.CharacterId) || (ServerFactions.GetCharacterFactionId(player.CharacterId) != 2 && ServerFactions.GetCharacterFactionId(player.CharacterId) != 12))
                {
                    return;
                }
                CharactersWanteds.RemoveWantedEntry(dbId);
                requestLSPDIntranetPersonWanteds(player, selectedCharId);

                foreach (ClassicPlayer policeMember in Alt.Server.GetPlayers().ToList().Where(x => x != null && x.Exists && ((ClassicPlayer)x).CharacterId > 0 && ServerFactions.IsCharacterInAnyFaction(((ClassicPlayer)x).CharacterId) && (ServerFactions.GetCharacterFactionId(((ClassicPlayer)x).CharacterId) == 2 || ServerFactions.GetCharacterFactionId(((ClassicPlayer)x).CharacterId) == 12)))
                {
                    HUDHandler.SendNotification(policeMember, 1, 3000, $"{Characters.GetCharacterName(player.CharacterId)} hat die Akte von {Characters.GetCharacterName(selectedCharId)} bearbeitet.");
                }
            }
            catch (Exception e)
            {
                Alt.Log($"{e}");
            }
        }
コード例 #24
0
ファイル: KeyHandler.cs プロジェクト: h04X-2K/ValeaRP
        public async Task PressE(IPlayer player)
        {
            lock (player)
            {
                if (player == null || !player.Exists)
                {
                    return;
                }
                int charId = User.GetPlayerOnline(player);
                if (charId == 0)
                {
                    return;
                }

                ClassicColshape farmCol = (ClassicColshape)ServerFarmingSpots.ServerFarmingSpotsColshapes_.FirstOrDefault(x => ((ClassicColshape)x).IsInRange((ClassicPlayer)player));
                if (farmCol != null && !player.IsInVehicle)
                {
                    if (player.HasPlayerHandcuffs() || player.HasPlayerRopeCuffs())
                    {
                        HUDHandler.SendNotification(player, 3, 5000, "Wie willst du das mit Handschellen/Fesseln machen?"); return;
                    }
                    if (player.GetPlayerFarmingActionMeta() != "None")
                    {
                        return;
                    }
                    var farmColData = ServerFarmingSpots.ServerFarmingSpots_.FirstOrDefault(x => x.id == (int)farmCol.GetColShapeId());

                    if (farmColData != null)
                    {
                        if (farmColData.neededItemToFarm != "None")
                        {
                            if (!CharactersInventory.ExistCharacterItem(charId, farmColData.neededItemToFarm, "inventory") && !CharactersInventory.ExistCharacterItem(charId, farmColData.neededItemToFarm, "backpack"))
                            {
                                HUDHandler.SendNotification(player, 3, 3500, $"Zum Farmen benötigst du: {farmColData.neededItemToFarm}."); return;
                            }
                        }
                        player.SetPlayerFarmingActionMeta("farm");
                        FarmingHandler.FarmFieldAction(player, farmColData.itemName, farmColData.itemMinAmount, farmColData.itemMaxAmount, farmColData.animation, farmColData.duration);
                        return;
                    }
                }

                ClassicColshape farmProducerCol = (ClassicColshape)ServerFarmingSpots.ServerFarmingProducerColshapes_.FirstOrDefault(x => ((ClassicColshape)x).IsInRange((ClassicPlayer)player));
                if (farmProducerCol != null && !player.IsInVehicle)
                {
                    if (player.GetPlayerFarmingActionMeta() != "None")
                    {
                        HUDHandler.SendNotification(player, 3, 5000, $"Warte einen Moment."); return;
                    }
                    var farmColData = ServerFarmingSpots.ServerFarmingProducer_.FirstOrDefault(x => x.id == (int)farmProducerCol.GetColShapeId());
                    if (farmColData != null)
                    {
                        FarmingHandler.ProduceItem(player, farmColData.neededItem, farmColData.producedItem, farmColData.neededItemAmount, farmColData.producedItemAmount, farmColData.duration);
                        return;
                    }
                }

                if (((ClassicColshape)Minijobs.Elektrolieferant.Main.startJobShape).IsInRange((ClassicPlayer)player))
                {
                    Minijobs.Elektrolieferant.Main.StartMinijob(player);
                    return;
                }

                if (((ClassicColshape)Minijobs.Pilot.Main.startJobShape).IsInRange((ClassicPlayer)player))
                {
                    Minijobs.Pilot.Main.TryStartMinijob(player);
                    return;
                }

                if (((ClassicColshape)Minijobs.Müllmann.Main.startJobShape).IsInRange((ClassicPlayer)player))
                {
                    Minijobs.Müllmann.Main.StartMinijob(player);
                    return;
                }

                if (((ClassicColshape)Minijobs.Busfahrer.Main.startJobShape).IsInRange((ClassicPlayer)player))
                {
                    Minijobs.Busfahrer.Main.TryStartMinijob(player);
                    return;
                }

                var houseEntrance = ServerHouses.ServerHouses_.FirstOrDefault(x => ((ClassicColshape)x.entranceShape).IsInRange((ClassicPlayer)player));
                if (houseEntrance != null)
                {
                    HouseHandler.openEntranceCEF(player, houseEntrance.id);
                    return;
                }

                var hotelPos = ServerHotels.ServerHotels_.FirstOrDefault(x => player.Position.IsInRange(new Position(x.posX, x.posY, x.posZ), 2f));
                if (hotelPos != null && !player.IsInVehicle)
                {
                    HotelHandler.openCEF(player, hotelPos);
                    return;
                }

                if (player.Dimension >= 5000)
                {
                    int houseInteriorCount = ServerHouses.GetMaxInteriorsCount();
                    for (var i = 1; i <= houseInteriorCount; i++)
                    {
                        if (i > houseInteriorCount || i <= 0)
                        {
                            continue;
                        }
                        if ((player.Dimension >= 5000 && player.Dimension < 10000) && player.Position.IsInRange(ServerHouses.GetInteriorExitPosition(i), 2f))
                        {
                            //Apartment Leave
                            HotelHandler.LeaveHotel(player);
                            return;
                        }
                        else if ((player.Dimension >= 5000 && player.Dimension < 10000) && player.Position.IsInRange(ServerHouses.GetInteriorStoragePosition(i), 2f))
                        {
                            //Apartment Storage
                            HotelHandler.openStorage(player);
                            return;
                        }
                        else if (player.Dimension >= 10000 && player.Position.IsInRange(ServerHouses.GetInteriorExitPosition(i), 2f))
                        {
                            //House Leave
                            HouseHandler.LeaveHouse(player, i);
                            return;
                        }
                        else if (player.Dimension >= 10000 && player.Position.IsInRange(ServerHouses.GetInteriorStoragePosition(i), 2f))
                        {
                            //House Storage
                            HouseHandler.openStorage(player);
                            return;
                        }
                        else if (player.Dimension >= 10000 && player.Position.IsInRange(ServerHouses.GetInteriorManagePosition(i), 2f))
                        {
                            //Hausverwaltung
                            HouseHandler.openManageCEF(player);
                            return;
                        }
                    }
                }

                var teleportsPos = ServerItems.ServerTeleports_.FirstOrDefault(x => player.Position.IsInRange(new Position(x.posX, x.posY, x.posZ), 1.5f));
                if (teleportsPos != null && !player.IsInVehicle)
                {
                    player.Position = new Position(teleportsPos.targetX, teleportsPos.targetY, teleportsPos.targetZ + 0.5f);
                    return;
                }

                var shopPos = ServerShops.ServerShops_.FirstOrDefault(x => player.Position.IsInRange(new Position(x.posX, x.posY, x.posZ), 3f));
                if (shopPos != null && !player.IsInVehicle)
                {
                    if (player.HasPlayerHandcuffs() || player.HasPlayerRopeCuffs())
                    {
                        HUDHandler.SendNotification(player, 3, 5000, "Wie willst du das mit Handschellen/Fesseln machen?"); return;
                    }
                    ShopHandler.openShop(player, shopPos);
                    return;
                }

                var garagePos = ServerGarages.ServerGarages_.FirstOrDefault(x => player.Position.IsInRange(new Position(x.posX, x.posY, x.posZ), 2f));
                if (garagePos != null && !player.IsInVehicle)
                {
                    GarageHandler.OpenGarageCEF(player, garagePos.id);
                    return;
                }

                var clothesStoragePos = ServerClothesStorages.ServerClothesStorages_.ToList().FirstOrDefault(x => player.Position.IsInRange(new Position(x.posX, x.posY, x.posZ), 5f));
                if (clothesStoragePos != null && !player.IsInVehicle)
                {
                    ServerClothesStorages.RequestClothesStorage((ClassicPlayer)player, clothesStoragePos.id);
                    return;
                }

                var clothesShopPos = ServerClothesShops.ServerClothesShops_.FirstOrDefault(x => player.Position.IsInRange(new Position(x.posX, x.posY, x.posZ), 6f));
                if (clothesShopPos != null && !player.IsInVehicle)
                {
                    ShopHandler.openClothesShop((ClassicPlayer)player, clothesShopPos.id);
                    return;
                }

                var tattooShop = ServerTattooShops.ServerTattooShops_.ToList().FirstOrDefault(x => x.owner != 0 && player.Position.IsInRange(new Position(x.pedX, x.pedY, x.pedZ), 2.5f));
                if (tattooShop != null && !player.IsInVehicle)
                {
                    ShopHandler.openTattooShop((ClassicPlayer)player, tattooShop);
                    return;
                }

                var vehicleShopPos = ServerVehicleShops.ServerVehicleShops_.FirstOrDefault(x => player.Position.IsInRange(new Position(x.pedX, x.pedY, x.pedZ), 2f));
                if (vehicleShopPos != null && !player.IsInVehicle)
                {
                    if (vehicleShopPos.neededLicense != "None" && !Characters.HasCharacterPermission(charId, vehicleShopPos.neededLicense))
                    {
                        HUDHandler.SendNotification(player, 3, 5000, $"Du hast hier keinen Zugriff drauf."); return;
                    }
                    ShopHandler.OpenVehicleShop(player, vehicleShopPos.name, vehicleShopPos.id);
                    return;
                }

                var bankPos = ServerBanks.ServerBanks_.FirstOrDefault(x => player.Position.IsInRange(new Position(x.posX, x.posY, x.posZ), 1f));
                if (bankPos != null && !player.IsInVehicle)
                {
                    if (bankPos.zoneName == "Maze Bank Fraktion")
                    {
                        if (!ServerFactions.IsCharacterInAnyFaction(charId))
                        {
                            return;
                        }
                        if (ServerFactions.GetCharacterFactionRank(charId) != ServerFactions.GetFactionMaxRankCount(ServerFactions.GetCharacterFactionId(charId)) && ServerFactions.GetCharacterFactionRank(charId) != ServerFactions.GetFactionMaxRankCount(ServerFactions.GetCharacterFactionId(charId)) - 1)
                        {
                            return;
                        }
                        player.EmitLocked("Client:FactionBank:createCEF", "faction", ServerFactions.GetCharacterFactionId(charId), ServerFactions.GetFactionBankMoney(ServerFactions.GetCharacterFactionId(charId)));
                        return;
                    }
                    else if (bankPos.zoneName == "Maze Bank Company")
                    {
                        if (!ServerCompanys.IsCharacterInAnyServerCompany(charId))
                        {
                            return;
                        }
                        if (ServerCompanys.GetCharacterServerCompanyRank(charId) != 1 && ServerCompanys.GetCharacterServerCompanyRank(charId) != 2)
                        {
                            HUDHandler.SendNotification(player, 3, 5000, "Du hast kein Unternehmen auf welches du zugreifen kannst."); return;
                        }
                        player.EmitLocked("Client:FactionBank:createCEF", "company", ServerCompanys.GetCharacterServerCompanyId(charId), ServerCompanys.GetServerCompanyMoney(ServerCompanys.GetCharacterServerCompanyId(charId)));
                        return;
                    }
                    else
                    {
                        var bankArray = CharactersBank.GetCharacterBankAccounts(charId);
                        player.EmitLocked("Client:Bank:createBankAccountManageForm", bankArray, bankPos.zoneName);
                        return;
                    }
                }

                var barberPos = ServerBarbers.ServerBarbers_.FirstOrDefault(x => player.Position.IsInRange(new Position(x.posX, x.posY, x.posZ), 2f));
                if (barberPos != null && !player.IsInVehicle)
                {
                    player.EmitLocked("Client:Barber:barberCreateCEF", Characters.GetCharacterHeadOverlays(charId));
                    return;
                }

                if (player.Position.IsInRange(Constants.Positions.VehicleLicensing_Position, 3f))
                {
                    if (player.HasPlayerHandcuffs() || player.HasPlayerRopeCuffs())
                    {
                        HUDHandler.SendNotification(player, 3, 5000, "Wie willst du das mit Handschellen/Fesseln machen?"); return;
                    }
                    VehicleHandler.OpenLicensingCEF(player);
                    return;
                }

                if (ServerFactions.IsCharacterInAnyFaction(charId))
                {
                    int factionId      = ServerFactions.GetCharacterFactionId(charId);
                    var factionDutyPos = ServerFactions.ServerFactionPositions_.FirstOrDefault(x => x.factionId == factionId && x.posType == "duty" && player.Position.IsInRange(new Position(x.posX, x.posY, x.posZ), 2f));
                    if (factionDutyPos != null && !player.IsInVehicle)
                    {
                        bool isDuty = ServerFactions.IsCharacterInFactionDuty(charId);
                        ServerFactions.SetCharacterInFactionDuty(charId, !isDuty);
                        if (isDuty)
                        {
                            HUDHandler.SendNotification(player, 2, 5000, "Du hast dich erfolgreich vom Dienst abgemeldet.");
                        }
                        else
                        {
                            HUDHandler.SendNotification(player, 2, 5000, "Du hast dich erfolgreich zum Dienst angemeldet.");
                        }
                        if (factionId == 2 || factionId == 12)
                        {
                            SmartphoneHandler.RequestLSPDIntranet((ClassicPlayer)player);
                        }
                        return;
                    }

                    var factionStoragePos = ServerFactions.ServerFactionPositions_.FirstOrDefault(x => x.factionId == factionId && x.posType == "storage" && player.Position.IsInRange(new Position(x.posX, x.posY, x.posZ), 2f));
                    if (factionStoragePos != null && !player.IsInVehicle)
                    {
                        if (player.HasPlayerHandcuffs() || player.HasPlayerRopeCuffs())
                        {
                            HUDHandler.SendNotification(player, 3, 5000, "Wie willst du das mit Handschellen/Fesseln machen?"); return;
                        }
                        bool isDuty = ServerFactions.IsCharacterInFactionDuty(charId);
                        if (isDuty)
                        {
                            var factionStorageContent = ServerFactions.GetServerFactionStorageItems(factionId, charId); //Fraktionsspind Items
                            var CharacterInvArray     = CharactersInventory.GetCharacterInventory(charId);              //Spieler Inventar
                            player.EmitLocked("Client:FactionStorage:openCEF", charId, factionId, "faction", CharacterInvArray, factionStorageContent);
                            return;
                        }
                    }

                    var factionServicePhonePos = ServerFactions.ServerFactionPositions_.ToList().FirstOrDefault(x => x.factionId == factionId && x.posType == "servicephone" && player.Position.IsInRange(new Position(x.posX, x.posY, x.posZ), 2f));
                    if (factionServicePhonePos != null && !player.IsInVehicle && ServerFactions.IsCharacterInFactionDuty(charId))
                    {
                        ServerFactions.UpdateCurrentServicePhoneOwner(factionId, charId);
                        ServerFactions.sendMsg(factionId, $"{Characters.GetCharacterName(charId)} hat das Leitstellentelefon deiner Fraktion übernommen.");
                        return;
                    }
                }

                if (player.Position.IsInRange(Constants.Positions.Jobcenter_Position, 2.5f) && !Characters.IsCharacterCrimeFlagged(charId) && !player.IsInVehicle) //Arbeitsamt
                {
                    TownhallHandler.createJobcenterBrowser(player);
                    return;
                }

                if (player.Position.IsInRange(Constants.Positions.TownhallHouseSelector, 2.5f))
                {
                    TownhallHandler.openHouseSelector(player);
                    return;
                }

                if (player.Position.IsInRange(Constants.Positions.IdentityCardApply, 2.5f) && Characters.GetCharacterAccState(charId) == 0 && !player.IsInVehicle) //Rathaus IdentityCardApply
                {
                    TownhallHandler.tryCreateIdentityCardApplyForm(player);
                    return;
                }
            }
        }