コード例 #1
0
        public async Task buyClothesShopItem(ClassicPlayer player, int shopId, int amount, string clothesName)
        {
            try
            {
                if (player == null || !player.Exists || player.CharacterId <= 0 || !ServerClothesShops.ExistClothesShop(shopId) || amount <= 0 || !ServerClothes.ExistClothes(clothesName))
                {
                    return;
                }
                if (CharactersClothes.ExistCharacterClothes(player.CharacterId, clothesName))
                {
                    HUDHandler.SendNotification(player, 3, 2500, "Dieses Anziehteil besitzt du bereits.");
                    return;
                }

                if (ServerClothes.GetClothesType(clothesName) == "Torso")
                {
                    Characters.SwitchCharacterClothes(player, "Torso", clothesName);
                    return;
                }

                int price = ServerClothesShops.GetClothesPrice(shopId, clothesName) * amount;
                if (!CharactersInventory.ExistCharacterItem(player.CharacterId, "Bargeld", "inventory") || CharactersInventory.GetCharacterItemAmount(player.CharacterId, "Bargeld", "inventory") < price)
                {
                    return;
                }
                CharactersInventory.RemoveCharacterItemAmount(player.CharacterId, "Bargeld", price, "inventory");
                CharactersClothes.CreateCharacterOwnedClothes(player.CharacterId, clothesName);
                Characters.SwitchCharacterClothes(player, ServerClothes.GetClothesType(clothesName), clothesName);
            }
            catch (Exception e)
            {
                Alt.Log($"{e}");
            }
        }
コード例 #2
0
 public async Task ClientEvent_buyTattoo(ClassicPlayer player, int shopId, int tattooId)
 {
     try
     {
         if (player == null || !player.Exists || player.CharacterId <= 0 || shopId <= 0 || tattooId <= 0 || !ServerTattoos.ExistTattoo(tattooId) || CharactersTattoos.ExistAccountTattoo(player.CharacterId, tattooId) || !ServerTattooShops.ExistTattooShop(shopId))
         {
             return;
         }
         int price = ServerTattoos.GetTattooPrice(tattooId);
         if (!CharactersInventory.ExistCharacterItem(player.CharacterId, "Bargeld", "inventory") || CharactersInventory.GetCharacterItemAmount(player.CharacterId, "Bargeld", "inventory") < price)
         {
             HUDHandler.SendNotification(player, 4, 5000, $"Fehler: Du hast nicht genügend Geld dabei ({price}$).");
             return;
         }
         CharactersInventory.RemoveCharacterItemAmount(player.CharacterId, "Bargeld", price, "inventory");
         ServerTattooShops.SetTattooShopBankMoney(shopId, ServerTattooShops.GetTattooShopBank(shopId) + price);
         CharactersTattoos.CreateNewEntry(player.CharacterId, tattooId);
         HUDHandler.SendNotification(player, 2, 1500, $"Du hast das Tattoo '{ServerTattoos.GetTattooName(tattooId)}' für {price}$ gekauft.");
         player.updateTattoos();
     }
     catch (Exception e)
     {
         Console.WriteLine($"{e}");
     }
 }
コード例 #3
0
        public static async Task SetPlayerOnline(ClassicPlayer player, int charId)
        {
            if (player == null || !player.Exists)
            {
                return;
            }
            player.SetCharacterMetaId(Convert.ToUInt64(charId));

            var pl = Player.FirstOrDefault(p => p.socialClub == player.SocialClubId);

            if (pl != null)
            {
                player.CharacterId = charId;
                pl.Online          = charId;

                try
                {
                    using (gtaContext db = new gtaContext())
                    {
                        db.Accounts.Update(pl);
                        db.SaveChanges();
                    }
                }
                catch (Exception e)
                {
                    Alt.Log($"{e}");
                }
            }
        }
