PM'DEN ENGELLEME [PYTHON]

  • Konbuyu başlatan Konbuyu başlatan Admin
  • Başlangıç tarihi Başlangıç tarihi
  • Cevaplar Cevaplar 0
  • Görüntüleme Görüntüleme 56

Admin

Metin2Lobby
Yönetici
Founder
Katılım
6 Mayıs 2022
Mesajlar
52,647
Ticaret : 1 / 0 / 0
ALINTIDIR.

root/game.py açılır ve aratılır ;

Kod:
def OnRecvWhisper(self, mode, name, line):         if mode == chat.WHISPER_TYPE_GM:             self.interface.RegisterGameMasterName(name)         else:             pass

Altına şu kod eklenir ;

Kod:
if os.path.exists(str(constInfo.CLIENT_YOL)+"block_"+str(player.GetName())+".kf") and open(str(constInfo.CLIENT_YOL)+"block_"+str(player.GetName())+".kf", "r").read().find("#"+str(name)+"#") != -1:             net.SendWhisperPacket(name, "#byfatihbab34opdsdannnwqnwqmnwmqnyurhhhsdamnda#"+str(player.GetStatus(player.LEVEL))+"#1#")             return         else:             pass         if line.find("byfatihbab34opdsdannnwqnwqmnwmqnyurhhhsdamnda") != -1:             bol = line.split("#")             chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, name, "Sizi engellemis, Bu kisiye mesaj atamassiniz.")             return

root/CostInfo.py açılır ve şu kod eklenir ;

Kod:
CLIENT_YOL = "lib/"

root/uichat.py açılır ve aratılır ;

Kod:
def __SendChatPacket(self, text, type):

Altına sonuna biyerine şu kod eklenir :

Kod:
if text == "?block":                 chat.AppendChat(chat.CHAT_TYPE_INFO, "|cFF32CD32|H|hEngelli Oyuncular:")                 if not os.path.exists(str(constInfo.CLIENT_YOL)+"block_"+str(player.GetName())+".kf"):                     chat.AppendChat(chat.CHAT_TYPE_INFO, "Engelli oyuncu yok.")                 else:                     acla = open(str(constInfo.CLIENT_YOL)+"block_"+str(player.GetName())+".kf", "r").read()                     if not acla.find("#") != -1:                         chat.AppendChat(chat.CHAT_TYPE_INFO, "Engelli oyuncu yok.")                         return                     ac = open(str(constInfo.CLIENT_YOL)+"block_"+str(player.GetName())+".kf", "r").readlines()                     for i in ac:                         if str(i).find("#") != -1:                             chat.AppendChat(chat.CHAT_TYPE_INFO, str(i.split("#")[1].split("#")[0]))                 return

root/uiwhisper.py açılır ve aratılır ;

Kod:
def OpenWithTarget(self, targetName):

Kodların sonuna şu kod eklenir ;

Kod:
if os.path.exists(str(constInfo.CLIENT_YOL)+"block_"+str(player.GetName())+".kf") and open(str(constInfo.CLIENT_YOL)+"block_"+str(player.GetName())+".kf", "r").read().find("#"+str(targetName)+"#") != -1:             self.ignoreButton.Show()             self.ignoreButton.SetText("Engeli ac")         else:             self.ignoreButton.Show()             self.ignoreButton.SetText("Engelle")

Tekrar aratılır ;

Kod:
def IgnoreTarget(self):

Tamamı şu kod ile değiştirilir :

Kod:
def IgnoreTarget(self):         if str(self.targetName).find("[") != -1:             chat.AppendChat(chat.CHAT_TYPE_INFO, "<Fısıltı>: Game Master'leri sohbetten engelleyemessin.")             return         if os.path.exists(str(constInfo.CLIENT_YOL)+"block_"+str(player.GetName())+".kf") and open(str(constInfo.CLIENT_YOL)+"block_"+str(player.GetName())+".kf", "r").read().find("#"+str(self.targetName)+"#") != -1:             ac = open(str(constInfo.CLIENT_YOL)+"block_"+str(player.GetName())+".kf", "r")             oku = ac.read()             ac.close()             open(str(constInfo.CLIENT_YOL)+"block_"+str(player.GetName())+".kf", "w").write(str(oku).replace(str("#"+self.targetName+"#"), ""))             self.ignoreButton.SetText("Engelle")         else:             if os.path.exists(str(constInfo.CLIENT_YOL)+"block_"+str(player.GetName())+".kf"):                 open(str(constInfo.CLIENT_YOL)+"block_"+str(player.GetName())+".kf", "a+").write("\n"+str("#"+self.targetName+"#"))             else:                 open(str(constInfo.CLIENT_YOL)+"block_"+str(player.GetName())+".kf", "a+").write(str("#"+self.targetName+"#"))             self.ignoreButton.SetText("Engeli ac")

Tekrar aratılır ;

Kod:
def SendWhisper(self):

Bunun altına ;

Kod:
if textLength > 0:             if net.IsInsultIn(text):                 chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.CHAT_INSULT_STRING)                 return

Şu kod eklenir :

Kod:
if os.path.exists(str(constInfo.CLIENT_YOL)+"block_"+str(player.GetName())+".kf") and open(str(constInfo.CLIENT_YOL)+"block_"+str(player.GetName())+".kf", "r").read().find("#"+str(self.targetName)+"#") != -1:                 chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, self.targetName, 'Engelledigin kisiye mesaj gonderemezsin.')                 return


