Ox Chat Engeli [C++, LUA]

Whistle

Ruhsuz Filozof
Kurucu
Kurumsal Üye
Geliştirici
Yardımsever Üye
Mesaj
11.540
Çözümler
549
Beğeni
12.198
Puan
5.915
Ticaret Puanı
2
Server/game/src/input_main.cpp açılır ve aratılır;
C++:
int CInputMain::Chat(LPCHARACTER ch, const char * data, size_t uiBytes)
Altına şu kod eklenir:
C++:
if (quest::CQuestManager::instance().GetEventFlag("ox_chat_engel") == 1)
{
    if(ch->GetMapIndex() == 113 && (pinfo->type == CHAT_TYPE_TALKING || pinfo->type == CHAT_TYPE_PARTY || pinfo->type == CHAT_TYPE_GUILD || pinfo->type == CHAT_TYPE_SHOUT))
    {
        ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ox konusmasi"));
        return iExtraLen;
    }
}

Lua kodları:
Lua (Quest):
quest ox_chat begin    state start begin
        when 20358.chat."OX Chat Engel" with pc.is_gm() begin
            local durum = game.get_event_flag("ox_chat_engel")
            if durum == 0 then
                say("Chat engeli açmak istiyor musun?")
                say("")
                local ac = select(locale.yes,locale.no)
                if ac == 1 then
                    say("Chat engel aktif.")
                    game.set_event_flag("ox_chat_engel",1)
                end
            else
                say("Chat engeli kapamak istiyor musun?")
                say("")
                local ac = select(locale.yes,locale.no)
                if ac == 1 then
                    say("Chat engel deaktif.")
                    game.set_event_flag("ox_chat_engel",0)
                end
            end
        end
    end
end

Locale stringe ekleyin:
Kod:
"ox konusmasi";
"|cffFFC125Ox mapinde yöneticiler izin vermediği sürece konusamazsın.";

Sistemin çalıştığına dair kanıt;
Ox Chat Engeli [C++, LUA].jpg
 
bu hatayı alıyorum nerde hata yapıyorum
1671274854979.png
1671274907268.png
 
İf koşulunu şu şekilde ekleyin;
C++:
if (quest::CQuestManager::instance().GetEventFlag("ox_chat_engel") == 1)
{
    if(ch->GetMapIndex() == 113 && (pinfo->type == CHAT_TYPE_TALKING || pinfo->type == CHAT_TYPE_PARTY || pinfo->type == CHAT_TYPE_GUILD || pinfo->type == CHAT_TYPE_SHOUT))
    {
        ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ox konusmasi"));
        return iExtraLen;
    }
}
 
İf koşulunu şu şekilde ekleyin;
C++:
if (quest::CQuestManager::instance().GetEventFlag("ox_chat_engel") == 1)
{
    if(ch->GetMapIndex() == 113 && (pinfo->type == CHAT_TYPE_TALKING || pinfo->type == CHAT_TYPE_PARTY || pinfo->type == CHAT_TYPE_GUILD || pinfo->type == CHAT_TYPE_SHOUT))
    {
        ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ox konusmasi"));
        return iExtraLen;
    }
}


Ox mapinde yöneticiler izin vermediği sürece konuşamazsın yazısı sınırsız tekrarlanıyor 1 sn arayla neden olabilir?

Gm hesabında sadece yazı yazarken bu uyarı geliyor ama oyuncu hesabından 1 sn de bir tekrarlanıyor yazmasa bile
 
Son düzenleme:
Ox mapinde yöneticiler izin vermediği sürece konuşamazsın yazısı sınırsız tekrarlanıyor 1 sn arayla neden olabilir?

Gm hesabında sadece yazı yazarken bu uyarı geliyor ama oyuncu hesabından 1 sn de bir tekrarlanıyor yazmasa bile
Yanlış yere eklenmiş olabilir kod blogunun tamamını atar mısın?
 
gm hesaplar konuşamıyor /b /n gibi komutlarda dahil sadece user hesaplara bu engeli yapmak için ne gibi kod yazmalıyız ?
 
gm hesaplar konuşamıyor /b /n gibi komutlarda dahil sadece user hesaplara bu engeli yapmak için ne gibi kod yazmalıyız ?
İf bloğunu şu şekilde değiştirip dene.
C++:
if (quest::CQuestManager::instance().GetEventFlag("ox_chat_engel") == 1 && ch->GetGMLevel() == GM_PLAYER);
 
Son düzenleme:
C++:
if (quest::CQuestManager::instance().GetEventFlag("ox_chat_engel") == 1)
{
    if(ch->GetMapIndex() == 113 && (pinfo->type == CHAT_TYPE_TALKING || pinfo->type == CHAT_TYPE_PARTY || pinfo->type == CHAT_TYPE_GUILD || pinfo->type == CHAT_TYPE_SHOUT))
    {
        if(ch->GetGMLevel() == GM_PLAYER)
        {       
            ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ox konusmasi"));
            return iExtraLen;
        }
    }
}

