gms_chat_team_only_set

Usage: gms_chat_team_only_set ( enable )

Description

Enables or disables the team-only modus.

Replies (4)

Last message on 30 Jan 2017

Dublann on 21 Jan 2017, 19:55:00
Hi Size,

I am having 2 rooms with different chats. One is for all players and the other for only team players.

For the all players chat, I have in the create event of the chat object the gms_chat_team_only_set (0) function, in order to avoid to see the team members chat messages.

For the only team players, I use the gms_chat_team_only_set (1) in the create event of the another chat object. Then, I have tried the gms_chat() function and the gms_chat_keys() function in order to try to send the message only to the team members, but I cant. The message is shown in the all players chat also.

How can I send the message only in the team chat object?

PS: I have done the test of two players in different teams, and both see the same message.

Thx!
Size43 (Administrator) on 22 Jan 2017, 09:35:54
Did you set the team of the players using gms_team_join()?

Note that if team chat is turned off, a message will go to all players in the session. If it's on, it will only go to players that are in the same team.
Dublann on 22 Jan 2017, 14:38:16
Yep. I will explain how I structured the code:

In one object, with get_string, you save in a variable what is written as the team_id, and you can join to the team written using gms_team_join (I have tried the team_id as a name and as a number, and both dont work).

Then, it moves you to another room, where all members are, and where there is a members chat only. There, I have checked what is your team_id using show_message(string(gms_team_get_current ( ))) and it returns always 0. Using show_message(string(gms_team_find_player(gms_self_playerid()))) also returns 0. What am I doing wrong?
Size43 (Administrator) on 30 Jan 2017, 10:57:15
team_id should be a number between 0 and the number of teams.

I believe gms_team_find_player will only work for other players, so it wouldn't work with gms_self_playerid(). For that, you can use gms_team_get_current().