Im still tryna understand whats problem inside of code, after sending custom notice ps_game crashed.
***
AdminCmdNoticeAllOutgoing createNotice(const std::string& message) {
AdminCmdNoticeAllOutgoing notice{};
notice.messageLength = message.length();
std::memcpy(¬ice.message, message.c_str(), message.length());
return notice;
}
***
std::string output;
auto charId = std::stoi(args.at(0));
std::string Notice = args.at(1);
CUser* user = CWorld::FindUser(charId);
if (!user)
{
std::stringstream output_msg;
output_msg << "Character not found !!";
output = output_msg.str();
return 0;
}
auto SendNotice = createNotice(Notice);
SConnection::Send(&user->connection, &SendNotice, sizeof(SendNotice));
std::stringstream output_msg;
output_msg << "notice send to player ok !";
output = output_msg.str();
***
AdminCmdNoticeAllOutgoing createNotice(const std::string& message) {
AdminCmdNoticeAllOutgoing notice{};
notice.messageLength = message.length();
std::memcpy(¬ice.message, message.c_str(), message.length());
return notice;
}
***
std::string output;
auto charId = std::stoi(args.at(0));
std::string Notice = args.at(1);
CUser* user = CWorld::FindUser(charId);
if (!user)
{
std::stringstream output_msg;
output_msg << "Character not found !!";
output = output_msg.str();
return 0;
}
auto SendNotice = createNotice(Notice);
SConnection::Send(&user->connection, &SendNotice, sizeof(SendNotice));
std::stringstream output_msg;
output_msg << "notice send to player ok !";
output = output_msg.str();