[C++] Set Command's

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

Admin

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

Hi dev's !

I know this is a sh*t but... :D

Open cmd_gm.cpp:

SET SEX:

Find:
Kod:
case 2: // sex break;

Replace with:
Kod:
case 2: // sex { switch (arg3[0]) { case 'morphe': // /set Name sex morphe { tch->ChangeSex(); tch->SetPolymorph(101); tch->SetPolymorph(0); } break; } } break;

use /set Name sex morphe or change 'morphe' with 'your_string'

SET RACE:

Find:
Kod:
case 1: // race break;

Replace with:
Kod:
case 1: // race { DWORD dwRace = MAIN_RACE_MAX_NUM; if (!*arg3) { ch->ChatPacket(CHAT_TYPE_INFO, "Enter race number"); return; } str_to_number(dwRace, arg3); if (dwRace >= MAIN_RACE_MAX_NUM) { ch->ChatPacket(CHAT_TYPE_INFO, "Race max number = 9 (0-8)"); return; } if (dwRace == tch->GetRaceNum()) { ch->ChatPacket(CHAT_TYPE_INFO, "He already is this race"); return; }  tch->SetRace(dwRace); tch->ClearSkill(); tch->SetPolymorph(101); tch->SetPolymorph(0); } break;

use /set Name race number_race

SET SKILL GROUP

Find:
Kod:
{ "align", NUMBER },

Add under:
Kod:
{ "skill_group", NUMBER },

Find:
Kod:
case 8: // alignment

Add under this case a new case:

Kod:
case 9: // skill_group { bool bIsSetSkillGroup = false; DWORD dwSkillGroup = 0; if (!*arg3) { ch->ChatPacket(CHAT_TYPE_INFO, "Enter a skill_group (1-2)"); } if (*arg3) { str_to_number(dwSkillGroup, arg3); dwSkillGroup = MINMAX(0, dwSkillGroup, 2); bIsSetSkillGroup = true; } if (bIsSetSkillGroup) { tch->SetSkillGroup(dwSkillGroup); } } break;

use /set Name race number_race

SET LEVEL

Find:
Kod:
{ "align", NUMBER },

Add under:
Kod:
{ "level", NUMBER },

Find:
Kod:
case 9: // skill_group

Add under this case a new case.

Kod:
case 10: // level { DWORD dwLevel = PLAYER_EXP_TABLE_MAX; if (!*arg3) { ch->ChatPacket(CHAT_TYPE_INFO, "Enter the level"); return; } str_to_number(dwRace, arg3); if (dwLevel >= PLAYER_EXP_TABLE_MAX) { ch->ChatPacket(CHAT_TYPE_INFO, "MAX_LEVEL is: %d", PLAYER_EXP_TABLE_MAX); return; } tch->SetLevel(dwRace); } break;

use /set Name level number


AHAHHAHA :D :D PLEASE Thank You Enough :D :D

Metin2 Lobby'da C++ Set Komutları ile Oyun Geliştirme


C++ Nedir ve Metin2 Geliştirmede Neden Önemlidir?
C++, yüksek performans gerektiren oyun geliştirme projelerinde sıkça tercih edilen güçlü bir programlama dilidir. Metin2 özel sunucularında, oyun içi komutlar, sistemler ve oyun motorunun temel işlevleri genellikle C++ ile yazılmaktadır. Bu bağlamda, set komutları, oyuncuların veya geliştiricilerin belirli ayarları değiştirmesine ya da oyun içinde belirli işlemleri yapmasına olanak tanır.

Set Komutları Nedir?
Set komutları, genellikle oyun sunucusunda belirli parametreleri ayarlamak veya değiştirmek için kullanılır. Örneğin bir geliştirici, belirli bir karakterin seviyesini, envanterini veya statlarını değiştirmek için bir set komutu kullanabilir. Bu komutlar genellikle admin veya GM (Game Master) yetkisiyle çalıştırılır.

C++ ile Set Komutlarının Uygulanması
Metin2 özel sunucularında, set komutları genellikle oyun sunucusunun ana dosyalarında tanımlanır. Bu komutlar genellikle ClientManagerBase.cpp gibi dosyalarda işlenir. Set komutları, oyuncu veritabanı, eşya sistemleri, seviye sistemleri gibi birçok alanda kullanılabilir. Örneğin, bir oyuncuya özel bir item vermek istiyorsanız, 'set_item' gibi bir komut tanımlayabilirsiniz.

Set Komutları İçin Basit Bir C++ Kodu Örneği
Kod:
[B]void set_level(LPCHARACTER ch, int level) {[/B][BR][/BR][B]if (!ch) return;[/B][BR][/BR][B]ch->SetLevel(level);[/B][BR][/BR][B]ch->UpdatePacket();[/B][BR][/BR][B]}

