AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How works Team_Info? (https://forums.alliedmods.net/showthread.php?t=92669)

-=hunter=- 05-18-2009 05:27

How works Team_Info?
 
Help please. I can't understand how works Team_Info. When I send message to all players after setting TeamInfo to Terrorist then sometimes players receives message with blue text.
How correctly to change TeamInfo?

message_begin(MSG_ONE,get_user_msgid("TeamInf o"),_,id);
write_byte(id); //what here to write?
write_string("TERRORIST");
message_end();

i can't understand differing MSG_ALL from MSG_ONE and differing "id" in message_begin from "id" in write_byte.

-=hunter=- 05-18-2009 08:12

Re: How works Team_Info?
 
Somebody can explain this differences?

Arkshine 05-18-2009 08:55

Re: How works Team_Info?
 
MSG_ALL or MSG_BROADCAST will sent the message for all connected players.

MSG_ONE or MSG_UNRELIABLE will sent the message only for the player's id provided in message_begin().

The first write_byte() is to specify the player's id you want to change teaminfo.

-=hunter=- 05-19-2009 01:46

Re: How works Team_Info?
 
arkshine
Thank you.

I have experimented with a code (below) and have understood because of what there was a problem:

Code:

message_begin(MSG_ALL, get_user_msgid("TeamInfo"));
write_byte(2);
write_string("CT");
message_end();
       
message_begin(MSG_ONE,get_user_msgid("SayText"),_,1);
write_byte(2);
write_string("^x03hello^x01"); // Message will be with blue colour text
message_end();

message_begin(MSG_ALL, get_user_msgid("TeamInfo"));
write_byte(2);
if (team==1) write_string("TERRORIST");
else write_string("CT");
message_end();

If to use
Code:

message_begin(MSG_ALL, get_user_msgid("TeamInfo"));
then necessary to send message "^x03hello^x01" with type MSG_ALL
otherwise player1 will receive message with initial team colour of player2.

In this case its necessary to use each time TeamInfo on each player :(.


All times are GMT -4. The time now is 01:33.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.