12-25-2020, 06:57 PM
so when testing around i just remembered there wasn't a way to add cash to your account via command, so let's change this..
doFuncAdmin.cpp:
void do_GM_Cash(CPC* ch, const char* arg, std::vector<std:
tring>& vec){
char tmpBuf[MAX_MESSAGE_SIZE] = { 0, };
*tmpBuf = '\0';
if (!arg || !(*arg))
return;
arg = AnyOneArg(arg, tmpBuf, true);
int amount = atoi(tmpBuf);
CLCString sql(2048);
CDBCmd cmd;
cmd.Init(&gserver->m_dbauth);
sql.Format("UPDATE bg_user SET cash = %d WHERE user_code = %d", amount, ch->m_desc->m_index);
cmd.SetQuery(sql);
if (!cmd.Update())
{
LOG_ERROR("Cash Query failed");
}
}
doFuncAdmin.h:
void do_GM_Cash(CPC* ch, const char* arg, std::vector<std:
tring>& vec);GMCmdList.cpp:
add(new CGMCmd("cash", 10, do_GM_Cash));
YOU ALSO NEED TO ADD WHAT KRAVENS POSTED BELOW FOR THIS TO WORK PROPERLY! THE DEFAULT GAMESERVER DOESN'T HAVE CONNECTION TO THE AUTH DATABASE!
Then after adding it you just need to use the command /cash and type whatever number you want.