////////////////

if (quest::CQuestManager::instance().GetEventFlag("ox_chat_engel") == 1)
{
    if(ch->GetMapIndex() == 113 && (pinfo->type == CHAT_TYPE_TALKING || pinfo->type == CHAT_TYPE_PARTY || pinfo->type == CHAT_TYPE_GUILD || pinfo->type == CHAT_TYPE_SHOUT)
        &&     ch->GetGMLevel() == GM_PLAYER)
    {
        ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ox konusmasi"));
        return iExtraLen;
    }
}

İki türlü de deneyebilirsin.
 
C++:
if (quest::CQuestManager::instance().GetEventFlag("ox_chat_engel") == 1)
{
    if(ch->GetMapIndex() == 113 && (pinfo->type == CHAT_TYPE_TALKING || pinfo->type == CHAT_TYPE_PARTY || pinfo->type == CHAT_TYPE_GUILD || pinfo->type == CHAT_TYPE_SHOUT))
    {
        if(ch->GetGMLevel() == GM_PLAYER)
        {      
            ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ox konusmasi"));
            return iExtraLen;
        }
    }
}

////////////////

if (quest::CQuestManager::instance().GetEventFlag("ox_chat_engel") == 1)
{
    if(ch->GetMapIndex() == 113 && (pinfo->type == CHAT_TYPE_TALKING || pinfo->type == CHAT_TYPE_PARTY || pinfo->type == CHAT_TYPE_GUILD || pinfo->type == CHAT_TYPE_SHOUT)
        &&     ch->GetGMLevel() == GM_PLAYER)
    {
        ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ox konusmasi"));
        return iExtraLen;
    }
}

İki türlü de deneyebilirsin.
c++:
#ifdef ENABLE_OXCHATENGEL
    if (quest::CQuestManager::instance().GetEventFlag("ox_chat_engel") == 1)
    {
        if(ch->IsGM() == false)
        {
            if(ch->GetMapIndex() == 113 && (pinfo->type == CHAT_TYPE_TALKING  pinfo->type == CHAT_TYPE_PARTY  pinfo->type == CHAT_TYPE_GUILD || pinfo->type == CHAT_TYPE_SHOUT))
            {
                ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ox konusmasi"));
                return iExtraLen;
            }
        }
    }
#endif

c++ 2:
if (quest::CQuestManager::instance().GetEventFlag("ox_chat_engel") == 1)
    {
        if(!ch->IsGM())
        {
            if(ch->GetMapIndex() == 113 && (pinfo->type == CHAT_TYPE_TALKING  pinfo->type == CHAT_TYPE_PARTY  pinfo->type == CHAT_TYPE_GUILD || pinfo->type == CHAT_TYPE_SHOUT))
            {
                ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ox konusmasi"));
                return iExtraLen;
            }
        }
    }


Bu iki yöntemdede bu hatayı verdi koddada hata olduğunu düşünmüyorum.
Hata:
input_main.cpp:737: error: expected `)' before 'pinfo'
input_main.cpp:742: error: expected `)' before '}' token
input_main.cpp:742: error: expected primary-expression before '}' token
input_main.cpp:742: error: expected `;' before '}' token
 
c++:
#ifdef ENABLE_OXCHATENGEL
    if (quest::CQuestManager::instance().GetEventFlag("ox_chat_engel") == 1)
    {
        if(ch->IsGM() == false)
        {
            if(ch->GetMapIndex() == 113 && (pinfo->type == CHAT_TYPE_TALKING  pinfo->type == CHAT_TYPE_PARTY  pinfo->type == CHAT_TYPE_GUILD || pinfo->type == CHAT_TYPE_SHOUT))
            {
                ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ox konusmasi"));
                return iExtraLen;
            }
        }
    }
#endif

c++ 2:
if (quest::CQuestManager::instance().GetEventFlag("ox_chat_engel") == 1)
    {
        if(!ch->IsGM())
        {
            if(ch->GetMapIndex() == 113 && (pinfo->type == CHAT_TYPE_TALKING  pinfo->type == CHAT_TYPE_PARTY  pinfo->type == CHAT_TYPE_GUILD || pinfo->type == CHAT_TYPE_SHOUT))
            {
                ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ox konusmasi"));
                return iExtraLen;
            }
        }
    }


Bu iki yöntemdede bu hatayı verdi koddada hata olduğunu düşünmüyorum.
Hata:
input_main.cpp:737: error: expected `)' before 'pinfo'
input_main.cpp:742: error: expected `)' before '}' token
input_main.cpp:742: error: expected primary-expression before '}' token
input_main.cpp:742: error: expected `;' before '}' token
burda bahsi geçen kodlama benim kendimce yaptığım kodlama sizinkiyle aynı işlevde sanıyorum
 
C++:
if(ch->GetMapIndex() == 113 && (pinfo->type == CHAT_TYPE_TALKING
Buradan sonraki kısımlara dikkat et, ve-veya operatörleri yok.
 
Geri
Üst