Yukarıdaki kod parçası, bir karakterin seviyesini değiştirmek için basit bir set komutu örneğidir. Burada 'LPCHARACTER', karakter nesnesini temsil ederken, 'SetLevel' fonksiyonu ile seviye değeri güncellenir.

Set Komutlarında Güvenlik ve Yetkilendirme
Metin2 özel sunucularında set komutları, güvenlik açısından dikkatle yönetilmelidir. Yanlış bir şekilde tanımlanmış bir komut, sunucuda ciddi güvenlik açıklarına neden olabilir. Bu nedenle, komutların sadece belirli yetkilere sahip kullanıcılar tarafından çalıştırılabilmesi sağlanmalıdır. Yetkilendirme genellikle 'IsGM()' veya benzeri fonksiyonlarla yapılır.

Python ile Entegrasyon
Bazı Metin2 geliştiricileri, C++ ile yazılmış set komutlarına Python arayüzleri eklemeyi tercih eder. Bu sayede GUI tabanlı yönetim panelleri oluşturulabilir. Python ile C++ kodları arasında köprü kurulması için SWIG gibi araçlar kullanılabilir. Böylece hem hızlı hem de kullanıcı dostu sistemler geliştirilebilir.

Set Komutları ile Sunucu Performansını Artırmak
Set komutları, sadece oyun içi işlemler için değil, aynı zamanda sunucu performansını artırmak için de optimize edilebilir. Örneğin, bir komutun çalıştırılması sırasında gereksiz veritabanı sorgularının engellenmesi, sunucu yanıt süresini önemli ölçüde artırabilir. Bu tür optimizasyonlar, C++ bilgisi gerektirir ve doğru uygulandığında sunucu stabilitesini artırır.

Sonuç
C++ set komutları, Metin2 özel sunucularında güçlü yönetim ve geliştirme araçlarıdır. Doğru kullanıldığında, hem oyun içi deneyimi geliştirebilir hem de sunucu yönetimini kolaylaştırabilir. Metin2 Lobby olarak, bu konulara odaklanan gelişmiş kaynaklar ve destek sunuyoruz.


Developing with C++ Set Commands at Metin2 Lobby


What is C++ and Why is it Important for Metin2 Development?
C++ is a powerful programming language frequently used in game development projects that require high performance. In Metin2 private servers, in-game commands, systems, and core game engine functions are typically written in C++. In this context, set commands allow players or developers to modify specific settings or perform certain actions within the game.

What Are Set Commands?
Set commands are generally used to adjust or change certain parameters on the game server. For instance, a developer may use a set command to change a character's level, inventory, or stats. These commands are usually executed with admin or GM (Game Master) privileges.

Implementing Set Commands with C++
In Metin2 private servers, set commands are typically defined within the main server files. These commands are often processed in files such as ClientManagerBase.cpp. Set commands can be applied across many areas including player database, item systems, and level systems. For example, if you want to give a special item to a player, you can define a command like 'set_item'.

Example of a Simple C++ Code for Set Commands
Kod:
[B]void set_level(LPCHARACTER ch, int level) {[/B][BR][/BR][B]if (!ch) return;[/B][BR][/BR][B]ch->SetLevel(level);[/B][BR][/BR][B]ch->UpdatePacket();[/B][BR][/BR][B]}

The above code snippet is a simple example of a set command to change a character's level. Here, 'LPCHARACTER' represents the character object, while the 'SetLevel' function updates the level value.

Security and Authorization in Set Commands
In Metin2 private servers, set commands must be carefully managed from a security standpoint. Improperly defined commands can lead to serious security vulnerabilities on the server. Therefore, it must be ensured that commands can only be executed by users with specific permissions. Authorization is typically handled using functions like 'IsGM()'.

Integration with Python
Some Metin2 developers prefer to add Python interfaces to C++ based set commands. This allows for GUI-based management panels. Tools like SWIG can be used to bridge Python and C++ codes. Thus, both fast and user-friendly systems can be developed.

Improving Server Performance with Set Commands
Set commands can not only be used for in-game operations but also optimized to enhance server performance. For example, preventing unnecessary database queries during command execution can significantly improve server response time. Such optimizations require C++ knowledge and, when correctly applied, increase server stability.

Conclusion
C++ set commands are powerful tools for administration and development in Metin2 private servers. When used properly, they can enhance the in-game experience as well as simplify server management. At Metin2 Lobby, we provide advanced resources and support focused on these topics.
 

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

Benzer konular

Geri
Üst Alt