AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Solved [HELP] EmitSoundToClient issue (https://forums.alliedmods.net/showthread.php?t=327472)

NanoC 09-20-2020 23:21

[HELP] EmitSoundToClient issue
 
Hello. I really need help here.
What i want to do is: reproduce an ambient sound just for those who wants to hear it. The sound should be reproduced everytime a player spawns, but as i said above, just for those who wants to hear it.
I've tried whatever you can ever imagine, and still not working. With this currently plugin i can still hearing the sound even if don't want to (using Command_ToggleSound).
Here's an example of what is going on:

Video:


Plugin:
Spoiler

Cruze 09-21-2020 01:25

Re: [HELP] EmitSoundToClient issue
 
PHP Code:

public Action Command_ToggleSound(int clientint args)
{   
    
HearSound[client] = !HearSound[client];
    
ReplyToCommand(client"Sounds %s"HearSound[client] ? "disabled" "enabled");
    return 
Plugin_Handled;
}

public 
Action Event_PlayerSpawn(Event eventchar[] namebool dontBroadcast
{
    
int client GetClientOfUserId(GetEventInt(event"userid"));
    
    
PlayAmbientSound(client);
}

void PlayAmbientSound(int client)
{
    
float fOrigin[3];
    
GetClientAbsOrigin(clientfOrigin);

    for (
int i 1<= MaxClientsi++)
    {
        if (
IsClientInGame(i) && HearSound[i])
        {
            
StopSound(iSND_SPAWNINGZSound);
            
EmitSoundToClient(iZSoundclient_SND_SPAWNING _0.5__fOrigin);
        }
    }


Try this

NanoC 09-21-2020 01:40

Re: [HELP] EmitSoundToClient issue
 
Not working

NanoC 09-21-2020 14:34

Re: [HELP] EmitSoundToClient issue
 
Solved.

DJ Tsunami 09-21-2020 15:45

Re: [HELP] EmitSoundToClient issue
 
Care to share the solution for other people?

NanoC 09-21-2020 15:47

Re: [HELP] EmitSoundToClient issue
 
Everything was working fine with my plugin. But i had another plugin that was spamming the sound too, so when i realized about this, i just disabled the other plugin and now it's working fine


All times are GMT -4. The time now is 07:51.

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