コード例 #4
0
ファイル: DeathHandler.cs プロジェクト: h04X-2K/ValeaRP
        public async Task OnPlayerDeath(ClassicPlayer player, IEntity killer, uint weapon)
        {
            try
            {
                if (player == null || !player.Exists)
                {
                    return;
                }
                int charId = (int)player.GetCharacterMetaId();
                if (charId <= 0)
                {
                    return;
                }
                if (Characters.IsCharacterUnconscious(charId))
                {
                    return;
                }
                if (Characters.IsCharacterInJail(charId))
                {
                    player.Spawn(new Position(1691.4594f, 2565.7056f, 45.556763f), 0);
                    player.Position = new Position(1691.4594f, 2565.7056f, 45.556763f);
                    return;
                }
                openDeathscreen(player);
                Characters.SetCharacterUnconscious(charId, true, 10); // Von 15 auf 10 geändert.
                ServerFactions.createFactionDispatch(player, 3, $"HandyNotruf", $"Eine Verletzte Person wurde gemeldet");

                ClassicPlayer killerPlayer = (ClassicPlayer)killer;
                if (killerPlayer == null || !killerPlayer.Exists)
                {
                    return;
                }
                WeaponModel weaponModel = (WeaponModel)weapon;
                if (weaponModel == WeaponModel.Fist)
                {
                    return;
                }
                foreach (IPlayer p in Alt.Server.GetPlayers().ToList().Where(x => x != null && x.Exists && ((ClassicPlayer)x).CharacterId > 0 && x.AdminLevel() > 0))
                {
                    p.SendChatMessage($"{Characters.GetCharacterName(killerPlayer.CharacterId)} ({killerPlayer.CharacterId}) hat {Characters.GetCharacterName(player.CharacterId)} ({player.CharacterId}) getötet. Waffe: {weaponModel}");
                    LoggingService.NewDeathLog(player.CharacterId, killerPlayer.CharacterId, weapon);
                }
                if (Enum.IsDefined(typeof(AntiCheat.forbiddenWeapons), (Utils.AntiCheat.forbiddenWeapons)weaponModel))
                {
                    User.SetPlayerBanned(killerPlayer, true, $"Waffen Hack[2]: {weaponModel}");
                    killerPlayer.Kick("");
                    player.Health = 200;
                    foreach (IPlayer p in Alt.Server.GetPlayers().ToList().Where(x => x != null && x.Exists && ((ClassicPlayer)x).CharacterId > 0 && x.AdminLevel() > 0))
                    {
                        p.SendChatMessage($"{Characters.GetCharacterName(killerPlayer.CharacterId)} wurde gebannt: Waffenhack[2] - {weaponModel}");
                    }
                    return;
                }
            }
            catch (Exception e)
            {
                Alt.Log($"{e}");
            }
        }
コード例 #5
0
        public async Task robShop(ClassicPlayer player, int shopId)
        {
            try
            {
                if (player == null || !player.Exists || player.CharacterId <= 0 || shopId <= 0)
                {
                    return;
                }
                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 entfernt."); return;
                }
                if (player.isRobbingAShop)
                {
                    HUDHandler.SendNotification(player, 4, 2500, "Du raubst bereits einen Shop aus.");
                    return;
                }

                if (ServerShops.IsShopRobbedNow(shopId))
                {
                    HUDHandler.SendNotification(player, 3, 2500, "Dieser Shop wird bereits ausgeraubt.");
                    return;
                }

                ServerFactions.AddNewFactionDispatch(0, 2, $"Aktiver Shopraub", player.Position);
                ServerFactions.AddNewFactionDispatch(0, 12, $"Aktiver Shopraub", player.Position);

                ServerShops.SetShopRobbedNow(shopId, true);
                player.isRobbingAShop = true;
                //HUDHandler.SendNotification(player, 1, 2500, "Du raubst den Laden nun aus - warte 8 Minuten um das Geld zu erhalten.");
                HUDHandler.SendNotification(player, 1, 2500, "Du raubst den Laden nun aus - warte 30 Sekunden um das Geld zu erhalten.");
                //await Task.Delay(480000);
                await Task.Delay(30000);

                ServerShops.SetShopRobbedNow(shopId, false);
                if (player == null || !player.Exists)
                {
                    return;
                }
                player.isRobbingAShop = false;
                if (!player.Position.IsInRange(ServerShops.GetShopPosition(shopId), 12f))
                {
                    HUDHandler.SendNotification(player, 3, 5000, "Du bist zu weit entfernt, der Raub wurde abgebrochen.");
                    return;
                }

                int amount = new Random().Next(6000, 9000);
                HUDHandler.SendNotification(player, 2, 2500, $"Shop ausgeraubt - du erhälst {amount}$.");
                CharactersInventory.AddCharacterItem(player.CharacterId, "Bargeld", amount, "inventory");
            }
            catch (Exception e)
            {
                Alt.Log($"{e}");
            }
        }
