Cash ticket
#21

/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

#22

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 ?

#23


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

?

#24

FIX:

ServerRun.cpp

last lines: 

void CServer:TongueingDB(void)
{
mysql_ping(&m_dbcharingame);

mysql_ping(&m_dbdata);

DBManager::instance()->MySQLPing();
}

add

mysql_ping(&m_dbauth);

#25

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.

#26

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

#27

/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

#28


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! 

#29


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

#30


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)!



Forum Jump:


Users browsing this thread: 1 Guest(s)