Jump to content

Launcher binaries function that prints something in ingame chat


Go to solution Solved by VegaS™,

Recommended Posts

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

  • Forum Moderator
  • Solution
C++
#include "PythonChat.h"
#include "PythonPlayer.h"

char buf[512 + 1];
_snprintf(buf, sizeof(buf), "Hello, %s!", CPythonPlayer::Instance().GetName());
CPythonChat::Instance().AppendChat(CHAT_TYPE_INFO, buf);

Python:

import chat
import player

chat.AppendChat(chat.CHAT_TYPE_INFO, "Hello, {}.".format(player.GetName()))

Keep in mind that's a local message, will be visible just for your instance.

If you want to send a message through the server that everyone can see it, you've to use this way:

#include "PythonChat.h"
#include "PythonPlayer.h"
#include "PythonNetworkStream.h"

char buf[512 + 1];
_snprintf(buf, sizeof(buf), "Hello, %s!", CPythonPlayer::Instance().GetName());
CPythonNetworkStream::Instance().SendChatPacket(buf, CHAT_TYPE_SHOUT);

 

Edited by VegaS™
Link to comment
Share on other sites

  • Premium
31 minutes ago, VegaS™ said:
C++

#include "PythonChat.h"
#include "PythonPlayer.h"

char buf[512 + 1];
_snprintf(buf, sizeof(buf), "Hello, %s!", CPythonPlayer::Instance().GetName());
CPythonChat::Instance().AppendChat(CHAT_TYPE_INFO, buf);

Python:


import chat
import player

chat.AppendChat(chat.CHAT_TYPE_INFO, "Hello, {}.".format(player.GetName()))

Keep in mind that's a local message, will be visible just for your instance.

If you want to send a message through the server that everyone can see it, you've to use this way:


#include "PythonChat.h"
#include "PythonPlayer.h"
#include "PythonNetworkStream.h"

char buf[512 + 1];
_snprintf(buf, sizeof(buf), "Hello, %s!", CPythonPlayer::Instance().GetName());
CPythonNetworkStream::Instance().SendChatPacket(buf, CHAT_TYPE_SHOUT);

 

This is gr8, i mainly wanna use it for debugging purposes, only way I came up with do do any debugging, thanks!

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.