Cash ticket
#11

2

#12

Problem found. I just created completely new items after that everything works,

I thank everyone who helped me. You are the best

#13

your flags were probaby wrong, but good that everything works now.

#14

Something else I noticed this message everyone gets, can you put it privately?

 

message.Format("Wow, you just recieved %d cash!", amount);

#15

sure, change the last two lines if its only supposed to go to the character directly.

 

SayMsg(clientMsg, MSG_CHAT_NOTICE, 0, "", "", message);
SEND_Q(clientMsg, ch->m_desc);

depending on what enum you use as the second argument in SayMsg, it will look different. For example "MSG_CHAT_SHOUT". Shout will mute the Server eventually tho.

#16

Thanks ?

#17

Hello.

me again.

i have another problem.

the cash tickets no longer work after about 3 hours

The chat says I have received cash.

but nothing is credited.

I've already tried different flags from Item but no solution

Can anyone help me?

Best regards

#18


2 hours ago, Matt Hias said:




Hello.

me again.

i have another problem.

the cash tickets no longer work after about 3 hours

The chat says I have received cash.

but nothing is credited.

I've already tried different flags from Item but no solution

Can anyone help me?

Best regards




Don't think it will solve, but i've cleaned a little bit the code 

bool do_ItemUse_CashTicket(CPC* ch, const CItemProto* itemproto)
{
CLCString TicketQuery(1024);
CDBCmd DBTicket;
DBTicket.Init(&gserver->m_dbauth);

int userIndex = ch->m_desc->m_index;

TicketQuery.Format("UPDATE bg_user SET cash = cash + 100 WHERE user_code = '%d'", userIndex);

DBTicket.SetQuery(TicketQuery);
if (!DBTicket.Update() || !DBTicket.MoveFirst())
{
LOG_INFO("CashTicket[100] Failed at USER_INDEX[%d]", userIndex);
return false;
}
LOG_INFO("CashTicket[100] Success at USER_INDEX[%d]", userIndex);
return true;
}

Indeed you should be able to hook the mysql error in case ... don't think is necessary by the way .. is a really simple code ... 

 

didn't look in deep ... you should be able to catch the mysql error in case , and log it in a string. This should be how the hook code looks like, check out didn't test

mysql_error(&gserver.m_dbAuth);

 

#19


6 hours ago, Matt Hias said:




Hello.

me again.

i have another problem.

the cash tickets no longer work after about 3 hours

The chat says I have received cash.

but nothing is credited.

I've already tried different flags from Item but no solution

Can anyone help me?

Best regards




Mysql is gone away?

 

added:

2021-04-23 05:36:41,877 ERROR [ DBCmd.cpp : 113] - query error (mysql_real_query) : error[MySQL server has gone away] query[UPDATE bg_user SET cash = cash + 1000 WHERE user_code = 7]

 

#20


6 hours ago, rondo157 said:




Mysql is gone away?



 



added:




2021-04-23 05:36:41,877 ERROR [ DBCmd.cpp : 113] - query error (mysql_real_query) : error[MySQL server has gone away] query[UPDATE bg_user SET cash = cash + 1000 WHERE user_code = 7]


yes



2021-04-23 09:53:48,854 ERROR [           DBCmd.cpp :   113] - query error (mysql_real_query) : error[MySQL server has gone away] query[UPDATE bg_user SET cash = cash + 10 WHERE user_code = 4]

2021-04-23 09:53:48,854 ERROR [      doFuncItem.cpp : 12878] - Cash Query failed for user 4. Tried to add 10 cash. no item loss.



how can i fix this?




 


6 hours ago, rondo157 said:




 




 



Forum Jump:


Users browsing this thread: 1 Guest(s)