Advertisement
D3nyo

Untitled

Oct 18th, 2021
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. #pragma semicolon 1
  2.  
  3. #include <amxmodx>
  4. #include <api_custom_entities>
  5.  
  6. #include <hwn>
  7.  
  8. #define PLUGIN "[Custom Entity] Hwn Ambient"
  9. #define AUTHOR "Hedgehog Fog"
  10.  
  11. #define TASKID_SUM_PLAY_AMBIENT 1000
  12.  
  13. #define ENTITY_NAME "hwn_ambient"
  14.  
  15. new const g_szSndAimbent[][48] = {
  16. "hwn/ambient/female_scream_01.wav",
  17. "hwn/ambient/female_scream_02.wav",
  18. "hwn/ambient/male_scream_02.wav",
  19. "hwn/ambient/male_scream_02.wav",
  20. "hwn/ambient/hallow01.wav",
  21. "hwn/ambient/hallow02.wav",
  22. "hwn/ambient/hallow03.wav",
  23. "hwn/ambient/hallow04.wav",
  24. "hwn/ambient/mysterious_perc_01.wav",
  25. "hwn/ambient/mysterious_perc_02.wav",
  26. "hwn/ambient/mysterious_perc_03.wav",
  27. "hwn/ambient/mysterious_perc_04.wav"
  28. };
  29.  
  30. public plugin_init()
  31. {
  32. register_plugin(PLUGIN, HWN_VERSION, AUTHOR);
  33. }
  34.  
  35. public plugin_precache()
  36. {
  37. CE_Register(
  38. .szName = ENTITY_NAME
  39. );
  40.  
  41. CE_RegisterHook(CEFunction_Spawn, ENTITY_NAME, "OnSpawn");
  42.  
  43. for (new i = 0; i < sizeof(g_szSndAimbent); ++i) {
  44. precache_sound(g_szSndAimbent[i]);
  45. }
  46. }
  47.  
  48. public OnSpawn(ent)
  49. {
  50. SetupTask(ent);
  51. }
  52.  
  53. public TaskPlayAmbient(taskID)
  54. {
  55. new ent = taskID - TASKID_SUM_PLAY_AMBIENT;
  56.  
  57. emit_sound(ent, CHAN_VOICE, g_szSndAimbent[random(sizeof(g_szSndAimbent))], VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
  58.  
  59. SetupTask(ent);
  60. }
  61.  
  62. SetupTask(ent)
  63. {
  64. set_task(random_float(10.0, 100.0), "TaskPlayAmbient", ent+TASKID_SUM_PLAY_AMBIENT);
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement