[C++]GM Komutlarının içeriğini kendinize göre düzenleyin.

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

Admin

Metin2Lobby
Yönetici
Founder
Katılım
6 Mayıs 2022
Mesajlar
52,647
Ticaret : 1 / 0 / 0
Merhabalar, Can sıkıntısından ötürü paylaşmak istediğim konudur bu :)
İyi yada kötü yorumlarınızı ve teşekkürlerinizi eksik etmezseniz sevinirim :)

Öncelikle komutlardan bahsedelim.

Kod:
/costume               Kostüm statünüzü gösterir. /cannot_dead       Yaratıkların size attığı damageleri gösterir fakat HP eksilmez. item_full_set          Karaktere full set halinde itemleri giydirir. /full_set                    Karaktere full set halinde bonuslu itemler giydirir. Tüm becerileri en üst düzeye getirir. attr_full_set            Karaktere sadece bonuslu itemleri giydirir. setblockmode         GM için damage bloğunu aktif eder / kaldırır. change_attr            Bir itemin bonusunu değiştirir. add_attr                  Bir iteme yeni bir bonus ekler. add_socket              Bir iteme soket ekler. all_skill_master       Tüm becerilerinizi en üst düzeye getirir. item_id_list              Envanterdeki tüm itemlerin id'lerini listeler. Bu id'ler İtem_proto değil player>item tablosundaki itemler içindir. get_mob_count       Bulunduğunuz haritanın indeks numarasını ve kaç adet yaratık olduğunu belirtir. /notice_map              Duyuruyu Sadece bulunduğunuz haritadaki oyunculara görüntülemenizi sağlar. /ma                            Çağırdığınız yaratığı /ma koduyla çağırırsanız o yaratığın agresif olmasını sağlarsınız.[Monster aggressive][/FONT]


Şimdi Komutların içeriğine gelelim.

cmd_gm.cpp içerisindeki ilgili alanlarda değişiklik yapabilirsiniz.



Alt taraf karakterlere verilen itemlerdir.