コード例 #6
0
 public static void updateTattoos(this ClassicPlayer player)
 {
     if (player == null || !player.Exists || player.CharacterId <= 0)
     {
         return;
     }
     player.EmitAsync("Client:Utilities:setTattoos", Model.CharactersTattoos.GetAccountTattoos(player.CharacterId));
 }
コード例 #7
0
 public async Task requestATMBankData(ClassicPlayer player, int accountNumber)
 {
     if (player == null || !player.Exists || player.CharacterId <= 0)
     {
         return;
     }
     player.EmitLocked("Client:ATM:BankATMSetRequestedData", CharactersBank.GetBankAccountMoney(accountNumber), ServerBankPapers.GetBankAccountBankPaper(player, accountNumber));
 }
コード例 #8
0
 public static bool IsCefOpen(this ClassicPlayer player)
 {
     if (player == null || !player.Exists)
     {
         return(false);
     }
     player.GetSyncedMetaData("IsCefOpen", out bool isCefOpened);
     return(isCefOpened);
 }
コード例 #9
0
ファイル: SmartphoneHandler.cs プロジェクト: h04X-2K/ValeaRP
        public async Task denyCall(ClassicPlayer player)
        {
            try
            {
                if (player == null || !player.Exists || player.CharacterId <= 0)
                {
                    return;
                }
                if (Characters.GetCharacterCurrentlyRecieveCaller(player.CharacterId) != 0)
                {
                    var           callerId     = Characters.GetCharacterCurrentlyRecieveCaller(player.CharacterId); //ID vom Spieler der Anruft
                    ClassicPlayer targetPlayer = (ClassicPlayer)Alt.Server.GetPlayers().ToList().FirstOrDefault(x => x != null && x.Exists && ((ClassicPlayer)x).CharacterId == callerId);
                    if (targetPlayer != null && targetPlayer.Exists && targetPlayer.CharacterId > 0)
                    {
                        Characters.SetCharacterTargetPhoneNumber(targetPlayer.CharacterId, 0);
                        Characters.SetCharacterCurrentlyRecieveCallState(targetPlayer.CharacterId, 0);
                        targetPlayer.EmitLocked("Client:Smartphone:ShowPhoneCallError", 4);
                        //HUDHandler.SendNotification(targetPlayer, 3, 2000, "AnrufTry beendet");
                    }

                    Characters.SetCharacterCurrentlyRecieveCallState(player.CharacterId, 0);
                    Characters.SetCharacterTargetPhoneNumber(player.CharacterId, 0);
                    player.EmitLocked("Client:Smartphone:ShowPhoneCallError", 4);
                    //HUDHandler.SendNotification(player, 3, 2000, "AnrufTry beendet");
                    return;
                }

                if (Characters.GetCharacterPhoneTargetNumber(player.CharacterId) != 0)
                {
                    var phoneNumber = Characters.GetCharacterPhoneTargetNumber(player.CharacterId);
                    if (!Characters.ExistPhoneNumber(phoneNumber))
                    {
                        return;
                    }
                    ClassicPlayer targetPlayer = (ClassicPlayer)Alt.Server.GetPlayers().ToList().FirstOrDefault(x => x != null && x.Exists && ((ClassicPlayer)x).CharacterId > 0 && Characters.GetCharacterPhonenumber(((ClassicPlayer)x).CharacterId) == phoneNumber && Characters.GetCharacterPhoneTargetNumber(((ClassicPlayer)x).CharacterId) == Characters.GetCharacterPhonenumber(player.CharacterId));
                    if (targetPlayer != null && targetPlayer.Exists && targetPlayer.CharacterId > 0)
                    {
                        Characters.SetCharacterTargetPhoneNumber(targetPlayer.CharacterId, 0);
                        Characters.SetCharacterCurrentlyRecieveCallState(targetPlayer.CharacterId, 0);
                        targetPlayer.EmitLocked("SaltyChat_EndCall", player);
                        targetPlayer.EmitLocked("Client:Smartphone:ShowPhoneCallError", 4);
                        HUDHandler.SendNotification(targetPlayer, 3, 2000, "Anruf beendet");
                    }

                    Characters.SetCharacterTargetPhoneNumber(player.CharacterId, 0);
                    Characters.SetCharacterCurrentlyRecieveCallState(player.CharacterId, 0);
                    player.EmitLocked("SaltyChat_EndCall", targetPlayer);
                    player.EmitLocked("Client:Smartphone:ShowPhoneCallError", 4);
                    HUDHandler.SendNotification(player, 3, 2000, "Anruf beendet");
                    return;
                }
            }
            catch (Exception e)
            {
                Alt.Log($"{e}");
            }
        }
