seroff

Sound Commmand 1.0 By Seroff

Jan 10th, 2017
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. #include <amxmodx>
  2.  
  3. new szCMD[][]={"amx_addban", "amx_ban","amx_banip", "amx_kick", "fb_ban" },szSound[][]={
  4. "sound/szSound/haha.wav",
  5. "sound/szSound/lol.wav",
  6. "sound/szSound/lol2.wav",
  7. "sound/szSound/haha_v2.wav",
  8. "sound/szSound/whee.wav"
  9. },i;
  10.  
  11. public plugin_init()
  12. {
  13. register_plugin("Sound Commmand","1.0","Seroff");
  14. for(i=0;i<sizeof(szCMD);i++){
  15. register_concmd(szCMD[i], "sendsound");
  16. }
  17. }
  18.  
  19. public plugin_precache() {
  20. for(i=0;i<sizeof(szSound);i++){
  21. precache_generic(szSound[i]);
  22. }
  23. }
  24.  
  25. public sendsound(id){
  26. new szRandom=random_num(0,sizeof(szSound));
  27. play_sound(0,szSound[szRandom]);
  28. }
  29.  
  30. stock play_sound(id, sound[], pitch = PITCH_NORM, bool:reliable = false)
  31. {
  32. static msg_index;
  33. if(!msg_index) msg_index = get_user_msgid("SendAudio");
  34. message_begin(reliable ? (id ? MSG_ONE : MSG_ALL) : (id ? MSG_ONE_UNRELIABLE : MSG_BROADCAST), msg_index, _, id);
  35. write_byte(id);
  36. write_string(sound);
  37. write_short(pitch);
  38. message_end();
  39. }
Advertisement
Add Comment
Please, Sign In to add comment