hlmod.hu
https://hlmod.hu/

Connect-nél lejátsz egy hangot! HUD Üzenettel!
https://hlmod.hu/viewtopic.php?f=29&t=16197
Oldal: 1 / 1

Szerző:  D3M0*~ [ 2014.06.12. 07:36 ]
Hozzászólás témája:  Connect-nél lejátsz egy hangot! HUD Üzenettel!

Üdv.
Valaki egy smá-t küldene?
Connéctnél lejátsz egy hangot és közben HUD-ban irja Üdvözlünk az xy szerverén! és közben megy egy ilyen zene!
Köszi előre is a válaszokat :)

Szerző:  theglorious [ 2014.06.12. 12:16 ]
Hozzászólás témája:  Re: Connect-nél lejátsz egy hangot! HUD Üzenettel!

D3M0*~ írta:
Üdv.
Valaki egy smá-t küldene?
Connéctnél lejátsz egy hangot és közben HUD-ban irja Üdvözlünk az xy szerverén! és közben megy egy ilyen zene!
Köszi előre is a válaszokat :)

Lejátsz -> Lejátszik
Itt az sma, de nincs beleírva a hud.
SMA Forráskód: [ Mindet kijelol ]
  1. /*
  2. * Plays a welcome sound to the player who connects
  3. *
  4. * by White Panther
  5. *
  6. * v1.0
  7. *
  8. * v1.1:
  9. * - addition to add easily own sounds
  10. *
  11. * v1.2.1:
  12. * - bug with not playing sounds to client fixed
  13. * - added file exist check for soundfile
  14. *
  15. * v1.2.3:
  16. * - fixed
  17. * - docu bug
  18. * - changes:
  19. * - way of giving id to timer
  20. */
  21.  
  22. #include <amxmodx>
  23.  
  24. // change this number to the amount of sounds u have
  25. #define Maxsounds 2
  26.  
  27. // add here your sounds, sounds must be somewhere in <ModDir>/sound
  28. // format must be like: {"misc/sound1","ambience/sound2"}
  29. new soundlist[Maxsounds][] = {"misc/welcome", "misc/prepare"}
  30.  
  31. new plugin_author[] = "White Panther"
  32. new plugin_version[] = "1.2.3"
  33.  
  34. public plugin_init( )
  35. {
  36. register_plugin("Connect Sound", plugin_version, plugin_author)
  37. register_cvar("connectsound_version", plugin_version, FCVAR_SERVER)
  38. }
  39.  
  40. public plugin_precache( )
  41. {
  42. new temp[128], soundfile[128]
  43. for ( new a = 0; a < Maxsounds; a++ )
  44. {
  45. format(temp, 127, "sound/%s.wav", soundlist[a])
  46. if ( file_exists(temp) )
  47. {
  48. format(soundfile, 127, "%s.wav", soundlist[a])
  49. precache_sound(soundfile)
  50. }
  51. }
  52. }
  53.  
  54. public client_putinserver( id )
  55. {
  56. set_task(1.0, "consound", 100 + id)
  57. }
  58.  
  59. public consound( timerid_id )
  60. {
  61. new id = timerid_id - 100
  62. new Usertime
  63. Usertime = get_user_time(id, 0)
  64. if ( Usertime <= 0 )
  65. {
  66. set_task(1.0, "consound", timerid_id)
  67. }else
  68. {
  69. new i = random(Maxsounds)
  70. client_cmd(id, "spk ^"%s^"", soundlist[i])
  71. }
  72.  
  73. return PLUGIN_CONTINUE
  74. }

Szerző:  D3M0*~ [ 2014.06.12. 15:39 ]
Hozzászólás témája:  Re: Connect-nél lejátsz egy hangot! HUD Üzenettel!

Köszi :).
Lejátszik :) :D
De én a HUDot nem tom beleirni :$

Szerző:  theglorious [ 2014.06.12. 17:02 ]
Hozzászólás témája:  Re: Connect-nél lejátsz egy hangot! HUD Üzenettel!

D3M0*~ írta:
Köszi :).
Lejátszik :) :D
De én a HUDot nem tom beleirni :$

Próbáld meg

SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. #define Maxsounds 2
  3.  
  4. new soundlist[Maxsounds][] = {"misc/welcome", "misc/prepare"}
  5.  
  6. new plugin_author[] = "White Panther"
  7. new plugin_version[] = "1.2.3"
  8.  
  9. public plugin_init( )
  10. {
  11. register_plugin("Connect Sound", plugin_version, plugin_author)
  12. register_cvar("connectsound_version", plugin_version, FCVAR_SERVER)
  13. }
  14.  
  15. public plugin_precache( )
  16. {
  17. new temp[128], soundfile[128]
  18. for ( new a = 0; a < Maxsounds; a++ )
  19. {
  20. format(temp, 127, "sound/%s.wav", soundlist[a])
  21. if ( file_exists(temp) )
  22. {
  23. format(soundfile, 127, "%s.wav", soundlist[a])
  24. precache_sound(soundfile)
  25. }
  26. }
  27. }
  28.  
  29. public client_putinserver( id )
  30. {
  31. set_task(1.0, "consound", 100 + id)
  32. }
  33.  
  34. public consound( timerid_id )
  35. {
  36. new id = timerid_id - 100
  37. new Usertime
  38. Usertime = get_user_time(id, 0)
  39. if ( Usertime <= 0 )
  40. {
  41. set_task(1.0, "consound", timerid_id)
  42. }else
  43. {
  44. new i = random(Maxsounds)
  45. client_cmd(id, "spk ^"%s^"", soundlist[i])
  46. }
  47.  
  48. return PLUGIN_CONTINUE
  49. }
  50.  
  51. public client_connect(id)
  52. {
  53. set_task(5.0,"hud",id)
  54. }
  55.  
  56. public hud(id)
  57. {
  58. new hname[64];
  59. get_cvar_string("hostname", hname, sizeof(hname)-1)
  60.  
  61. {
  62. set_hudmessage(255, 170, 0, 0.1, 0.3, 2, 0.1, 6.0, 0.08, 0.5, 8)
  63. show_hudmessage(id, "Udvozollek az %s Szerveren!",hname)
  64. }
  65. }

Szerző:  D3M0*~ [ 2014.06.12. 17:57 ]
Hozzászólás témája:  Re: Connect-nél lejátsz egy hangot! HUD Üzenettel!

Oké.
MegProbálom :)

Szerző:  D3M0*~ [ 2014.06.12. 19:56 ]
Hozzászólás témája:  Re: Connect-nél lejátsz egy hangot! HUD Üzenettel!

Köszönöm jó lett.

Oldal: 1 / 1 Minden időpont UTC+02:00 időzóna szerinti
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/