Page 1 of 1

Info Message

Posted: Sun Nov 09, 2014 7:47 am
by nullable
Hello. I want a message like "Match started" on the top center of screen.
But HintText, SayText2 not what I need. Please help me of code example.

Posted: Sun Nov 09, 2014 10:28 am
by L'In20Cible

Syntax: Select all

from events import Event
from messages import TextMsg

game_started = TextMsg(message='Game started',
destination=TextMsg.HUD_PRINTCENTER)

@Event
def round_start(game_event):
game_started.send()

Posted: Sun Nov 09, 2014 6:55 pm
by nullable
Thanks, but this code to crash my csgo :)

Posted: Mon Nov 10, 2014 2:49 pm
by satoon101
I can confirm that using TextMsg crashes my client (not the server). I also tried using HintText and KeyHintText, which I know used to work a long time ago. While neither of the two crashed the server or my client, no message was printed.

Posted: Mon Nov 10, 2014 4:26 pm
by satoon101
Ok, so I figured out the crashing issue. The parameters for TextMsg were incorrect. I will commit the fixes here in a few. However, even after doing so, I still do not receive any message on my screen...

Posted: Mon Nov 10, 2014 5:46 pm
by L'In20Cible
Actually, there is no "msg_name" for TextMsg:

Syntax: Select all

message CCSUsrMsg_TextMsg
{
optional int32 msg_dst = 1;
repeated string params = 3;
}
It seems that the first string wrote to "params" is the main string and others are just formated to it.

EDIT: HintText and KeyHintText both works on my side. I think I know why they didn't, on your side. Like I commented here, ResetHud is sent every round start to clean players' hud so you need to delay any HintText/KeyHintText if you want to send them on round_start.

Posted: Mon Nov 10, 2014 5:59 pm
by satoon101
I noticed that too. However, I also noticed this post of your's from a while back (dev eyes only):
http://forums.sourcepython.com/showthread.php?202&p=1260&viewfull=1#post1260

The link in your second edit led me to the conclusion that maybe we needed another value. Through all my testing, the only one that does not crash my client is when I have both msg_name and params. Though, again, nothing is printed.

I will continue to test, and see if I can figure this out.

Posted: Mon Nov 10, 2014 7:03 pm
by Ayuto
Not sure if this has something to do with this issue. https://github.com/Source-Python-Dev-Team/Source.Python/issues/4
I never had the motivation to take a look at it.

Posted: Mon Nov 10, 2014 7:14 pm
by L'In20Cible
Actually, I got it working with the following:

Syntax: Select all

from events import Event
from filters.recipients import RecipientFilter
from _messages import UserMessage

@Event
def player_jump(game_event):
x = RecipientFilter() # Need to keep it alive the time send_message gets called.
msg = UserMessage(x, 'TextMsg')
msg.set_byte('msg_dst', 4)
msg.set_string('params', 'Hello!', 1)
msg.send_message()
However, this is the same result as HintText and KeyHintText. They all three prints the message at this area: http://img15.hostingpics.net/pics/5258302014111000001.jpg

Posted: Mon Nov 10, 2014 7:21 pm
by satoon101
Even though it is the same, we still need to support it within our messages package with the TextMsg class. When you get the chance, please update the data or package to fix this issue. And yes, Ayuto, we do still need to go back through and fix any other issues that exist within the messages package, especially in relation to CS:GO.

Posted: Mon Nov 10, 2014 9:05 pm
by nullable
I need message like: "PLAYING ON TEAM COUNTER-STRIKE" on image http://img15.hostingpics.net/pics/5258302014111000001.jpg

Posted: Mon Nov 10, 2014 10:12 pm
by satoon101
I don't know that we have access to that, but we will attempt to find out. I do know that toptext doesn't work, as none of the Dialog messages work in CS:GO.

Posted: Tue Nov 11, 2014 8:41 pm
by satoon101
Actually, using the exact script L'In20Cible has shown with player_jump, my client crashes...