GM Tek bir komutla Online Oyunculara PM atsın.

  • Konuyu açan Konuyu açan ITJA
  • Açılış Tarihi Açılış Tarihi
  • Yanıt Yanıt 13
  • Gösterim Gösterim 752

ITJA

Yasaklanmış Üye
Cezalı
Mesaj
73
Beğeni
37
Puan
676
Ticaret Puanı
0
1. cmd_general.cpp
Nereye: Dosyanın herhangi bir yerine (genelde en alt uygundur)

Kod:
Genişlet Daralt Kopyala
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):

Kod:
Genişlet Daralt Kopyala
ACMD(do_gmpm);
```

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

Kod:
Genişlet Daralt Kopyala
{ "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:

 
Son düzenleme:
I have an idea: what do you think about turning it into an event? When it's activated and a message is written, it will be sent to all connected players. The first person to reply to the message, whatever the reply may be, will be automatically drawn to the game administrator and declared the winner. The winner would be chosen based on who is the first to reply.
 
I have an idea: what do you think about turning it into an event? When it's activated and a message is written, it will be sent to all connected players. The first person to reply to the message, whatever the reply may be, will be automatically drawn to the game administrator and declared the winner. The winner would be chosen based on who is the first to reply.
that a great idea bro It will be developed further and share
 
I have an idea: what do you think about turning it into an event? When it's activated and a message is written, it will be sent to all connected players. The first person to reply to the message, whatever the reply may be, will be automatically drawn to the game administrator and declared the winner. The winner would be chosen based on who is the first to reply.
 
if (d->GetPhase() != PHASE_GAME)
continue;

Ayrıca yazıyı düz yapıştırdığın için kod bloğu nasıl tam anlamadım. Her seferinde elemanlara tekrar yazdırmak yerine bir kere yazdır sonra tüm oyunculara onu göndermek daha iyidir.
 
Kodlarınızı kod bloğuna ekleyebilir misiniz? Bu şekilde açtığınız konular hem düzgün okunmuyor hemde kodları kullanmak isterken kopyalarken yanlış kopyalayabilir
 
if (d->GetPhase() != PHASE_GAME)
continue;

Ayrıca yazıyı düz yapıştırdığın için kod bloğu nasıl tam anlamadım. Her seferinde elemanlara tekrar yazdırmak yerine bir kere yazdır sonra tüm oyunculara onu göndermek daha iyidir.
dostum bu 1 2 yıl önceden açılmış başka forumda paylaşılmış bir konu arşivden yani. ogün bir kiş iböyle sistem istemiştir. yapmışımdır.
 
dostum bu 1 2 yıl önceden açılmış başka forumda paylaşılmış bir konu arşivden yani. ogün bir kiş iböyle sistem istemiştir. yapmışımdır.
Dostum bir kişinin böyle sistem istemesi ayrı şey benim sana söylemek istediğim ayrı şey. Sen işleyişi söylüyorsun ben sana tasarımı söylüyorum. Her döngüde aynı fonksiyonları çağırp strcuta işlemek yerine tek seferde çağırıp döngüyle bunu göndermekten bahsediyorum.
 
Dostum bir kişinin böyle sistem istemesi ayrı şey benim sana söylemek istediğim ayrı şey. Sen işleyişi söylüyorsun ben sana tasarımı söylüyorum. Her döngüde aynı fonksiyonları çağırp strcuta işlemek yerine tek seferde çağırıp döngüyle bunu göndermekten bahsediyorum.

Kod:
Genişlet Daralt Kopyala
ACMD(do_gmpm)
{
    if (ch->GetGMLevel() < GM_HIGH_WIZARD) {
        ch->ChatPacket(CHAT_TYPE_INFO, "Bu komutu kullanmaya yetkiniz yok.");
        return;
    }


    skip_spaces(&argument);

    if (!*argument) {
        ch->ChatPacket(CHAT_TYPE_INFO, "Kullanım: /gmpm [mesaj]");
        return;
    }


    int iLen = strlen(argument) + 1;
    TPacketGCWhisper pack;
    pack.bHeader = HEADER_GC_WHISPER;
    pack.wSize = sizeof(TPacketGCWhisper) + iLen;
    pack.bType = WHISPER_TYPE_NORMAL;
    strlcpy(pack.szNameFrom, ch->GetName(), sizeof(pack.szNameFrom));

    const DESC_MANAGER::DESC_SET& c_set = DESC_MANAGER::instance().GetClientSet();
    
    for (DESC_MANAGER::DESC_SET::const_iterator it = c_set.begin(); it != c_set.end(); ++it)
    {
        LPDESC d = *it;
        

        if (!d || !d->GetCharacter() || d->GetCharacter() == ch)
            continue;

        // Hazırlanan paketi ve mesajı gönder
        d->BufferedPacket(&pack, sizeof(TPacketGCWhisper));
        d->Packet(argument, iLen);
    }

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

...
 
tüm oyunculara optimize şekilde gönderildi?
 
Geri
Üst