예제 #1
0
        public void RejectAdvertisement(Client sender, int id)
        {
            if (!FactionManager.IsPlayerInFaction(sender, 5) || API.shared.getEntityData(sender, "AdminLevel") >= 1)
            {
                var _adv = db_Adversitements.GetById(id);
                if (_adv != null)
                {
                    var player = db_Accounts.IsPlayerOnline(_adv.OwnerSocialClubId);
                    if (player != null)
                    {
                        string number = PhoneManager.GetPhoneNumbers(player).FirstOrDefault();
                        API.shared.sendChatMessageToPlayer(player, "~g~[WZReklam] ~s~Reklamınız onaylanmadı. Paranız banka hesabına geri yatırıldı.");
                        InventoryManager.AddMoneyToPlayerBank(player, 50);
                    }
                    else
                    {
                        InventoryManager.AddMoneyToOfflinePlayerBank(_adv.OwnerSocialClubId, 50);
                    }
                    API.shared.sendChatMessageToPlayer(sender, "~g~[WZReklam] ~s~Reklamı ~r~reddettiniz.");
                    db_Adversitements.Remove(_adv.AddvertisementID);
                }
            }

            else
            {
                API.shared.sendChatMessageToPlayer(sender, "~r~HATA: ~s~Bunun için yetkiniz yok.");
            }
        }
예제 #2
0
 public void ApproveAdvertisement(Client sender, int id)
 {
     if (FactionManager.IsPlayerInFaction(sender, 5) || API.shared.getEntityData(sender, "AdminLevel") >= 1)
     {
         var _adv = db_Adversitements.GetById(id);
         if (_adv != null)
         {
             var player = db_Accounts.IsPlayerOnline(_adv.OwnerSocialClubId);
             if (player != null)
             {
                 string number = PhoneManager.GetPhoneNumbers(player).FirstOrDefault();
                 API.shared.sendChatMessageToAll($"~g~[WZReklam] [{number}] {player.nametag}: {_adv.Text}");
             }
             else
             {
                 var    _player        = db_Accounts.GetOfflineUserDatas(_adv.OwnerSocialClubId);
                 var    _phone         = InventoryManager.GetItemFromOfflineUser(_adv.OwnerSocialClubId, Models.ItemType.Phone).FirstOrDefault().Item2;
                 var    specifiedValue = (SpecifiedValuePhone)API.fromJson(_phone.SpecifiedValue).ToObject <SpecifiedValuePhone>();
                 string number         = specifiedValue.PhoneNumber;
                 API.shared.sendChatMessageToAll($"~g~[WZReklam] [{number}]{_player.CharacterName}: {_adv.Text}");
             }
             db_Adversitements.Remove(_adv.AddvertisementID);
         }
     }
     else
     {
         API.shared.sendChatMessageToPlayer(sender, "~r~HATA: ~s~Bunun için yetkiniz yok.");
     }
 }
예제 #3
0
 public void Advertisements(Client sender)
 {
     if (FactionManager.IsPlayerInFaction(sender, 5) || API.shared.getEntityData(sender, "AdminLevel") >= 1)
     {
         var _list = db_Adversitements.GetAll();
         foreach (var item in _list)
         {
             var player = db_Accounts.IsPlayerOnline(item.OwnerSocialClubId);
             if (player != null)
             {
                 API.shared.sendChatMessageToPlayer(sender, $"~g~[WZNews] ((/ro {item.AddvertisementID} | /rr {item.AddvertisementID}))~s~ -[{player.nametag}] {item.Text}");
             }
             else
             {
                 var _player = db_Accounts.GetOfflineUserDatas(item.OwnerSocialClubId);
                 API.shared.sendChatMessageToPlayer(sender, $"~g~[WZNews] ((/ro {item.AddvertisementID} | /rr {item.AddvertisementID}))~s~-[{_player.CharacterName}] {item.Text}");
             }
         }
     }
     else
     {
         API.shared.sendChatMessageToPlayer(sender, "~r~HATA: ~s~Bunun için yetkiniz yok.");
     }
 }