View Single Post
Re: help - radio emulation
Old
  (#3)
commonbullet
Member
 
commonbullet's Avatar
 
Status: Offline
Posts: 49
Join Date: Nov 2004
Default Re: help - radio emulation - 19-10-2005

I’m actually not sendind the edict information directly.

The pev list is too big, I can’t guess which is the one for the sender, or I don’t know if it’s implicitly passed by the messages. So here’s a sample code:

Code:
 public Radio(id) 

{

			// BotVoice =135

			// SendAudio = 100

			// TextMsg = 77

			

			server_print (g_playerLocation[id])  

			message_begin (MSG_ALL,135) // I don’t know if it should be MSG_ALL…

			write_byte (1) // start radio message

			write_byte (id) //user id

			message_end () 

			set_task (3,"clearMsg",id) //delay before clear msg

			

			message_begin(MSG_ALL,100)

			write_byte (id) // player id

			write_string ("%!MRAD_HITASSIST") // sample taking fire

			write_short (100) //voice pitch

			message_end ()		   

			

			new sid[3] // sender id to String

			new uname[32] // sender name

			format (sid,2,"%d",id)

			get_user_name (id,uname,31)

			

			message_begin( MSG_ALL,77)

			write_byte (5) // i don't know why "5", i guess it's the message type

			write_string (sid) // sender id string, i guess

			write_string ("#Game_radio_location")

			write_string (uname) //sender name   

			/* g_playerLocation is a global array that

			   contains the current user location

			   and is updated by "Location" event

			*/		 

			write_string (g_playerLocation[id]) 

			write_string ("#Taking_fire") //sample taking fire

			message_end ()		   

}

 

public clearMsg(id){ 

			message_begin(MSG_ALL, 135) 

			write_byte(0) 

			write_byte(id) 

			message_end() 

}

Thanks.
  
Reply With Quote