Posts: 79
Threads: 19
Thanks Received: 0 in 0 posts
Thanks Given: 0
Joined: Jan 2017
Reputation:
0
/index.php?/profile/21802-scura/&do=hovercard&referrer=https%253A%252F%252Flckb.dev%252Fforum%252Findex.php%253F%252Ftopic%252F15085-cash-ticket%252F" href="/index.php?/profile/21802-scura/" title="Go to Scura's profile" rel="">@Scura
I use code from vini
Posts: 340
Threads: 27
Thanks Received: 0 in 0 posts
Thanks Given: 0
Joined: Mar 2021
Reputation:
0
Yea, veni's code is perfect, but i've little cleaned it, probably mine too will works and catch more errors!, "MySQL server has gone away" mean the server as closed the connection ... so ... don't know ?
Posts: 79
Threads: 19
Thanks Received: 0 in 0 posts
Thanks Given: 0
Joined: Jan 2017
Reputation:
0
8 minutes ago, Scura said:
Yea, veni's code is perfect, but i've little cleaned it, probably mine too will works and catch more errors!, "MySQL server has gone away" mean the server as closed the connection ... so ... don't know ?
Yes, now I just ask myself how to fix it.
mysql_error(&gserver.m_dbAuth)
Is already installed in the server.cpp
?
Posts: 228
Threads: 25
Thanks Received: 0 in 0 posts
Thanks Given: 0
Joined: Jan 2014
Reputation:
0
FIX:
ServerRun.cpp
last lines:
void CServer:  ingDB(void)
{
mysql_ping(&m_dbcharingame);
mysql_ping(&m_dbdata);
DBManager::instance()->MySQLPing();
}
add
mysql_ping(&m_dbauth);
Posts: 280
Threads: 42
Thanks Received: 0 in 0 posts
Thanks Given: 0
Joined: Sep 2012
Reputation:
0
Hello, I wanted to share a small change to the code that /index.php?/profile/20534-veni/&do=hovercard" data-mentionid="20534" href="/index.php?/profile/20534-veni/" rel="">@Veni shared
Replacing this:
CLCString message(1024);
message.Format("Wow, you just recieved %d cash!", amount);
CNetMsg::SP clientMsg(new CNetMsg);
SayMsg(clientMsg, MSG_CHAT_NOTICE, 0, "", "", message);
SEND_Q(clientMsg, ch->m_desc);
By this:
CNetMsg::SP clientMsg(new CNetMsg);
SysMsg(clientMsg, MSG_SYS_CASH_TICKET);
SEND_Q(clientMsg, ch->m_desc);
return;
And adding this to SharedLib/MessageType.h -> typedef enum _tagMsgSysType
MSG_SYS_CASH_TICKET, // NICOLASG MARK (CASH TICKET)
And adding this to Engine/Network/MessageDefine.h -> typedef enum _tagMsgSysType
MSG_SYS_CASH_TICKET, // NICOLASG MARK (CASH TICKET)
And adding this to Engine/Network/SessionState.cpp -> void CSessionState::ReceiveSystemMessage( CNetworkMessage *istr )
Note : it is necessary to create a new row in t_string (In this case I assigned the id 6515)
Note 2: i use SYSMSG_NOTIFY, available options: NORMAL, ATTACK, ATTACKED, ERROR, NOTIFY, USER
// NICOLASG MARK (CASH TICKET)
case MSG_SYS_CASH_TICKET:
pUIManager->GetChattingUI()->AddSysMessage(_S(6515, "CASH TICKET USED."), SYSMSG_NOTIFY);
break;
// NICOLASG MARK (CASH TICKET)
you can make the message appear in the system section and not in the player chat, thus being more original to the messaging system designed by the game developers, like:
p.s: the usefulness of this is to be able to change the message from database, in case u have have a server with multiple languages.
Posts: 114
Threads: 3
Thanks Received: 0 in 0 posts
Thanks Given: 0
Joined: Oct 2014
Reputation:
0
oh ya, I never really cared for multiple languages so this is a nice addition. I'd probably, if i ever used string id's, make it so that I can send these via the server itself..
gj tho /index.php?/profile/14423-nicolasg/&do=hovercard" data-mentionid="14423" href="/index.php?/profile/14423-nicolasg/" rel="">@nicolasg
Posts: 228
Threads: 25
Thanks Received: 0 in 0 posts
Thanks Given: 0
Joined: Jan 2014
Reputation:
0
/index.php?/profile/14423-nicolasg/&do=hovercard" data-mentionid="14423" href="/index.php?/profile/14423-nicolasg/" rel="" style="color:#ffffff;font-size:12.6px;padding:0px 5px;">@nicolasg gj my friend, respect
Posts: 340
Threads: 27
Thanks Received: 0 in 0 posts
Thanks Given: 0
Joined: Mar 2021
Reputation:
0
On 5/5/2022 at 12:37 AM, nicolasg said:
// NICOLASG MARK (CASH TICKET)
case MSG_SYS_CASH_TICKET:
pUIManager->GetChattingUI()->AddSysMessage(_S(6515, "CASH TICKET USED."), SYSMSG_NOTIFY);
break; // NICOLASG MARK (CASH TICKET)
You should be able to cast the string, without call the strClient_**.lod file, by casting the _S string into a CTString !
// NICOLASG MARK (CASH TICKET)
case MSG_SYS_CASH_TICKET:
CTString cashString = "You have claimed your cash prize!";
pUIManager->GetChattingUI()->AddSysMessage(cashString, "CASH TICKET USED."), SYSMSG_NOTIFY);
break; // NICOLASG MARK (CASH TICKET)
If you have different language you should be able to split the hardcoded string by a simple condition between which langauge is currently selected! While is unecessary call the server to send the data into client, i prefer not use the lod file and hardcode it!
Posts: 280
Threads: 42
Thanks Received: 0 in 0 posts
Thanks Given: 0
Joined: Sep 2012
Reputation:
0
4 hours ago, Scura said:
You should be able to cast the string, without call the strClient_**.lod file, by casting the _S string into a CTString !
// NICOLASG MARK (CASH TICKET)
case MSG_SYS_CASH_TICKET:
CTString cashString = "You have claimed your cash prize!";
pUIManager->GetChattingUI()->AddSysMessage(cashString, "CASH TICKET USED."), SYSMSG_NOTIFY);
break; // NICOLASG MARK (CASH TICKET)
If you have different language you should be able to split the hardcoded string by a simple condition between which langauge is currently selected! While is unecessary call the server to send the data into client, i prefer not use the lod file and hardcode it!
Excuse my ignorance, why not use the lod file? if anyway the whole game uses it equally
Posts: 340
Threads: 27
Thanks Received: 0 in 0 posts
Thanks Given: 0
Joined: Mar 2021
Reputation:
0
3 minutes ago, nicolasg said:
Excuse my ignorance, why not use the lod file? if anyway the whole game uses it equally
i prefer read what the strings say directly in the source. Specially if i need to manage the variables or attach the place holder into it ... just a personal preference hardcode it (you can of course attach a comment near to it, but i like the hardcode version)!
|