コード例 #10
0
ファイル: InventoryHandler.cs プロジェクト: h04X-2K/ValeaRP
        public async Task switchItemToDifferentInv(ClassicPlayer player, string itemname, int itemAmount, string fromContainer, string toContainer)
        {
            try
            {
                if (player == null || !player.Exists || itemname == "" || itemAmount <= 0 || fromContainer == "" || toContainer == "" || User.GetPlayerOnline(player) == 0)
                {
                    return;
                }
                if (player.HasPlayerHandcuffs() || player.HasPlayerRopeCuffs())
                {
                    HUDHandler.SendNotification(player, 3, 5000, "Wie willst du das mit Handschellen/Fesseln machen?"); return;
                }
                int    charId         = player.CharacterId;
                string normalName     = ServerItems.ReturnNormalItemName(itemname);
                float  itemWeight     = ServerItems.GetItemWeight(itemname) * itemAmount;
                float  invWeight      = CharactersInventory.GetCharacterItemWeight(charId, "inventory");
                float  backpackWeight = CharactersInventory.GetCharacterItemWeight(charId, "backpack");
                if (!CharactersInventory.ExistCharacterItem(charId, itemname, fromContainer))
                {
                    return;
                }

                if (toContainer == "inventory")
                {
                    if (invWeight + itemWeight > 15f)
                    {
                        HUDHandler.SendNotification(player, 3, 5000, $"Soviel Platz hast du im Inventar nicht."); return;
                    }
                }
                else if (toContainer == "backpack")
                {
                    if (backpackWeight + itemWeight > Characters.GetCharacterBackpackSize(Characters.GetCharacterBackpack(charId)))
                    {
                        HUDHandler.SendNotification(player, 3, 5000, $"Soviel Platz hast du in deinen Taschen / deinem Rucksack nicht."); return;
                    }
                }

                if (CharactersInventory.GetCharacterItemAmount(charId, itemname, fromContainer) < itemAmount)
                {
                    HUDHandler.SendNotification(player, 4, 5000, "Die angegebene Item-Anzahl ist größer als die Anzahl der Items die du mit dir trägst."); return;
                }
                if (itemname == "Rucksack" || itemname == "Tasche" || normalName == "Ausweis" || normalName == "Bargeld" || normalName == "Smartphone" || normalName == "EC Karte" || normalName == "Fahrzeugschluessel")
                {
                    HUDHandler.SendNotification(player, 3, 5000, "Diesen Gegenstand kannst du nicht in deinen Rucksack / deine Tache legen."); return;
                }
                CharactersInventory.RemoveCharacterItemAmount(charId, itemname, itemAmount, fromContainer);
                CharactersInventory.AddCharacterItem(charId, itemname, itemAmount, toContainer);
                HUDHandler.SendNotification(player, 2, 5000, $"Der Gegenstand {itemname} ({itemAmount}x) wurde erfolgreich vom ({fromContainer}) in ({toContainer}) verschoben.");
                RequestInventoryItems(player);
            }
            catch (Exception e)
            {
                Alt.Log($"{e}");
            }
        }
コード例 #11
0
        internal static async void openTattooShop(ClassicPlayer player, Server_Tattoo_Shops tattooShop)
        {
            if (player == null || !player.Exists || player.CharacterId <= 0 || player.IsCefOpen() || tattooShop == null)
            {
                return;
            }
            await LoginHandler.setCefStatus(player, true);

            int gender = Convert.ToInt32(Characters.GetCharacterGender(player.CharacterId));

            player.EmitAsync("Client:TattooShop:openShop", gender, tattooShop.id, CharactersTattoos.GetAccountOwnTattoos(player.CharacterId));
        }
コード例 #12
0
ファイル: SmartphoneHandler.cs プロジェクト: h04X-2K/ValeaRP
 public async Task setFlyModeEnabled(ClassicPlayer player, bool isEnabled)
 {
     try
     {
         if (player == null || !player.Exists || player.CharacterId <= 0)
         {
             return;
         }
         Characters.SetCharacterPhoneFlyModeEnabled(player.CharacterId, isEnabled);
     }
     catch (Exception e)
     {
         Alt.Log($"{e}");
     }
 }
