Page 1 of 1

Send message to a single player

Posted: Thu Oct 09, 2014 2:31 pm
by Grimston
Greetings,

I was wondering what the equivalent of es.tell is?

Syntax: Select all

#BuildMessage wraps a colored prefix to the message, that works fine
def Tell(self, msg, *target):
for t in target:
SayText2(BuildMessage(msg), 0, t).send()

#This event is in my own class, the GameEvent var is passed straight from the actual EventHook
def OnPlayerJump(self, GameEvent):
self.Tell("You have jumped!", index_from_userid(GameEvent.get_int("userid")))


As I understand its
SayText2(Message, [Index], [Users]) - Little confused as to what the index is about... from what i can tell, the player saying the message? (Kind of want to get the same result as es.tell and es.msg)

This works but is viewable by everyone

I have tried TextMsg but this results in instant crashing when attempting to call it.

Regards, Grimston

Posted: Thu Oct 09, 2014 4:11 pm
by Tuck
Index for a player on CT will give blue "team color" and so on for t and spec, just put the users index

this bellow is how i would do it For example:

Syntax: Select all

Saytext2(msg, user.index, user)

Posted: Thu Oct 09, 2014 4:58 pm
by Grimston
Ah okay, so it allows for doing both.

What exactly are you passing in for the user, the userid, index or steamid?

As I'm still getting every message show to all (Testing with bots in mimic mode to create the events)

Posted: Thu Oct 09, 2014 5:53 pm
by satoon101
You can pass in a player's index, a list of indexes, a PlayerIter instance, or a RecipientFilter instance.

Posted: Fri Oct 10, 2014 12:38 am
by L'In20Cible
Your Tell function could also be:

Syntax: Select all

def Tell(self, msg, *target): 
SayText2(BuildMessage(msg)).send(*target)
That way you are not creating multiple messages while sending it to multiple users.