AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   who hears the sound (https://forums.alliedmods.net/showthread.php?t=326891)

anakonda001 08-22-2020 07:52

who hears the sound
 
guys how to make the sound heard only by the player himself

Code:

if(++g_Frags[iAttacker] == NEADED_FRAGS)
        {
                ChatColor(iAttacker, "%s !yYou have entered the necessary frags", PREFIX);
                emit_sound(id, CHAN_AUTO, FRAG_SOUNDS[1], VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
        }
}

the error here emit_sound(id,

when I put "0" it works, but "id" does not

Shadows Adi 08-22-2020 08:45

Re: who hears the sound
 
Show the enitre function, maybe you don't have that index.
EDIT: Use "iAttacker" instead of "id" because your attacker index is iAttacker not id

anakonda001 08-22-2020 09:18

Re: who hears the sound
 
Quote:

Originally Posted by Shadows Adi (Post 2715115)
Show the enitre function, maybe you don't have that index.
EDIT: Use "iAttacker" instead of "id" because your attacker index is iAttacker not id

no enitre

Natsheh 08-22-2020 09:52

Re: who hears the sound
 
use
Code:
client_cmd(iAttacker, "spk ^"%s^"", FRAG_SOUNDS[1])

instead of emit_sound

anakonda001 08-22-2020 10:07

Re: who hears the sound
 
Quote:

Originally Posted by Natsheh (Post 2715135)
use
Code:
client_cmd(iAttacker, "spk ^"%s^"", FRAG_SOUNDS[1])

instead of emit_sound

iAttacker if it doesn't work, then all the players will hear the sounds

Natsheh 08-22-2020 12:05

Re: who hears the sound
 
Not sure what you mean, but variable iAttacker should be a valid player index ( 1 <= iAttacker <= 32)

And again post the full code or at least the function so we can process what's going on inside the function.

And if you have no idea how to code post in suggestions and requests forum.

anakonda001 08-22-2020 12:19

Re: who hears the sound
 
Quote:

Originally Posted by Natsheh (Post 2715153)
Not sure what you mean, but variable iAttacker should be a valid player index ( 1 <= iAttacker <= 32)

And again post the full code or at least the function so we can process what's going on inside the function.

And if you have no idea how to code post in suggestions and requests forum.

Code:

public Ham_PlayerKilled_Post(iVictim, iAttacker)
{
        if(!is_user_connected(iAttacker) || iVictim == iAttacker)
        {
                return;
        }

        if(g_bUserHero[iAttacker])
        {
                return;
        }

        if(++g_Frags[iAttacker] == NEADED_FRAGS)
        {
                ChatColor(iAttacker, "%s !yYou have entered the necessary frags", PREFIX);
        }
}



All times are GMT -4. The time now is 13:48.

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