コード例 #13
0
ファイル: SmartphoneHandler.cs プロジェクト: h04X-2K/ValeaRP
 public async Task PlayerDisconnect(ClassicPlayer player, string reason)
 {
     try
     {
         if (player == null || !player.Exists || player.CharacterId <= 0)
         {
             return;
         }
         denyCall(player);
         Characters.SetCharacterCurrentFunkFrequence(player.CharacterId, null);
     }
     catch (Exception e)
     {
         Alt.Log($"{e}");
     }
 }
コード例 #14
0
    public override void _Ready()
    {
        ScoreLabel  = GetNode <Label>("HUD/Score");
        LivesLabel  = GetNode <Label>("HUD/Lives");
        Player      = GetNode <ClassicPlayer>("ClassicPlayer");
        Player.Game = this;
        MoveTimer   = GetNode <Timer>("MoveTimer");
        BonusTimer  = GetNode <Timer>("BonusTimer");
        Enemies     = GetNode <Node2D>("Enemies");
        StepSound   = GetNode <AudioStreamPlayer>("StepSound");
        EnemyCount  = Enemies.GetChildren().Count;

        GameOver           = GetNode <Control>("HUD/GameOver");
        GameOverLabel      = GetNode <Label>("HUD/GameOver/Box/Text");
        GameOverScoreLabel = GetNode <Label>("HUD/GameOver/Box/Score");
    }
コード例 #15
0
 public static void CMD_Unban(ClassicPlayer player, int accId)
 {
     try
     {
         if (player == null || !player.Exists || player.CharacterId <= 0 || accId <= 0 || player.AdminLevel() <= 3)
         {
             return;
         }
         User.SetPlayerBanned(accId, false, "");
         HUDHandler.SendNotification(player, 4, 5000, $"Spieler mit ID {accId} Erfolgreich entbannt.");
     }
     catch (Exception e)
     {
         Alt.Log($"{e}");
     }
 }
コード例 #16
0
ファイル: SmartphoneHandler.cs プロジェクト: h04X-2K/ValeaRP
 public async Task deleteChat(ClassicPlayer player, int chatId)
 {
     try
     {
         if (player == null || !player.Exists || player.CharacterId <= 0 || chatId <= 0 || !CharactersPhone.ExistChatById(chatId))
         {
             return;
         }
         CharactersPhone.DeletePhoneChat(chatId);
         requestSmartphoneChats(player);
     }
     catch (Exception e)
     {
         Alt.Log($"{e}");
     }
 }
コード例 #17
0
 public async Task ClientEvent_deleteTattoo(ClassicPlayer player, int tattooId)
 {
     try
     {
         if (player == null || !player.Exists || player.CharacterId <= 0 || tattooId <= 0 || !CharactersTattoos.ExistAccountTattoo(player.CharacterId, tattooId))
         {
             return;
         }
         CharactersTattoos.RemoveAccountTattoo(player.CharacterId, tattooId);
         HUDHandler.SendNotification(player, 2, 1500, $"Du hast das Tattoo '{ServerTattoos.GetTattooName(tattooId)}' erfolgreich entfernen lassen.");
         player.updateTattoos();
     }
     catch (Exception e)
     {
         Console.WriteLine($"{e}");
     }
 }
コード例 #18
0
ファイル: SmartphoneHandler.cs プロジェクト: h04X-2K/ValeaRP
 public async Task leaveRadioFrequence(ClassicPlayer player)
 {
     try
     {
         if (player == null || !player.Exists || player.CharacterId <= 0 || Characters.GetCharacterCurrentFunkFrequence(player.CharacterId) == null)
         {
             return;
         }
         string currentFrequence = Characters.GetCharacterCurrentFunkFrequence(player.CharacterId);
         Characters.SetCharacterCurrentFunkFrequence(player.CharacterId, null);
         player.EmitLocked("Client:Smartphone:setCurrentFunkFrequence", "null");
         Alt.Emit("Server:SaltyChat:leaveRadioFrequence", player, currentFrequence);
     }
     catch (Exception e)
     {
         Console.WriteLine($"{e}");
     }
 }
