[C++]Bagırma Sn CONFIG komutlu

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

Admin

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

<blockquote data-attributes="" data-quote="" data-source="" class="bbCodeBlock bbCodeBlock--expandable bbCodeBlock--quote js-expandWatch">
Kod:
EvilsBagirmaMinSaniye : 15
15i isteğinize göre değiştirirsiniz[/B]

Metin2 Lobby olarak, Metin2 özel sunucu geliştirme konusunda derinlemesine bilgi ve kaynaklar sunuyoruz. Bu makalemizde C++ Bagırma Sistemi ve CONFIG komutu üzerinden gelişmiş bir sohbet mesajı sistemi nasıl yapılır onu ele alacağız. Metin2 özel sunucularında sunucu tarafında geliştirme yaparken C++ bilgisi büyük önem taşır. Özellikle oyuncuların belirli yetkilere göre mesaj gönderebilmesi gibi özel sistemlerin geliştirilmesinde bu bilgi kritiktir.

Bagırma Sistemi Nedir?
Metin2 oyununda genellikle yetkililerin tüm oyunculara mesaj göndermesi için bir 'bagırma' veya 'announcement' sistemi bulunur. Ancak özel sunucularda bu sistemin özelleştirilmesi ve geliştirilmesi gerekir. Bu sistem sayesinde adminler, GM'ler veya belirli seviye ya da yetkiye sahip karakterler, belirli mesajları belirli kanallara veya tüm haritaya yayınlayabilirler.

CONFIG Komutu ile Bagırma Yetkileri
Metin2 özel sunucularında yetki bazlı yapılar kurmak için config dosyaları kullanılır. Bagırma sisteminde, kimlerin ne tür mesaj gönderebileceği, hangi yetki seviyesinde kimlerin hangi komutu kullanabileceği gibi ayarlar config üzerinden yönetilir. Örneğin:

config::min_level_to_shout = 100
config::allow_shout_color = true
config::shout_cost_item = ITEM_ID_123

Bu şekilde yetki kontrolü, maliyet kontrolü ve stil kontrolü yapılabilir. Oyuncu seviyesi 100’ün altında ise bagırma izni verilmeyecek; belirli bir item harcanarak bagırma işlemi yapılacaksa maliyet otomatik olarak düşürülebilir.

C++ Tarafında Kodlama Yapısı
Sunucu tarafında bagırma komutunu tanımlamak için öncelikle game/core/src/input_main.cpp dosyasında ilgili komut tanımlanmalıdır. Örnek bir komut tanımı şu şekildedir:

if (CMD == 'shout')
{
ProcessShoutCommand(ch, packet);
}

Ardından ProcessShoutCommand fonksiyonu içinde kullanıcı kontrolü, yetki kontrolü ve mesaj gönderimi işlemleri yapılır. Burada config üzerinden alınan değerler karşılaştırılır ve uygunsa mesaj tüm oyunculara gönderilir.

Shout Mesajı Gönderme
Mesaj gönderimi sırasında broadcast fonksiyonları kullanılır. Örneğin:

ChatPacket(CHAT_TYPE_SHOUT, message, strlen(message), CHAT_COLOR_YELLOW);

Bu komutla mesaj sarı renkte ve shout tipinde tüm oyunculara gönderilir. Renk, tip ve içerik config üzerinden dinamik olarak değiştirilebilir.

Sistem Güvenliği ve Performans
Bagırma sistemi açık bırakıldığında spam riski doğabilir. Bu nedenle zaman sınırlaması, yetki kontrolü ve maliyet sistemi mutlaka aktif edilmelidir. Ayrıca, çok sayıda mesaj gönderilmesi durumunda sunucu performansını etkileyebilecek flood engelleri de entegre edilmelidir.

Sonuç
Metin2 özel sunucularında C++ tabanlı bagırma sistemleri, hem yetkililerin hem de oyuncuların dikkatini çekmek için güçlü bir araçtır. Config dosyası üzerinden esnek yetki ve özellik tanımları sayesinde özelleştirilebilir, güvenli ve performanslı bir sistem kurulabilir. Metin2Lobby.com olarak bu tür gelişmiş sistemler üzerindeki çalışmalarımız devam etmektedir.


Metin2 Lobby provides in-depth knowledge and resources regarding Metin2 private server development. In this article, we will discuss how to create an advanced chat messaging system using the C++ Shout System and CONFIG command. Developing on the server-side for Metin2 private servers requires strong C++ knowledge. Especially for special systems like allowing players with certain privileges to send messages, this knowledge is crucial.

What Is a Shout System?
In Metin2, there is usually a 'shout' or 'announcement' system that allows administrators to send messages to all players. However, in private servers, customization and enhancement of this system are often necessary. This system enables admins, GMs, or characters with specific levels or permissions to broadcast messages to certain channels or the entire map.

Shout Permissions via CONFIG Command
Config files are used in Metin2 private servers to manage role-based structures. For instance, who can send which type of message, and which command a player with certain authority can use, are configured via config settings. Example configurations might look like this:

config::min_level_to_shout = 100
config::allow_shout_color = true
config::shout_cost_item = ITEM_ID_123

With such configurations, permission checks, cost handling, and style controls can be implemented. If a player's level is below 100, shouting is denied; if a certain item is required to shout, the cost is automatically deducted.

Coding Structure on the C++ Side
To define a shout command on the server side, first define the command in game/core/src/input_main.cpp. An example command definition looks like this:

if (CMD == 'shout')
{
ProcessShoutCommand(ch, packet);
}

Then, within the ProcessShoutCommand function, user validation, permission checks, and message broadcasting operations are performed. Here, values taken from the config file are compared, and if valid, the message is sent to all players.

Sending Shout Messages
Broadcast functions are used during message sending. For example:

ChatPacket(CHAT_TYPE_SHOUT, message, strlen(message), CHAT_COLOR_YELLOW);

This command sends the message in yellow color and as a shout type to all players. The color, type, and content can be dynamically changed through the config file.

System Security and Performance
If the shout system is left unrestricted, spam risks may arise. Therefore, time limits, permission checks, and cost systems must be activated. Additionally, flood prevention mechanisms should be integrated to avoid performance issues due to excessive message traffic.

Conclusion
C++-based shout systems in Metin2 private servers are powerful tools for grabbing attention from both staff and players. Flexible permission and feature definitions via the config file allow building a customizable, secure, and high-performance system. At Metin2Lobby.com, our work on such advanced systems continues.
 

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

Geri
Üst Alt