AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   emit sound to specific player (https://forums.alliedmods.net/showthread.php?t=56949)

crazylf2 06-24-2007 23:10

emit sound to specific player
 
should i change the index to do that?

crazylf2 06-25-2007 00:53

Re: emit sound to specific player
 
emit_sound(id,CHAN_AUTO,"1.wav", VOL_NORM, ATTN_NONE, 0, PITCH_NORM)

this is my code
where should i make change on ?


thanks for helping me

kmal2t 06-25-2007 01:18

Re: emit sound to specific player
 
I use:
Code:

public plugin_precache() {
        precache_sound("misc/sound.wav");
}

public myFunc(id) {
    emit_sound(id, CHAN_VOICE, "misc/sound.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM);


crazylf2 06-25-2007 04:10

Re: emit sound to specific player
 
Code:

new i
const a = 33
new mute[a] = {1, ...}

public aocvoice31(id){
client_print(0,print_chat,"%L",LANG_PLAYER,"ATTACK_ATTACK")
for (i=1; i<=32; i++)
{
        if (mute[i] == 1) {
                emit_sound(i,CHAN_VOICE,"31.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
                }
                else {
                return PLUGIN_CONTINUE
        }
}
}


public mutevoice(id)
{
mute[id] = 0
client_print(id,print_chat,"%L",LANG_PLAYER,"YOU_MUTE")
}

public unmutevoice(id)
{
mute[id] = 1
client_print(id,print_chat,"%L",LANG_PLAYER,"YOU_UNMUTE")
}


i wrote this code suspose to able player to emit sound
they can type "say 11" to emit sound to everyone
and now i want they can type "!mute" to make the sound stop
cannot hear anymore
but these code does no effect when i typed !mute
is there any mistake ?

thank you

mateo10 06-25-2007 05:41

Re: emit sound to specific player
 
Change the aocvoice31 function to this:

Code:
public aocvoice31(id){ client_print(0,print_chat,"%L",LANG_PLAYER,"ATTACK_ATTACK") new players[32], num; get_players(players, num); new player; for (i=0; i<num; i++) {     players[i] = player;     if (mute[player] == 1) {         emit_sound(player,CHAN_VOICE,"31.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)         }         else {         return PLUGIN_CONTINUE     } } return PLUGIN_HANDLED; }

Pro Patria Finland 06-26-2007 17:41

Re: emit sound to specific player
 
nevermind


All times are GMT -4. The time now is 21:25.

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