コード例 #19
0
ファイル: LoginHandler.cs プロジェクト: h04X-2K/ValeaRP
 public async Task OnPlayerDisconnected_Handler(ClassicPlayer player, string reason)
 {
     try
     {
         if (player == null)
         {
             return;
         }
         if (User.GetPlayerOnline(player) != 0)
         {
             Characters.SetCharacterLastPosition(User.GetPlayerOnline(player), player.Position, player.Dimension);
         }
         User.SetPlayerOnline(player, 0);
         Characters.SetCharacterCurrentFunkFrequence(player.CharacterId, null);
     }
     catch (Exception e)
     {
         Alt.Log($"{e}");
     }
 }
コード例 #20
0
ファイル: SmartphoneHandler.cs プロジェクト: h04X-2K/ValeaRP
 public async Task requestSmartphoneChats(ClassicPlayer player)
 {
     try
     {
         if (player == null || !player.Exists || player.CharacterId <= 0 || Characters.IsCharacterPhoneFlyModeEnabled(player.CharacterId) || Characters.IsCharacterUnconscious(player.CharacterId) || player.HasPlayerHandcuffs() || player.HasPlayerRopeCuffs())
         {
             return;
         }
         int playerNumber = Characters.GetCharacterPhonenumber(player.CharacterId);
         if (!Characters.ExistPhoneNumber(playerNumber))
         {
             return;
         }
         CharactersPhone.RequestChatJSON(player, playerNumber);
     }
     catch (Exception e)
     {
         Alt.Log($"{e}");
     }
 }
コード例 #21
0
 public static void CMD_getAccountIdByMail(ClassicPlayer player, string mail)
 {
     try
     {
         if (player == null || !player.Exists || player.CharacterId <= 0 || player.AdminLevel() <= 0)
         {
             return;
         }
         var accEntry = User.Player.ToList().FirstOrDefault(x => x.Email == mail);
         if (accEntry == null)
         {
             return;
         }
         player.SendChatMessage($"Spieler-ID der E-Mail {mail} lautet: {accEntry.playerid} - Spielername: {accEntry.playerName}");
     }
     catch (Exception e)
     {
         Alt.Log($"{e}");
     }
 }
コード例 #22
0
ファイル: SmartphoneHandler.cs プロジェクト: h04X-2K/ValeaRP
        public async Task editContact(ClassicPlayer player, int contactId, string name, int contactNumber)
        {
            if (player == null || !player.Exists || player.CharacterId <= 0 || contactId <= 0 || name == "" || contactNumber <= 0)
            {
                return;
            }
            int phoneNumber = Characters.GetCharacterPhonenumber(player.CharacterId);

            if (phoneNumber <= 0)
            {
                return;
            }
            if (!CharactersPhone.ExistContactById(contactId, phoneNumber))
            {
                player.EmitLocked("Client:Smartphone:showNotification", "Kontakt konnte nicht bearbeitet werden.", "error", null, "error");
                return;
            }
            CharactersPhone.EditContact(contactId, contactNumber, name);
            requestPhoneContacts(player);
        }
コード例 #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
ファイル: 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}");
            }
        }
コード例 #25
0
ファイル: SmartphoneHandler.cs プロジェクト: h04X-2K/ValeaRP
 public async Task deleteContact(ClassicPlayer player, int contactId)
 {
     try
     {
         if (player == null || !player.Exists || contactId <= 0 || player.CharacterId <= 0)
         {
             return;
         }
         int phoneNumber = Characters.GetCharacterPhonenumber(player.CharacterId);
         if (phoneNumber <= 0 || !CharactersPhone.ExistContactById(contactId, phoneNumber))
         {
             return;
         }
         CharactersPhone.DeletePhoneContact(contactId, phoneNumber);
         requestPhoneContacts(player);
     }
     catch (Exception e)
     {
         Alt.Log($"{e}");
     }
 }
コード例 #26
0
ファイル: SmartphoneHandler.cs プロジェクト: h04X-2K/ValeaRP
 public async Task createNewChat(ClassicPlayer player, int targetPhoneNumber)
 {
     try
     {
         if (player == null || !player.Exists || player.CharacterId <= 0 || targetPhoneNumber <= 0)
         {
             return;
         }
         int phoneNumber = Characters.GetCharacterPhonenumber(player.CharacterId);
         if (!Characters.ExistPhoneNumber(phoneNumber) || !Characters.ExistPhoneNumber(targetPhoneNumber) || CharactersPhone.ExistChatByNumbers(phoneNumber, targetPhoneNumber) || phoneNumber == targetPhoneNumber)
         {
             return;
         }
         CharactersPhone.CreatePhoneChat(phoneNumber, targetPhoneNumber);
         CharactersPhone.RequestChatJSON(player, phoneNumber);
     }
     catch (Exception e)
     {
         Alt.Log($"{e}");
     }
 }
