HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /*
  2. * Plays a welcome sound to the player who connects
  3. * by S.p.0_o.N
  4. *
  5. * v1.0
  6. *
  7. * v1.1:
  8. * - addition to add easily own sounds
  9. *
  10. * v1.2.1:
  11. * - bug with not playing sounds to client fixed
  12. * - added file exist check for soundfile
  13. *
  14. * v1.2.3:
  15. * - changes:
  16. * - way of giving id to timer
  17. */
  18.  
  19. #include <amxmodx>
  20.  
  21. // change this number to the amount of sounds u have
  22. #define Maxsounds 1
  23.  
  24. // add here your sounds, sounds must be somewhere in <ModDir>/sounds
  25. // format must be like: {"misc/sound1","ambience/sound2"}
  26. new soundlist[Maxsounds][] = {"misc/welcome-by-Sp0oN"}
  27.  
  28. new plugin_author[] = "S.p.0_o.N"
  29. new plugin_version[] = "1.2.3"
  30.  
  31. public plugin_init(){
  32. register_plugin("Join_Music",plugin_version,plugin_author)
  33. register_cvar("join_music_version",plugin_version,FCVAR_SERVER)
  34. }
  35.  
  36. public plugin_precache(){
  37. for ( new a = 0; a < Maxsounds; a++ ){
  38. new temp[128]
  39. format(temp,127,"sound/%s.wav", soundlist[a])
  40. if ( file_exists(temp) ){
  41. new soundfile[128]
  42. format(soundfile,127,"%s.wav", soundlist[a])
  43. precache_sound( soundfile )
  44. }
  45. }
  46. }
  47.  
  48. public client_putinserver(id){
  49. set_task(1.0,"consound",100+id)
  50. }
  51.  
  52. public consound(timerid_id){
  53. new id = timerid_id - 100
  54. new Usertime
  55. Usertime = get_user_time(id, 0)
  56. if ( Usertime <= 0 ){
  57. set_task(1.0,"consound",timerid_id)
  58. }else{
  59. new i = random(Maxsounds)
  60. client_cmd(id,"spk ^"%s^"",soundlist[i])
  61. }
  62.  
  63. return PLUGIN_CONTINUE
  64. }