Not: Game.py ve uiwhisper.py de import os yoksa importlara ekleyin


Çalıştığına dair kanıt :

mXLrd4.png

Metin2'de PM'DEN ENGELLEME Sistemi (Python)


PM'DEN ENGELLEME sistemi, Metin2 özel sunucularında oyuncuların birbirlerine gönderdiği özel mesajları (PM) filtrelemek veya engellemek için geliştirilen bir Python tabanlı özelliktir. Bu sistem, özellikle PvP sunucularda istenmeyen tehditler, spam veya saldırgan davranışları önlemek için büyük önem taşır. Metin2 Lobby olarak bu konuda detaylı bir rehber hazırladık.

Neden PM Engelleme Sistemine İhtiyaç Vardır?
Metin2 özel sunucularında, oyuncular genellikle PvP savaşları, item ticareti veya sunucu içi etkileşimler sırasında birbirleriyle özel mesajlar aracılığıyla iletişim kurar. Ancak bazı oyuncular bu özelliği kötüye kullanarak spam mesajlar göndererek diğer oyuncuları rahatsız edebilir veya tehdit edebilir. Bu durum, oyuncu deneyimini ciddi şekilde bozar. Bu nedenle, PM'den engelleme sistemi, sunucu yöneticileri için kritik bir öneme sahiptir.

Python Kullanımı ile PM Engelleme
Metin2 özel sunucularında Python dili, genellikle GUI (grafiksel kullanıcı arayüzü), oyun içi menüler ve özel sistemler için kullanılır. PM engelleme sistemi de Python ile kolayca entegre edilebilir. Örneğin, oyuncular birbirlerine PM gönderdiğinde, sistem önce bu mesajı kontrol eder. Eğer mesaj belirli filtre kelimeleri içeriyorsa, mesaj engellenir veya otomatik olarak bir uyarı gönderilir.

Sistem Nasıl Çalışır?
1. Oyuncu bir PM gönderir.
2. Sunucu, mesajı Python üzerinden kontrol eder.
3. Belirlenen filtre kelimeleri karşılaşırsa, mesaj engellenir.
4. Gerekirse, göndericiye otomatik ceza uygulanabilir.

Python Kod Örnekleri
Aşağıda basit bir PM engelleme kodu örneği yer almaktadır:
Kod:
[B]def block_pm(sender, message):[BR][/BR]    blocked_words = ['spam', 'tehdit', 'reklam'][BR][/BR]    for word in blocked_words:[BR][/BR]        if word in message.lower():[BR][/BR]            return True[BR][/BR]    return False[/B]

Faydaları
PM engelleme sistemi sayesinde:
- Spam mesajlar azaltılır.
- Oyuncu güvenliği sağlanır.
- Oyun içi sosyal ortam korunur.
- Sunucu yönetimi daha kolay hale gelir.

Sonuç
Metin2 özel sunucularında PM engelleme sistemi, oyuncu memnuniyetini artırmak ve düzeni sağlamak açısından hayati bir rol oynar. Python ile geliştirilen bu sistem, esnek ve güçlü bir yapı sunar. Metin2 Lobby olarak, bu gibi gelişmiş sistemlerin detaylarını paylaşmaya devam ediyoruz.


PM Blocking System in Metin2 (Python)


PM BLOCKING system is a Python-based feature developed to filter or block private messages (PMs) sent between players in Metin2 private servers. This system is especially important on PvP servers to prevent unwanted threats, spam, or aggressive behavior. At Metin2 Lobby, we have prepared a detailed guide on this topic.

Why Is a PM Blocking System Needed?
In Metin2 private servers, players often communicate through private messages during PvP battles, item trading, or in-game interactions. However, some players misuse this feature by sending spam or threatening messages, which significantly degrades the player experience. Therefore, the PM blocking system is critical for server administrators.

Using Python for PM Blocking
In Metin2 private servers, Python is commonly used for GUI, in-game menus, and custom systems. The PM blocking system can be easily integrated with Python. For example, when a player sends a PM, the system first checks the message. If the message contains specific filtered words, the message is blocked or an automatic warning is sent.

How Does the System Work?
1. A player sends a PM.
2. The server checks the message via Python.
3. If blocked words are found, the message is rejected.
4. Optionally, an automated penalty can be applied to the sender.

Python Code Example
Below is a simple example of PM blocking code:
Kod:
[B]def block_pm(sender, message):[BR][/BR]    blocked_words = ['spam', 'threat', 'advertising'][BR][/BR]    for word in blocked_words:[BR][/BR]        if word in message.lower():[BR][/BR]            return True[BR][/BR]    return False[/B]

Benefits
Thanks to the PM blocking system:
- Spam messages are reduced.
- Player security is enhanced.
- In-game social environment is preserved.
- Server management becomes easier.

Conclusion
The PM blocking system in Metin2 private servers plays a vital role in increasing player satisfaction and maintaining order. The Python-based system offers a flexible and powerful structure. As Metin2 Lobby, we continue to share details about such advanced systems.
 

Şuan Bu Konuyu Görüntüleyen Kullanıcılar (Toplam : 0, Üye : 0, Misafir : 0)

Benzer konular

Geri
Üst Alt