No need to loop through all players yourself. If you do not pass a value for users, all users are sent the message. Also, the message package classes automatically loop through and send the appropriate translation for each user. This is how I would use both SayText2 and HintText:
Syntax: Select all
from messages import HintText
from messages import SayText2
my_hint = HintText(message='This is a test hinttext message')
my_saytext2 = SayText2(message='\x01One\x02 Two\x03 Three\x04 Four\x05 Five\x06 Six\x07 Seven')
def something():
my_hint.send()
my_saytext2.index = 1
my_saytext2.send()
Also, as I stated, you can pass in LangStrings values for the message, and each of the users will be sent their specific translation:
Syntax: Select all
# ../resource/source-python/translations/myaddon.ini
[HintText]
en = "This is a test hinttext message"
[SayText2]
en = "\x01One\x02 Two\x03 Three\x04 Four\x05 Five\x06 Six\x07 Seven"
Syntax: Select all
from messages import HintText
from messages import SayText2
from translations.strings import LangStrings
my_strings = LangStrings('myaddon')
my_hint = HintText(message=my_strings['HintText'])
my_saytext2 = SayText2(message=my_strings['SayText2'])
def something():
my_hint.send()
my_saytext2.index = 0
my_saytext2.send()
Obviously, if you want to use the "index" (used for the "team" color, /x03) of each user for their own message, then you will have to loop through each one. Or, at the very least, you can loop through each team and choose one index from the team and set the users on send().