コード例 #27
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}");
            }
        }
コード例 #28
0
ファイル: LoginHandler.cs プロジェクト: h04X-2K/ValeaRP
 public async Task OnPlayerConnect_Handler(ClassicPlayer player, string reason)
 {
     if (player == null || !player.Exists)
     {
         return;
     }
     AltAsync.Do(() =>
     {
         player.SetSyncedMetaData("PLAYER_SPAWNED", false);
         player.SetSyncedMetaData("ADMINLEVEL", 0);
         player.SetPlayerIsCuffed("handcuffs", false);
         player.SetPlayerIsCuffed("ropecuffs", false);
         setCefStatus(player, false);
     });
     player.SetPlayerCurrentMinijob("None");
     player.SetPlayerCurrentMinijobRouteId(0);
     player.SetPlayerCurrentMinijobStep("None");
     player.SetPlayerCurrentMinijobActionCount(0);
     player.SetPlayerFarmingActionMeta("None");
     User.SetPlayerOnline(player, 0);
     player.EmitLocked("Client:Pedcreator:spawnPed", ServerPeds.GetAllServerPeds());
     CreateLoginBrowser(player);
 }
コード例 #29
0
ファイル: SmartphoneHandler.cs プロジェクト: h04X-2K/ValeaRP
        public async Task sendChatMessage(ClassicPlayer player, int chatId, int phoneNumber, int targetPhoneNumber, int unix, string message)
        {
            try
            {
                if (player == null || !player.Exists || player.CharacterId <= 0 || chatId <= 0 || phoneNumber <= 0 || targetPhoneNumber <= 0 || phoneNumber != Characters.GetCharacterPhonenumber(player.CharacterId) || !Characters.ExistPhoneNumber(targetPhoneNumber) || !CharactersPhone.ExistChatByNumbers(phoneNumber, targetPhoneNumber))
                {
                    return;
                }
                CharactersPhone.CreatePhoneChatMessage(chatId, phoneNumber, targetPhoneNumber, unix, message);
                requestChatMessages(player, chatId);

                ClassicPlayer targetPlayer = (ClassicPlayer)Alt.Server.GetPlayers().ToList().FirstOrDefault(x => x != null && x.Exists && ((ClassicPlayer)x).CharacterId > 0 && Characters.GetCharacterPhonenumber(((ClassicPlayer)x).CharacterId) == targetPhoneNumber);
                if (targetPlayer == null || !targetPlayer.Exists)
                {
                    return;
                }
                targetPlayer.EmitLocked("Client:Smartphone:recieveNewMessage", chatId, phoneNumber, message);
            }
            catch (Exception e)
            {
                Alt.Log($"{e}");
            }
        }
コード例 #30
0
ファイル: SmartphoneHandler.cs プロジェクト: h04X-2K/ValeaRP
        public static async Task requestChatMessages(ClassicPlayer player, int chatId)
        {
            try
            {
                if (player == null || !player.Exists || player.CharacterId <= 0 || chatId <= 0)
                {
                    return;
                }
                var messages = CharactersPhone.CharactersPhoneChatMessages_.ToList().Where(x => x.chatId == chatId).Select(x => new
                {
                    x.id,
                    x.chatId,
                    from = x.fromNumber,
                    to   = x.toNumber,
                    x.unix,
                    text = x.message,
                }).OrderBy(x => x.unix).TakeLast(50).ToList();

                var itemCount  = (int)messages.Count;
                var iterations = Math.Floor((decimal)(itemCount / 5));
                var rest       = itemCount % 5;
                for (var i = 0; i < iterations; i++)
                {
                    var skip = i * 5;
                    player.EmitLocked("Client:Smartphone:addMessageJSON", JsonConvert.SerializeObject(messages.Skip(skip).Take(5).ToList()));
                }
                if (rest != 0)
                {
                    player.EmitLocked("Client:Smartphone:addMessageJSON", JsonConvert.SerializeObject(messages.Skip((int)iterations * 5).ToList()));
                }
                player.EmitLocked("Client:Smartphone:setAllMessages");
            }
            catch (Exception e)
            {
                Alt.Log($"{e}");
            }
        }