Raised This Month: $ Target: $400
 0% 

About message_const.inc


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
aarons
Junior Member
Join Date: Jan 2005
Old 02-12-2009 , 02:55   About message_const.inc
Reply With Quote #1

msg_type ware defined in mssage_const.inc

Code:
/* Destination types for message_begin() */
#define	MSG_BROADCAST               0        // Unreliable to all
#define	MSG_ONE                     1        // Reliable to one (msg_entity)
#define	MSG_ALL                     2        // Reliable to all
#define	MSG_INIT                    3        // Write to the init string
#define MSG_PVS                     4        // Ents in PVS of org
#define MSG_PAS                     5        // Ents in PAS of org
#define MSG_PVS_R                   6        // Reliable to PVS
#define MSG_PAS_R                   7        // Reliable to PAS
#define MSG_ONE_UNRELIABLE          8        // Send to one client, but don't put in reliable stream, put in unreliable datagram (could be dropped)
#define	MSG_SPEC                    9        // Sends to all spectator proxies
I have some questions about that.

I show the sample cases first:

Case 1:
PHP Code:
new msg[128]
format(msg,127,"^x01test,^x03test,^x04test.")

msg_saytest(id)

public 
msg_saytext(idtext[]) {
    
message_begin(MSG_ONEg_msgid_saytext_id)
    
write_byte(id)
    
write_string(text)
    
message_end()


Case 2:
PHP Code:
new msg[128]
format(msg,127,"^x01test,^x03test,^x04test.")

print_SayText(id)
public 
print_SayText(senderreceiver, const szMessage[])

{
    static 
MSG_typeid;
    if(
receiver 0)
    {
        
MSG_type MSG_ONE_UNRELIABLE;
        
id receiver;
    }
    else
    {
        
MSG_type MSG_BROADCAST;
        
id sender;
    }
    
message_begin(MSG_typesayText_id);
    
write_byte(sender);
    
write_string(szMessage);
    
message_end(); 
    return 
1;

First , if id > 0 , The goal of two different cases is the same ?

Second, if id = 0 , the case 2 will broadcast the msg to all ? But in message_const , that already defined MSG_ALL, what's different ?
aarons is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:00.


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