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

Not answered Help DR Voucher not working cash/coins

Sep
Threads
6
55
1
2
8

AD: Mt2009 - Mobile & PC - 30 January 2026 CHECK THE PRESENTATION!

Hi team,
I am having issue with the DR voucher. I have tried it with cash or with coins ( I use coins as DR ) , but nothing, the items don't work.

I have tried different option, I try to provide you as much information I can.

1. Option

I have the function for cash already implemented in source:

game > questlua_pc.cpp

ALUA(pc_charge_cash)
{
TRequestChargeCash packet;

int amount = lua_isnumber(L, 1) ? (int)lua_tonumber(L, 1) : 0;
std::string strChargeType = lua_isstring(L, 2) ? lua_tostring(L, 2) : "";

LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();

if (NULL == ch || NULL == ch->GetDesc() || 1 > amount || 50000 < amount)
{
lua_pushboolean(L, 0);
return 1;
}

packet.dwAID = ch->GetDesc()->GetAccountTable().id;
packet.dwAmount = (DWORD)amount;
packet.eChargeType = ERequestCharge_Cash;

if (0 < strChargeType.length())
std::transform(strChargeType.begin(), strChargeType.end(), strChargeType.begin(), (int(*)(int))std::tolower);

if ("mileage" == strChargeType)
packet.eChargeType = ERequestCharge_Mileage;

db_clientdesc->DBPacketHeader(HEADER_GD_REQUEST_CHARGE_CASH, 0, sizeof(TRequestChargeCash));
db_clientdesc->Packet(&packet, sizeof(packet));

lua_pushboolean(L, 1);
return 1;
}


db > ClientManager.cpp

void CClientManager::ChargeCash(const TRequestChargeCash* packet)
{
char szQuery[512];

if (ERequestCharge_Cash == packet->eChargeType)
sprintf(szQuery, "update account set cash = cash + %d where id = %d limit 1", packet->dwAmount, packet->dwAID);
else if(ERequestCharge_Mileage == packet->eChargeType)
sprintf(szQuery, "update account set mileage = mileage + %d where id = %d limit 1", packet->dwAmount, packet->dwAID);
else
{
sys_err ("Invalid request charge type (type : %d, amount : %d, aid : %d)", packet->eChargeType, packet->dwAmount, packet->dwAID);
return;
}

sys_err ("Request Charge (type : %d, amount : %d, aid : %d)", packet->eChargeType, packet->dwAmount, packet->dwAID);

CDBManager::Instance().AsyncQuery(szQuery, SQL_ACCOUNT);
}