Kod:
ACMD (do_item_full_set) {     BYTE job = ch->GetJob();     LPITEM item;     for (int i = 0; i < 6; i++)     {         item = ch->GetWear(i);         if (item != NULL)             ch->UnequipItem(item);     }     item = ch->GetWear(WEAR_SHIELD);     if (item != NULL)         ch->UnequipItem(item);     switch (job)     {     case JOB_SURA:         {                       item = ITEM_MANAGER::instance().CreateItem(11699);             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(13049);             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(15189 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(189 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(12529 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(14109 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(17209 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(16209 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);         }         break;     case JOB_WARRIOR:         {                       item = ITEM_MANAGER::instance().CreateItem(11299);             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(13049);             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(15189 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(3159 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(12249 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(14109 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(17109 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(16109 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);         }         break;     case JOB_SHAMAN:         {                       item = ITEM_MANAGER::instance().CreateItem(11899);             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(13049);             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(15189 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(7159 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(12669 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(14109 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(17209 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(16209 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);         }         break;     case JOB_ASSASSIN:         {                       item = ITEM_MANAGER::instance().CreateItem(11499);             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(13049);             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(15189 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(1139 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(12389 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(14109 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(17189 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);             item = ITEM_MANAGER::instance().CreateItem(16189 );             if (!item || !item->EquipTo(ch, item->FindEquipCell(ch)))                 M2_DESTROY_ITEM(item);         }         break;     } }
Bu kısımda ise full_set yazdığınızda gelen itemlerin bonuslarının içeriğidir.
Kod:
ACMD (do_attr_full_set) {     BYTE job = ch->GetJob();     LPITEM item;     switch (job)     {     case JOB_WARRIOR:                                                        //Savaşçı     case JOB_ASSASSIN:                                                        //Ninja     case JOB_SURA:                                                            //Sura     case JOB_SHAMAN:                                                        //Şaman         {             // 무ì⬠몸빵 ìâ¦â¹íÅâ¦.             // ì´ê²Æë§Å ëâËìâ¢â¬ ìËìâ´ìâÅ ìâìâ¹Åë¡Å 모ëâ* ì§êµ° ë⹤ ì´ëŸ° ìâ*ìâ± ëâ°ë¦â.             item = ch->GetWear(WEAR_HEAD);                                    //Kask bonusları.             if (item != NULL)             {                 item->ClearAttribute();                 item->SetForceAttribute( 0, APPLY_ATT_SPEED, 8);             //Saldırı hızı             8                 item->SetForceAttribute( 1, APPLY_HP_REGEN, 30);             //Hp üretimi             30                 item->SetForceAttribute( 2, APPLY_SP_REGEN, 30);             //Sp üretimi            30                 item->SetForceAttribute( 3, APPLY_DODGE, 15);                 //Oklardan korunma        15                 item->SetForceAttribute( 4, APPLY_STEAL_SP, 10);            //HP Absorbe edilmesi     10             }             item = ch->GetWear(WEAR_WEAPON);                                //Silah bonusları.             if (item != NULL)             {                 item->ClearAttribute();                 item->SetForceAttribute( 0, APPLY_CAST_SPEED, 20);            //Büyü hızı             20                 item->SetForceAttribute( 1, APPLY_CRITICAL_PCT, 10);        //Kritik vuruş            10                 item->SetForceAttribute( 2, APPLY_PENETRATE_PCT, 10);        //Delici vuruş             10                 item->SetForceAttribute( 3, APPLY_ATTBONUS_DEVIL, 20);        //Şeytanlara k. güçlü    20                 item->SetForceAttribute( 4, APPLY_STR, 12);                    //Güç                     12             }             item = ch->GetWear(WEAR_SHIELD);                                //Kalkan bonusları.             if (item != NULL)             {                 item->ClearAttribute();                 item->SetForceAttribute( 0, APPLY_CON, 12);                    //Canlılık                12                 item->SetForceAttribute( 1, APPLY_BLOCK, 15);                //Bloklama                15                 item->SetForceAttribute( 2, APPLY_REFLECT_MELEE, 10);        //Yansıtma                10                 item->SetForceAttribute( 3, APPLY_IMMUNE_STUN, 1);            //Sersemlik bağışık.    1                 item->SetForceAttribute( 4, APPLY_IMMUNE_SLOW, 1);            //Yavaşlık bağışık.        1             }             item = ch->GetWear(WEAR_BODY);                                    //Zırh bonusları.             if (item != NULL)             {                 item->ClearAttribute();                 item->SetForceAttribute( 0, APPLY_MAX_HP, 2000);            //Max HP                2000                 item->SetForceAttribute( 1, APPLY_CAST_SPEED, 20);            //Büyü hızı                20                 item->SetForceAttribute( 2, APPLY_STEAL_HP, 10);            //Hp Absorbe            10                 item->SetForceAttribute( 3, APPLY_REFLECT_MELEE, 10);        //Yansıtma                10                 item->SetForceAttribute( 4, APPLY_ATT_GRADE_BONUS, 50);        //Saldırı değeri        50             }             item = ch->GetWear(WEAR_FOOTS);                                    //Ayakkabı bonusları             if (item != NULL)             {                 item->ClearAttribute();                 item->SetForceAttribute( 0, APPLY_MAX_HP, 2000);            //Max hp                2000                 item->SetForceAttribute( 1, APPLY_MAX_SP, 80);                //Max sp                80                 item->SetForceAttribute( 2, APPLY_MOV_SPEED, 8);            //Hareket hızı            8                 item->SetForceAttribute( 3, APPLY_ATT_SPEED, 8);            //Saldırı hızı            8                 item->SetForceAttribute( 4, APPLY_CRITICAL_PCT, 10);        //Kritik vuruş            10             }             item = ch->GetWear(WEAR_WRIST);             if (item != NULL)             {                 item->ClearAttribute();                 item->SetForceAttribute( 0, APPLY_MAX_HP, 2000);            //Max hp                2000                 item->SetForceAttribute( 1, APPLY_MAX_SP, 80);                //Max sp                80                 item->SetForceAttribute( 2, APPLY_PENETRATE_PCT, 10);        //Delici vuruş            10                 item->SetForceAttribute( 3, APPLY_STEAL_HP, 10);            //Hp Absorbe            10                 item->SetForceAttribute( 4, APPLY_MANA_BURN_PCT, 10);        //Sp Çalma                10             }             item = ch->GetWear(WEAR_NECK);                                    //Kolye Bonusları                  if (item != NULL)             {                 item->ClearAttribute();                 item->SetForceAttribute( 0, APPLY_MAX_HP, 2000);            //Max hp                2000                 item->SetForceAttribute( 1, APPLY_MAX_SP, 80);                //Max sp                80                 item->SetForceAttribute( 2, APPLY_CRITICAL_PCT, 10);        //Kritik vuruş            10                 item->SetForceAttribute( 3, APPLY_PENETRATE_PCT, 10);        //Delici vuruş            10                 item->SetForceAttribute( 4, APPLY_STEAL_SP, 10);            //Hp Absorbe            10             }             item = ch->GetWear(WEAR_EAR);                                    //Küpe bonusları             if (item != NULL)             {                 item->ClearAttribute();                 item->SetForceAttribute( 0, APPLY_MOV_SPEED, 20);            //Hareket hızı            20                 item->SetForceAttribute( 1, APPLY_MANA_BURN_PCT, 10);        //Sp çalma                10                 item->SetForceAttribute( 2, APPLY_POISON_REDUCE, 5);        //Zehre Karşı koyma        5                 item->SetForceAttribute( 3, APPLY_ATTBONUS_DEVIL, 20);        //Şeytanlara k. güçlü    20                 item->SetForceAttribute( 4, APPLY_ATTBONUS_UNDEAD, 20);        //Ölümsüzlere k. güçlü    20             }         }         break;     } } [FONT=century gothic][B]//[/B][/FONT]

Ve diğer Çeşitli gm komutları. Bu komutların tamamı denenmeni. Neyin neye yaradığı komutlardan az çok bellidir.

Kod:
[COLOR=#000000]"!RESERVED!"  "who"  "war"  "warp"  "user"  "notice"  "notice_map"  "big_notice"  "nowar"  "purge"  "weaken"  "dc"  "transfer"  "goto"  "level"  "eventflag"  "geteventflag"  "item"  "mob"  "mob_ld"  "ma"  "mc"  "mm"  "kill"  "ipurge"  "group"  "grranm"  "set"  "reset"  "greset"  "advance"  "book"  "console"  "shutw"  "shutwn"  "stat"  "stat-"  "stat_reset"  "state"  "stun"  "slow"  "respawn"  "makeguild"  "deleteguild"  "mount"  "restart_here"  "restart_town"  "phase_selec"  "phase_select"  "qui"  "quit"  "logou"  "logout"  "skillup"  "gskillup"  "pvp"  "safebox"  "safebox_close"  "safebox_passwor"  "safebox_password"  "safebox_change_passwor" "safebox_change_password"  "mall_passwor"  "mall_password"  "mall_close"  "ungroup"  "refine_rod"  "refine_pick"  "max_pick"  "fish_simul"  "invisible"  "qf" "clear_quest"  "close_shop"  "set_walk_mode"  "set_run_mode"  "setjob"  "setskill"  "setskillother"  "setskillpoint"  "reload"  "cooltime"  "gwlist"  "gwstop"  "gwcancel"  "gstate"  "pkmode"  "messenger_auth" "getqf"  "setqf"  "delqf"  "set_state"  "detaillog"  "monsterlog"  "forgetme"  "aggregate"  "attract_ranger"  "pull_monster"  "setblockmode"  "polymorph"  "polyitem"  "priv_empire"  "priv_guild"  "mount_test"  "unmount"  "private"  "party_request"  "party_request_accept"  "party_request_deny"  "observer"  "observer_exit"  "socketitem"  "saveati"  "xmas_boom"  "xmas_snow"  "xmas_santa"  "view_equip"  "jy"  "vote_block_chat"  "block_chat"  "block_chat_list"  "build"  "clear_land"  "affect_remove"  "horse_state"  "horse_level"  "horse_ride"  "horse_summon"  "horse_unsummon"  "horse_set_stat"  "pcbang_update"  "pcbang_check"  "emotion_allow"  "kiss"  "slap"  "french_kiss"  "clap"  "cheer1"  "cheer2"  "dance1"  "dance2"  "dance3"  "dance4"  "dance5"  "dance6"  "congratulation"  "forgive"  "angry"  "attractive"  "sad"  "shy"  "cheerup"  "banter"  "joy"  "change_attr"  "add_attr"  "add_socket"  "user_horse_ride"  "user_horse_back"  "user_horse_feed" "show_arena_list"  "end_all_duel"  "end_duel"  "duel"  "con+"  "int+"  "str+"  "dex+"  "break_marriage"  "show_quiz"  "log_oxevent"  "get_oxevent_att"  "effect"  "threeway_info"  "threeway_myinfo"  "mto"  "mtr"  "minfo"  "mtax"  "mmob"  "elect"  "rmcandidacy"  "setmonarch"  "rmmonarch"  "hair"  "inventory"  "cube"  "siege"  "temp"  "frog"  "check_mmoney"  "reset_subskill"  "flush"  "gift"  "mnotice"  "eclipse"  "weeklyevent"  "eventhelper"  "in_game_mall"  "get_mob_count"  "dice"  "special_item"  "click_mall"  "ride"  "item_id_list"  "set_socket"  // auction  "auction_list"  "my_auction_list"  "my_purchase_list"  "enroll_auction"  "bid"  "impur"  "enroll_wish"  "enroll_sale"  "get_auctioned_item"  "buy_sold_item"  "cancel_auction"  "cancel_wish"  "cancel_sale"  "rebid" _rebid  "bid_cancel"  "costume"  "tcon"  "tint"  "tstr"  "tdex"  "cannot_dead"  "can_dead"  "full_set"  "item_full_set"  "attr_full_set"  "all_skill_master"  "use_item"  "dragon_soul"  "ds_list"  "do_clear_affect"  "\n"[/COLOR]

Saygılar..

C++ ile GM Komutlarının İçeriğini Kendinize Göre Düzenleyin


Metin2 özel sunucu geliştirme sürecinde, GM komutları sunucunuzun yönetimini kolaylaştıran önemli yapı taşlarından biridir. Bu komutlar sayesinde yetkililer, oyuncuların davranışlarını izleyebilir, onlara yardımcı olabilir veya gerekli durumlarda müdahale edebilir. Ancak varsayılan GM komutları her zaman ihtiyacınız olan işlevleri sunmayabilir. Bu nedenle, C++ dilinde yazılmış olan game server tarafında bu komutları özelleştirerek kendi sunucunuza özel özellikler eklemek mümkündür.

GM Komutları Nedir?
GM, yani Game Master, oyun içinde yetkili kullanıcıları temsil eder. Bu kullanıcılar genellikle sunucu yönetimi, oyun içi olaylar ve hile önleme gibi görevleri üstlenirler. GM komutları ise bu yetkililere belirli eylemleri gerçekleştirebilme imkanı sunan komutlardır. Örneğin, bir GM, bir oyuncuyu teleport ettirebilir, ona özel item verebilir veya bir oyun olayını başlatıp bitirebilir.

C++ ile GM Komutlarını Özelleştirme
Metin2 sunucularında GM komutları, genellikle game server içinde tanımlanan bir fonksiyon seti ile çalışır. Bu komutlar C++ tabanlıdır ve sunucu derlenirken içine gömülür. Sizler bu komutları değiştirmek veya yeni komutlar eklemek isterseniz, src/client_src/game/src/char_command.cpp gibi dosyalara girip mevcut yapıyı analiz edebilirsiniz. Burada bulunan komut işleyici yapıları, komutu tanır ve buna göre bir işlem yapar.

Örnek Komut Yapısı
C++ dilinde bir GM komutu tanımlamak oldukça basit bir yapıya sahiptir. Öncelikle komutun adı belirlenir, ardından bu komuta özel bir fonksiyon yazılır. Örneğin:

Kod:
int gm_teleport_to_player(LPCHARACTER ch, const char* arg)[BR][/BR]{[BR][/BR]    // Oyuncu argüman olarak verilen karaktere ışınlanır[BR][/BR]    LPCHARACTER target = CHARACTER_MANAGER::instance().FindPC(arg);[BR][/BR]    if (!target) {[BR][/BR]        ch->ChatPacket(CHAT_TYPE_INFO, 'Hedef bulunamadi!');[BR][/BR]        return 0;[BR][/BR]    }[BR][/BR]    ch->WarpTo(target->GetX(), target->GetY());[BR][/BR]    return 1;[BR][/BR]}


Yeni Komut Ekleme
Bu fonksiyonu tanımladıktan sonra, command_table adlı yapıya bu komutu ekleyerek oyuncuların veya yetkililerin kullanabilmesini sağlayabilirsiniz. Örneğin, /teleport_to komutu bu fonksiyonu çağırarak çalışacaktır. Böylece yetkili bir kullanıcı, /teleport_to OyuncuAdi komutunu yazdığında, bu fonksiyon çalışacak ve hedef oyuncuya ışınlanacaktır.

Güvenlik ve Yetkilendirme
GM komutları güçlü araçlardır, bu yüzden yetkisiz kişilerin bu komutları kullanmasını engellemek çok önemlidir. C++ seviyesinde yetki kontrolü, genellikle ch->GetGMLevel() gibi fonksiyonlar ile yapılır. Bu sayede sadece belirli yetki seviyesine sahip kullanıcılar komutu kullanabilir. Bu yapıyı dikkatlice ayarlarsanız, güvenlik açıklarını en aza indirgeyebilirsiniz.

Sonuç
Metin2 özel sunucularında GM komutlarını C++ seviyesinde özelleştirmek, hem sunucu yönetimini kolaylaştırır hem de oyuncular için daha keyifli bir deneyim sunar. Bu işlem sırasında dikkatli olunması gereken konular özellikle güvenlik ve doğru komut yapılandırmasıdır. Eğer doğru şekilde uygulanırsa, bu sistem sunucunuzun kalitesini artırmada büyük rol oynar.

Kaynak Kodlama
Metin2Lobby olarak, Metin2 özel sunucu geliştirme konusunda en kaliteli kaynakları ve destekleri sunuyoruz. C++ tabanlı server src dosyaları, GM komutu örnekleri ve daha fazlası için sitemizi ziyaret edin.


Customize Your Own GM Commands with C++


Metin2 private server development involves many management tools, one of which are the GM commands. These commands allow administrators to monitor player behavior, provide assistance, or intervene in certain situations. However, default GM commands may not always fulfill your specific needs. Therefore, customizing these commands within the game server, written in C++, allows you to add unique features tailored to your server.

What Are GM Commands?
GM, short for Game Master, represents privileged users within the game. These users typically handle tasks like server management, in-game events, and anti-cheat operations. GM commands enable these users to perform special actions such as teleporting players, giving items, or triggering events.

Customizing GM Commands with C++
In Metin2 servers, GM commands operate through function sets defined in the game server code, primarily based on C++. To modify or add new commands, you can examine files such as src/client_src/game/src/char_command.cpp. These files contain command handlers that recognize the command and execute the corresponding action accordingly.

Sample Command Structure
Defining a GM command in C++ follows a simple structure. First, define the command name, then create a function tied to this command. For example:

Kod:
int gm_teleport_to_player(LPCHARACTER ch, const char* arg)[BR][/BR]{[BR][/BR]    // Teleports the GM to the target character[BR][/BR]    LPCHARACTER target = CHARACTER_MANAGER::instance().FindPC(arg);[BR][/BR]    if (!target) {[BR][/BR]        ch->ChatPacket(CHAT_TYPE_INFO, 'Target not found!');[BR][/BR]        return 0;[BR][/BR]    }[BR][/BR]    ch->WarpTo(target->GetX(), target->GetY());[BR][/BR]    return 1;[BR][/BR]}


Adding New Commands
After defining the function, you can add it to the command_table structure so that authorized users can invoke it. For instance, the command /teleport_to would call this function. Thus, when an admin types /teleport_to PlayerName, the function will execute and teleport them to the target player.

Security and Authorization
GM commands are powerful tools, so it's crucial to prevent unauthorized usage. Permission checks in C++ are typically handled by functions like ch->GetGMLevel(). By configuring these checks carefully, only users with certain privilege levels can access specific commands, minimizing security risks.

Conclusion
Customizing GM commands at the C++ level in Metin2 private servers enhances both server management and player experience. Key considerations during implementation include security and proper command configuration. When executed correctly, this system significantly improves your server's quality.

Source Code Development
At Metin2Lobby, we provide the highest quality resources and support for Metin2 private server development. Visit our site for C++-based server src files, GM command examples, and more.
 

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

Geri
Üst Alt