Raised This Month: $60 Target: $400
 15% 

Solved [HELP] EmitSoundToClient issue


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NanoC
Veteran Member
Join Date: Jan 2016
Location: Argentina
Old 09-20-2020 , 23:21   [HELP] EmitSoundToClient issue
Reply With Quote #1

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
__________________

Last edited by NanoC; 09-21-2020 at 14:34.
NanoC is offline
Send a message via Skype™ to NanoC
Cruze
Veteran Member
Join Date: May 2017
Old 09-21-2020 , 01:25   Re: [HELP] EmitSoundToClient issue
Reply With Quote #2

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
__________________
Taking paid private requests! Add me on steam/discord!
AlliedModders Releases | Github | Private Plugins | PayPal | Steam | My Discord Server
Cruze is offline
NanoC
Veteran Member
Join Date: Jan 2016
Location: Argentina
Old 09-21-2020 , 01:40   Re: [HELP] EmitSoundToClient issue
Reply With Quote #3

Not working
__________________
NanoC is offline
Send a message via Skype™ to NanoC
NanoC
Veteran Member
Join Date: Jan 2016
Location: Argentina
Old 09-21-2020 , 14:34   Re: [HELP] EmitSoundToClient issue
Reply With Quote #4

Solved.
__________________
NanoC is offline
Send a message via Skype™ to NanoC
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Old 09-21-2020 , 15:45   Re: [HELP] EmitSoundToClient issue
Reply With Quote #5

Care to share the solution for other people?
__________________
Advertisements | REST in Pawn - HTTP client for JSON REST APIs
I do not provide support in PMs. Please use the forum thread.
DJ Tsunami is offline
NanoC
Veteran Member
Join Date: Jan 2016
Location: Argentina
Old 09-21-2020 , 15:47   Re: [HELP] EmitSoundToClient issue
Reply With Quote #6

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
__________________
NanoC is offline
Send a message via Skype™ to NanoC
Reply


Thread Tools
Display Modes

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 11:46.


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