When I go in the client, login and use the item: 80014 or 80015 or 80016 , I can select "Yes" or "Not" ( I NEVER IMPLEMENTED THIS, I DON'T KNOW T_T)
If I select "Yes" item is still there, nothing happen, Cash in account is still 0.

In the FTP main > quest , I don't see any quests for charge so I added it in quest and used ./qc

quest added:

quest charge_cash_by_voucher begin
state start begin
function charge(amount, charge_type)
if charge_type == nil then
charge_type = "cash"
end

if 0 < amount then
-- syntax : pc.charge_cash(amount, charge_type)
-- warning: 1. 'charge_type' : "cash"(default) | "mileage"
-- 2. 'amount' must be positive number.
local result = pc.charge_cash(amount, charge_type)

if true == result then
local item_id = item.get_id()
char_log(item_id, "CHARGE_CASH_BY_VOUCHER", amount)
syschat(string.format(gameforge.charge_cash_by_voucher._010_syschat, amount))

local flag_name = "total_" .. charge_type
pc.setqf(flag_name, pc.getqf(flag_name) + amount)

item.remove()
end
end

return false
end

when 80014.use or 80015.use or 80016.use or 80017.use begin
local amount = item.get_value(0)

charge_cash_by_voucher.charge(amount, "cash")
end
end
end
Font:
After this, still nothing happen.

I also tried to change in source > db > ClientManager.cpp (cash to coins) ( same in the quest) but still same :(

if (ERequestCharge_Cash == packet->eChargeType)
sprintf(szQuery, "update account set coins = coins + %d where id = %d limit 1", packet->dwAmount, packet->dwAID);

Please do you know what I am missing? thank you in advance
 
Solution
Why so much work...
Simply go to char_item.cpp and add this:
Change the vnum for the one you want.
case 80013:
{
DBManager::instance().Query("UPDATE account.account SET coins = coins + 10 WHERE id = %u", GetDesc()->GetAccountTable().id);
item->SetCount(item->GetCount()-1);
ChatPacket(CHAT_TYPE_INFO, "You added 10 coins to your account.");
}
break;

This change must be made inside:
switch (item->GetVnum())
{

With best regards, Doose.
Metin2Hub Bot
M2Hub Bot
Feb
Threads
66
2,380
2
1,307
113
Hi team,
I am having issue with the DR voucher. I have tried it with cash or with coins ( I use coins as DR ) , but nothing, the items don't work.

I have tried different option, I try to provide you as much information I can.

1. Option

I have the function for cash already implemented in source:

game > questlua_pc.cpp

ALUA(pc_charge_cash)
{
TRequestChargeCash packet;

int amount = lua_isnumber(L, 1) ? (int)lua_tonumber(L, 1) : 0;
std::string strChargeType = lua_isstring(L, 2) ? lua_tostring(L, 2) : "";

LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();

if (NULL == ch || NULL == ch->GetDesc() || 1 > amount || 50000 < amount)
{
lua_pushboolean(L, 0);
return 1;
}

packet.dwAID = ch->GetDesc()->GetAccountTable().id;
packet.dwAmount = (DWORD)amount;
packet.eChargeType = ERequestCharge_Cash;

if (0 < strChargeType.length())
std::transform(strChargeType.begin(), strChargeType.end(), strChargeType.begin(), (int(*)(int))std::tolower);

if ("mileage" == strChargeType)
packet.eChargeType = ERequestCharge_Mileage;

db_clientdesc->DBPacketHeader(HEADER_GD_REQUEST_CHARGE_CASH, 0, sizeof(TRequestChargeCash));
db_clientdesc->Packet(&packet, sizeof(packet));

lua_pushboolean(L, 1);
return 1;
}


db > ClientManager.cpp

void CClientManager::ChargeCash(const TRequestChargeCash* packet)
{
char szQuery[512];

if (ERequestCharge_Cash == packet->eChargeType)
sprintf(szQuery, "update account set cash = cash + %d where id = %d limit 1", packet->dwAmount, packet->dwAID);
else if(ERequestCharge_Mileage == packet->eChargeType)
sprintf(szQuery, "update account set mileage = mileage + %d where id = %d limit 1", packet->dwAmount, packet->dwAID);
else
{
sys_err ("Invalid request charge type (type : %d, amount : %d, aid : %d)", packet->eChargeType, packet->dwAmount, packet->dwAID);
return;
}

sys_err ("Request Charge (type : %d, amount : %d, aid : %d)", packet->eChargeType, packet->dwAmount, packet->dwAID);

CDBManager::Instance().AsyncQuery(szQuery, SQL_ACCOUNT);
}

When I go in the client, login and use the item: 80014 or 80015 or 80016 , I can select "Yes" or "Not" ( I NEVER IMPLEMENTED THIS, I DON'T KNOW T_T)
If I select "Yes" item is still there, nothing happen, Cash in account is still 0.

In the FTP main > quest , I don't see any quests for charge so I added it in quest and used ./qc

quest added:

quest charge_cash_by_voucher begin
state start begin
function charge(amount, charge_type)
if charge_type == nil then
charge_type = "cash"
end

if 0 < amount then
-- syntax : pc.charge_cash(amount, charge_type)
-- warning: 1. 'charge_type' : "cash"(default) | "mileage"
-- 2. 'amount' must be positive number.
local result = pc.charge_cash(amount, charge_type)

if true == result then
local item_id = item.get_id()
char_log(item_id, "CHARGE_CASH_BY_VOUCHER", amount)
syschat(string.format(gameforge.charge_cash_by_voucher._010_syschat, amount))

local flag_name = "total_" .. charge_type
pc.setqf(flag_name, pc.getqf(flag_name) + amount)

item.remove()
end
end

return false
end

when 80014.use or 80015.use or 80016.use or 80017.use begin
local amount = item.get_value(0)

charge_cash_by_voucher.charge(amount, "cash")
end
end
end
Font:
After this, still nothing happen.

I also tried to change in source > db > ClientManager.cpp (cash to coins) ( same in the quest) but still same :(

if (ERequestCharge_Cash == packet->eChargeType)
sprintf(szQuery, "update account set coins = coins + %d where id = %d limit 1", packet->dwAmount, packet->dwAID);

Please do you know what I am missing? thank you in advance

Hello dear user,

Your post will be under surveillance by bots for the next few hours.

Forum description : Metin2 private server, Metin2 download, Metin2 support, Metin2 Forum, Metin2 Pvp Servers, Errors, Bugs, Requests, Metin2 Pvp Forum, Everything About Metin2.
 
Member
May
Threads
0
115
1
1
18
Why so much work...
Simply go to char_item.cpp and add this:
Change the vnum for the one you want.
case 80013:
{
DBManager::instance().Query("UPDATE account.account SET coins = coins + 10 WHERE id = %u", GetDesc()->GetAccountTable().id);
item->SetCount(item->GetCount()-1);
ChatPacket(CHAT_TYPE_INFO, "You added 10 coins to your account.");
}
break;

This change must be made inside:
switch (item->GetVnum())
{

With best regards, Doose.
 
Solution
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