Jump to content
  • 0

Launcher binaries function that prints something in ingame chat


astroNOT
Go to solution Solved by VegaS™,

Question

2 answers to this question

Recommended Posts

  • 2
  • Moderator
  • Solution
Posted (edited)
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 post
  • 0
  • VIP
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 post
Guest
This topic is now closed to further replies.


×
×
  • 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.