• 🎉 Hey there! I've just launched my brand new server voting platform — Metin2 P Servers 🚀

Daily rewards System

Discord Banner

🔥 Join us on Discord! - Active chat & direct support

We invite you to join the largest Metin2 community on Discord!

Join Now!
Member Count: 
Discord Robot
HUB Bot
Announcement
Discord Banner

🔥 Join us on Discord! - Active chat & direct support

We invite you to join the largest Metin2 community on Discord!

Join Now!
Member Count: 
Discord Robot
HUB Bot
Announcement
Member
Mar
Threads
0
88
1
8
If anyone wants that system gives all rewards other than just one;

ACMD(do_daily_reward_get_reward) {
if (!ch)
return;

char* rewards;
bool reward = false;

// and (NOW() - interval 30 minute > time)
SQLMsg* pkMsg(DBManager::instance().DirectQuery("SELECT reward from player.daily_reward_status where (NOW() > time) and pid = %u", ch->GetPlayerID()));
SQLResult* pRes = pkMsg->Get();
if (pRes->uiNumRows > 0) {
MYSQL_ROW row;
while ((row = mysql_fetch_row(pRes->pSQLResult)) != NULL) {
rewards = row[0];
}
reward = true;
}

if (reward) {

SQLMsg* pkMsg2(DBManager::instance().DirectQuery("SELECT items, count FROM player.daily_reward_items WHERE reward = '%s' ORDER BY RAND()", rewards));
SQLResult* pRes2 = pkMsg2->Get();
if (pRes2->uiNumRows > 0) {
MYSQL_ROW row;
while ((row = mysql_fetch_row(pRes2->pSQLResult)) != NULL) {
char* items = row[0];
char* counts = row[1];

DWORD item;
DWORD count;
str_to_number(item, items);
str_to_number(count, counts);

// Give the item to the player
ch->AutoGiveItem(item, count);
}
}

// Update reward status for the player
DBManager::Instance().DirectQuery("UPDATE daily_reward_status SET reward = CASE WHEN reward = 0 THEN '1' WHEN reward = 1 THEN '2' WHEN reward = 2 THEN '3' WHEN reward = 3 THEN '4' WHEN reward = 4 THEN '5' WHEN reward = 5 THEN '6' WHEN reward = 6 THEN '0' END, total_rewards = total_rewards + 1, time = (NOW() + INTERVAL 1 DAY) WHERE pid = %u", ch->GetPlayerID());
}
else {
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You can't recive the reward yet"));
}
}
You're welcome =)
 
Discord Banner

🔥 Join us on Discord! - Active chat & direct support

We invite you to join the largest Metin2 community on Discord!

Join Now!
Member Count: 
Discord Robot
HUB Bot
Announcement
AdBlock Detected

We get it, advertisements are annoying!

Sure, ad-blocking software does a great job at blocking ads, but it also blocks useful features of our website. For the best site experience please disable your AdBlocker.

I've Disabled AdBlock