Raised This Month: $51 Target: $400
 12% 

[EDITED] Misc. Stats — disable/enable sounds for each Player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Phant
Veteran Member
Join Date: Sep 2009
Location: New Jersey
Old 08-12-2013 , 00:17   [EDITED] Misc. Stats — disable/enable sounds for each Player
Reply With Quote #1

Hello. It's very simple, but userful mini tutorial.
Many players do not like distractions Misc. Stats sounds (like Headshot, Multi-Kill, One and only, etc.).
Let's be adding feature for disable this sounds personally for each Player.

miscstats.sma
  • 86 string, after "new g_he_sync" add:
    PHP Code:
    new no_sounds[33
  • 180 string, after "register_event("StatusValue", "hideStatus", "be", "1=1", "2=0")" add:
    PHP Code:
    register_clcmd("say /no_sounds""noSounds"0"- disable/enable Misc. Stats sounds (Headshot, Multi-Kill, etc.)"
  • In empty place (like 204 string) add this function:
    PHP Code:
    public noSounds(id)
    {
        if(
    no_sounds[id] == 1) {
            
    no_sounds[id] = 0
            client_cmd
    (id"setinfo ^"no_sounds^" ^"^"")
            
    client_print(idprint_chat"* Misc. Stats Sounds have been enabled (default)")
        } else {
            
    no_sounds[id] = 1
            client_cmd
    (id"setinfo ^"no_sounds^" ^"1^"")
            
    client_print(idprint_chat"* Misc. Stats Sounds have been disabled")
        }

    ^ Here you can use Misc. Stats Language file for adding this two "print_chat" messages (better).
  • 243 string, after "g_streakKills[id] = {0, 0}" add:
    PHP Code:
    new ns[2]
    get_user_info(id"no_sounds"ns1)
    if (
    equali(ns"1")) {
        
    no_sounds[id] = 1
    } else {
        
    no_sounds[id] = 0

    Almost done. Add if/else checks for client_cmd() with "spk" commands.
  • 428 string, from:
    PHP Code:
    client_cmd(g_LastAnnounce"spk misc/oneandonly"
    To:
    PHP Code:
    if (no_sounds[g_LastAnnounce] == 0) {
        
    client_cmd(g_LastAnnounce"spk misc/oneandonly")

  • 495 string, from:
    PHP Code:
    client_cmd(killer"spk misc/headshot")
    client_cmd(victim"spk misc/headshot"
    To:
    PHP Code:
    if (no_sounds[killer] == 0) {
        
    client_cmd(killer"spk misc/headshot")
    }
    if (
    no_sounds[victim] == 0) {
        
    client_cmd(victim"spk misc/headshot")

  • 776 string, from:
    PHP Code:
    client_cmd(players[i], "spk %s"sound
    To:
    PHP Code:
    if (no_sounds[players[i]] == 0) {
        
    client_cmd(players[i], "spk %s"sound)

Done! Players can use "/no_sounds" switch say-command for disable/enable Misc. Stats sounds.
In attachment you can download edited "miscstats.sma" file (AMXX 1.8.2).
Attached Files
File Type: sma Get Plugin or Get Source (miscstats.sma - 860 views - 18.4 KB)
Phant is offline
Send a message via ICQ to Phant
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-12-2013 , 01:33   Re: [EDIT] Misc. Stats — disable/enable sounds for each Player
Reply With Quote #2

A new miscstats version is coming with amxx1.8.3
If you want such a feature to be added, just post a "bug" report on bugzilla, it sounds like a good idea.

Bugzilla : https://bugs.alliedmods.net/?project=2
login with your AM email and pass

edit : just remembered of "speak_enabled" client cvar that could handle this, but wouldn't be plugin specific.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 08-12-2013 at 01:36.
ConnorMcLeod is offline
Phant
Veteran Member
Join Date: Sep 2009
Location: New Jersey
Old 08-12-2013 , 03:54   Re: [EDITED] Misc. Stats — disable/enable sounds for each Player
Reply With Quote #3

Yes, would be nice see this feature in official Misc. Stats plugin (in spite of the "speak_enabled"). Thanks for you attention.
I try to make report on bugzilla right now (never work with it).

Add:
I also added another feature reguest for Misc. Stats plugin.

Last edited by Phant; 08-12-2013 at 04:31.
Phant is offline
Send a message via ICQ to Phant
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viña del Mar, Chile
Old 08-15-2013 , 21:07   Re: [EDITED] Misc. Stats — disable/enable sounds for each Player
Reply With Quote #4

If a player doesn't want to listen custom sounds, he can just use the speak_enable clcvar and set it to 0
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-16-2013 , 02:23   Re: [EDITED] Misc. Stats — disable/enable sounds for each Player
Reply With Quote #5

Quote:
Originally Posted by meTaLiCroSS View Post
If a player doesn't want to listen custom sounds, he can just use the speak_enable clcvar and set it to 0
But that wouldn't be miscstats specific.

Edit : i have submitted a patch on bugzilla.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 08-16-2013 at 16:04.
ConnorMcLeod is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:12.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode