What's new
What's new

New messages New topics Systems Serverfiles 3D Models Web Scripting

Metin2Resources

👋 Welcome to Metin2 Resources — your hub for professional Metin2 server development.

Create a free account to access advanced systems, serverfiles, tutorials and connect with other developers.

🚀 Join today and start building better.

GM should send a PM to Online Players with a single command.

ITJA

Member
📜 Messages 18
👍 Reactions 0
🏆 Points 25
🌐 Website ugurkaya.work
1. cmd_general.cpp
Nereye: Dosyanın herhangi bir yerine (genelde en alt uygundur)

Code:
ACMD(do_gmpm)

{

if (ch->GetGMLevel() < GM_HIGH_WIZARD) {

ch->ChatPacket(CHAT_TYPE_INFO, "Bu komutu kullanmaya yetkiniz yok.");

return;

}



if (!*argument) {

ch->ChatPacket(CHAT_TYPE_INFO, "Kullanım: /gmpm [mesaj]");

return;

}



const DESC_MANAGER:ESC_SET& c_set = DESC_MANAGER::instance().GetClientSet();

for (DESC_MANAGER:ESC_SET::const_iterator it = c_set.begin(); it != c_set.end(); ++it)

{

LPDESC d = *it;

if (!d)

continue;



LPCHARACTER t = d->GetCharacter();

if (!t || t == ch)

continue;



TPacketGCWhisper pack;

pack.bHeader = HEADER_GC_WHISPER;

pack.wSize = sizeof(TPacketGCWhisper) + strlen(argument) + 1;

pack.bType = WHISPER_TYPE_NORMAL;

strlcpy(pack.szNameFrom, ch->GetName(), sizeof(pack.szNameFrom));



d->BufferedPacket(&pack, sizeof(pack));

d->Packet(argument, strlen(argument) + 1);

}



ch->ChatPacket(CHAT_TYPE_INFO, "Mesaj tüm oyunculara PM olarak gönderildi.");

}
```

---


cmd.cpp
Fonksiyon bildirimlerinin olduğu kısım (genelde en üstte):

Code:
ACMD(do_gmpm);
```

#### Komut listesi içinde `cmd_info[]` dizisine:

Code:
{ "gmpm", do_gmpm, 0, POS_DEAD, GM_HIGH_WIZARD },
```


Kullanım

/gmpm Merhaba! Etkinlik birazdan başlıyor!
```
Oyuncular mesajı PM olarak alır. Cevap verirlerse doğrudan GM’e ulaşır.

bu sistem ile sadece game taraflı değişiklik ekleme yapıp client ve pack taraflı bir entegre yapmaya gerek kalmaz.


KANIT:

 
Back
Top Bottom