HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /* AMX Mod X
  2. * Real Radio
  3. *
  4. * www.amxmodx.extra.hu Forditotta kiki
  5. *
  6. * This file is provided as is (no warranties)
  7. *
  8. * DESCRIPTION
  9. * Plugin allow hear radio commands over certain distance.
  10. *
  11. * FEATURES
  12. * - configurable sound parameters (attenuation, volume etc)
  13. * - "Fun Radio" plugin support
  14. *
  15. * CONFIGURATION
  16. * CHAN - channel (default: CHAN_VOICE)
  17. * VOL - volume (default: VOL_NORM)
  18. * ATTN - attenuation (default: ATTN_STATIC)
  19. * FLAGS - flags (default: 0)
  20. * PITCH - pitch (default: PITCH_NORM)
  21. * CVAR_FUNRADIO - "Fun Radio" plugin play speed CVAR (default: "amx_funradio_playspeed")
  22. * CMDS - number of radio commands (default: 23)
  23. * TEXT - radio chat text list
  24. * AUDIO - radio sound files
  25. *
  26. * CVARS
  27. * amx_real_radio (0: OFF, 1: ON, default: 1) - diablses/enables the plugin
  28. *
  29. * VERSIONS
  30. * 0.2 SendAudio changed to emit_sound to be more realistic
  31. * 0.1 first release
  32. *
  33. * THANKS
  34. * obbin - for initial idea
  35. * Damaged Soul - for useful "Message Logging" plugin
  36. */
  37.  
  38. /* *************************************************** Init **************************************************** */
  39.  
  40. #include <amxmodx>
  41.  
  42. #define CHAN CHAN_VOICE
  43. #define VOL VOL_NORM
  44. #define ATTN ATTN_STATIC
  45. #define FLAGS 0
  46. #define PITCH PITCH_NORM
  47.  
  48. #define CVAR_FUNRADIO "amx_funradio_playspeed"
  49.  
  50. #define CMDS 23
  51. new const TEXT[CMDS][] = {
  52. "Cover_me",
  53. "You_take_the_point",
  54. "Hold_this_position",
  55. "Regroup_team",
  56. "Follow_me",
  57. "Taking_fire",
  58. "Go_go_go",
  59. "Team_fall_back",
  60. "Stick_together_team",
  61. "Get_in_position_and_wait",
  62. "Storm_the_front",
  63. "Report_in_team",
  64. "Affirmative",
  65. "Roger_that",
  66. "Enemy_spotted",
  67. "Need_backup",
  68. "Sector_clear",
  69. "In_position",
  70. "Reporting_in",
  71. "Get_out_of_there",
  72. "Negative",
  73. "Enemy_down",
  74. "Fire_in_the_hole"
  75. }
  76.  
  77. new const AUDIO[CMDS][] = {
  78. "radio/ct_coverme.wav",
  79. "radio/takepoint.wav",
  80. "radio/position.wav",
  81. "radio/regroup.wav",
  82. "radio/followme.wav",
  83. "radio/fireassis.wav",
  84. "radio/com_go.wav",
  85. "radio/fallback.wav",
  86. "radio/sticktog.wav",
  87. "radio/com_getinpos.wav",
  88. "radio/stormfront.wav",
  89. "radio/com_reportin.wav",
  90. "radio/ct_affirm.wav",
  91. "radio/roger.wav",
  92. "radio/ct_enemys.wav",
  93. "radio/ct_backup.wav",
  94. "radio/clear.wav",
  95. "radio/ct_inpos.wav",
  96. "radio/ct_reportingin.wav",
  97. "radio/blow.wav",
  98. "radio/negative.wav",
  99. "radio/enemydown.wav",
  100. "radio/ct_fireinhole.wav"
  101. }
  102.  
  103. public plugin_precache() {
  104. for (new i = 0; i < CMDS; ++i)
  105. precache_sound(AUDIO[i])
  106. }
  107.  
  108. new g_msgid_send_audio
  109.  
  110. public plugin_init() {
  111. register_plugin("Real Radio", "0.2", "VEN")
  112. register_event("TextMsg", "event_radio", "bc", "3=#Game_radio")
  113. register_cvar("amx_real_radio", "1")
  114. g_msgid_send_audio = get_user_msgid("SendAudio")
  115. }
  116.  
  117. /* *************************************************** Base **************************************************** */
  118.  
  119. public event_radio() {
  120. if (!get_cvar_num("amx_real_radio"))
  121. return
  122.  
  123. new id = read_data(2)
  124. new command[32], i
  125. read_data(5, command, 31)
  126. for (i = 0; i < CMDS; ++i) {
  127. if (equal(command[1], TEXT[i]))
  128. break
  129. }
  130.  
  131. if (i == CMDS)
  132. return
  133.  
  134. radio_off(id)
  135. emit_sound(id, CHAN, AUDIO[i], VOL, ATTN, FLAGS, cvar_exists(CVAR_FUNRADIO) ? get_cvar_num(CVAR_FUNRADIO) : PITCH)
  136. }
  137.  
  138. /* ************************************************** Stocks *************************************************** */
  139.  
  140. stock radio_off(id) {
  141. message_begin(MSG_ONE, g_msgid_send_audio, {0, 0, 0}, id)
  142. write_byte(0)
  143. write_string("%!MRAD_")
  144. write_short(32767)
  145. message_end()
  146. }
  147.  
  148. /* ********************************************** Captured Events ********************************************** */
  149.  
  150. /*
  151. // Radio chat text message
  152. L 12/26/2005 - 15:24:48: [msglogging.amxx] MessageBegin TextMsg(77) Arguments=5 Destination=One(1) Origin={0.000000 0.000000 0.000000} Entity=1 Classname=player Netname=VEN
  153. L 12/26/2005 - 15:24:48: [msglogging.amxx] Arg 1 (Byte): 5
  154. L 12/26/2005 - 15:24:48: [msglogging.amxx] Arg 2 (String): 1
  155. L 12/26/2005 - 15:24:48: [msglogging.amxx] Arg 3 (String): #Game_radio
  156. L 12/26/2005 - 15:24:48: [msglogging.amxx] Arg 4 (String): VEN
  157. L 12/26/2005 - 15:24:48: [msglogging.amxx] Arg 5 (String): #Cover_me
  158. L 12/26/2005 - 15:24:48: [msglogging.amxx] MessageEnd TextMsg(77)
  159. */
  160.  
  161. /* **************************************************** EOF **************************************************** */
  162.