- Katılım
- 16 Tem 2019
- Konular
- 715
- Mesajlar
- 3,551
- Çözüm
- 47
- Online süresi
- 6mo 20d
- Reaksiyon Skoru
- 2,110
- Altın Konu
- 34
- Başarım Puanı
- 309
- MmoLira
- 19,559
- DevLira
- 122
ROHAN2 WORLD 1-120 TR TİPİ OFFICIAL YOHARA, BALATHOR VE AMON! 80. GÜNÜNDE! +10.000 ONLİNE! HİLE VE BOT %100 ENGELLİ HEMEN TIKLA!
konuya dahil ettim
0 = tamamen kapalı
1 = herkes girebilir (default)
2 = sadece GM girebilir
Chat.cpp en üste ekle
#i#includeunordered_map>
static std::unordered_map<long, BYTE> g_mapAccessCache;
Kod:
BYTE CHARACTER::GetMapAccessMode(long lMapIndex)
{
auto it = g_mapAccessCache.find(lMapIndex);
if (it != g_mapAccessCache.end())
return it->second;
char query[256];
snprintf(query, sizeof(query), "SELECT access_mode FROM map_access_control WHERE map_index = %ld", lMapIndex);
std::unique_ptr<SQLMsg> msg(DBManager::instance().DirectQuery(query));
BYTE accessMode = 1;
if (msg->Get()->uiNumRows > 0)
{
MYSQL_ROW row = mysql_fetch_row(msg->Get()->pSQLResult);
if (row && row[0])
accessMode = static_cast<BYTE>(atoi(row[0]));
}
g_mapAccessCache[lMapIndex] = accessMode;
return accessMode;
}
Kod:
bool CHARACTER::IsMapAccessAllowed(long lMapIndex)
{
BYTE accessMode = GetMapAccessMode(lMapIndex);
switch (accessMode)
{
case 0:
return false; // Harita tamamen kapalı
case 1:
return true; // Herkese açık
case 2:
return IsGM(); // Sadece GM'ler girebilir
default:
return true;
}
}
Kod:
warpset fonksiyonunun en başına ekleyin.
if (!IsMapAccessAllowed(lMapIndex))
{
if (GetDesc())
ChatPacket(CHAT_TYPE_INFO, "Bu haritaya giriş şu anda kapalı.");
return false;
}
Kod:
void ClearMapAccessCache()
{
g_mapAccessCache.clear();
}
Bu fonksiyonu bir GM komutuna ya da reload sistemine bağlarsan cache güncellenir.
/map_access set 21 0
Şeklinde gm kodu olarak da yapılabilir
Veya günlük olarak aç kapa otomatik yapacak sistem de yapılabilir.
- Katılım
- 16 Tem 2019
- Konular
- 715
- Mesajlar
- 3,551
- Çözüm
- 47
- Online süresi
- 6mo 20d
- Reaksiyon Skoru
- 2,110
- Altın Konu
- 34
- Başarım Puanı
- 309
- MmoLira
- 19,559
- DevLira
- 122
İçimden geldi quest olarak da vereyim aç kapayı
Quest fonksiyonu
pc.clear_map_access_cache()
Kod:
quest mapcontrol begin
state start begin
when login with pc.is_gm() begin
send_letter("Harita Kontrol Paneli")
end
when button or info begin
say_title("Harita Erişim Paneli")
say("Hangi harita kontrol edilecek?")
local map_index = tonumber(input())
say("Yeni erişim modu ne olsun?")
say("0 = Tamamen kapalı")
say("1 = Herkese açık")
say("2 = Sadece GM")
local mode = tonumber(input())
if map_index and mode and (mode >= 0 and mode <= 2) then
local query = string.format(
"REPLACE INTO map_access_control (map_index, access_mode) VALUES (%d, %d)",
map_index, mode
)
mysql_query(query)
say_reward(string.format("Harita %d için mod %d olarak ayarlandı.", map_index, mode))
else
say("Geçersiz giriş yaptınız.")
end
end
end
end
Kod:
void CHARACTER::ClearMapAccessCache()
{
g_mapAccessCache.clear();
}
Kod:
{ "clear_map_access_cache", pc_clear_map_access_cache },
Kod:
questlua_pc.cpp
int pc_clear_map_access_cache(lua_State* L)
{
ClearMapAccessCache();
return 0;
}
pc.clear_map_access_cache()
Son düzenleme:
- Katılım
- 29 Ocak 2025
- Konular
- 2
- Mesajlar
- 7
- Online süresi
- 8d 6h
- Reaksiyon Skoru
- 3
- Altın Konu
- 0
- Başarım Puanı
- 24
- MmoLira
- 954
- DevLira
- 6
Bu şekilde kullanmak için nasıl ekleme yapabiliriz0 = tamamen kapalı
1 = herkes girebilir (default)
2 = sadece GM girebilir
Chat.cpp en üste ekle
#i#includeunordered_map>
static std::unordered_map<long, BYTE> g_mapAccessCache;
Kod:BYTE CHARACTER::GetMapAccessMode(long lMapIndex) { auto it = g_mapAccessCache.find(lMapIndex); if (it != g_mapAccessCache.end()) return it->second; char query[256]; snprintf(query, sizeof(query), "SELECT access_mode FROM map_access_control WHERE map_index = %ld", lMapIndex); std::unique_ptr<SQLMsg> msg(DBManager::instance().DirectQuery(query)); BYTE accessMode = 1; if (msg->Get()->uiNumRows > 0) { MYSQL_ROW row = mysql_fetch_row(msg->Get()->pSQLResult); if (row && row[0]) accessMode = static_cast<BYTE>(atoi(row[0])); } g_mapAccessCache[lMapIndex] = accessMode; return accessMode; }
Kod:bool CHARACTER::IsMapAccessAllowed(long lMapIndex) { BYTE accessMode = GetMapAccessMode(lMapIndex); switch (accessMode) { case 0: return false; // Harita tamamen kapalı case 1: return true; // Herkese açık case 2: return IsGM(); // Sadece GM'ler girebilir default: return true; } }
Kod:warpset fonksiyonunun en başına ekleyin. if (!IsMapAccessAllowed(lMapIndex)) { if (GetDesc()) ChatPacket(CHAT_TYPE_INFO, "Bu haritaya giriş şu anda kapalı."); return false; }
Kod:void ClearMapAccessCache() { g_mapAccessCache.clear(); } Bu fonksiyonu bir GM komutuna ya da reload sistemine bağlarsan cache güncellenir.
/map_access set 21 0
Şeklinde gm kodu olarak da yapılabilir
Veya günlük olarak aç kapa otomatik yapacak sistem de yapılabilir.
- Katılım
- 22 Eki 2024
- Konular
- 27
- Mesajlar
- 268
- Online süresi
- 1mo 3d
- Reaksiyon Skoru
- 166
- Altın Konu
- 0
- Başarım Puanı
- 74
- MmoLira
- 2,296
- DevLira
- 42
benim şu offline shop a da el atsana ASİçimden geldi quest olarak da vereyim aç kapayı
Kod:quest mapcontrol begin state start begin when login with pc.is_gm() begin send_letter("Harita Kontrol Paneli") end when button or info begin say_title("Harita Erişim Paneli") say("Hangi harita kontrol edilecek?") local map_index = tonumber(input()) say("Yeni erişim modu ne olsun?") say("0 = Tamamen kapalı") say("1 = Herkese açık") say("2 = Sadece GM") local mode = tonumber(input()) if map_index and mode and (mode >= 0 and mode <= 2) then local query = string.format( "REPLACE INTO map_access_control (map_index, access_mode) VALUES (%d, %d)", map_index, mode ) mysql_query(query) say_reward(string.format("Harita %d için mod %d olarak ayarlandı.", map_index, mode)) else say("Geçersiz giriş yaptınız.") end end end end
Kod:void CHARACTER::ClearMapAccessCache() { g_mapAccessCache.clear(); }Kod:{ "clear_map_access_cache", pc_clear_map_access_cache },
Quest fonksiyonuKod:questlua_pc.cpp int pc_clear_map_access_cache(lua_State* L) { ClearMapAccessCache(); return 0; }
pc.clear_map_access_cache()

Şu an konuyu görüntüleyenler (Toplam : 0, Üye: 0, Misafir: 0)
Benzer konular
- Cevaplar
- 8
- Görüntüleme
- 309
- Cevaplar
- 0
- Görüntüleme
- 276
- Cevaplar
- 9
- Görüntüleme
- 446
- Cevaplar
- 33
- Görüntüleme
- 2K






