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

Emit sound to specific team


Post New Thread Reply   
 
Thread Tools Display Modes
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 04-22-2017 , 11:07   Re: Emit sound to specific team
Reply With Quote #11

If an approver told you which way is prooper, use it. Don't ask why. It's not obsession, it's the correct thing.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 04-22-2017 , 11:24   Re: Emit sound to specific team
Reply With Quote #12

PHP Code:
new players[32], pnum;
switch( 
get_user_team(id) )
{
        case 
2get_players(playerspnum"ae""CT")
        case 
1get_players(playerspnum"ae""TERRORIST")
}

for(new 
iPlayerpnum;i++)
{
       
Player players[i];
        
Client_cmd(Player"spk ^"%s^""sounds[random(sizeof sounds)])



Have you tried this way?
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Krtola
Veteran Member
Join Date: Oct 2013
Location: Serbia
Old 04-23-2017 , 12:13   Re: Emit sound to specific team
Reply With Quote #13

Natsheh I try now and have the same problem.
Anyway,I wonder if these two examples do the same thing:
PHP Code:
static id;
    for(
id id <= get_maxplayers() ; id++)
    {
        if(
is_user_alive(id))
        { 
PHP Code:
static id
    
new numiPlayers[32]
    
get_players(iPlayersnum)
    if( !
num )
    {
        return;
    }
    for(new 
0numi++)
    {
        
id iPlayers[i]

        if(
is_user_alive(id))
        { 

Last edited by Krtola; 04-23-2017 at 12:13.
Krtola is offline
Send a message via Skype™ to Krtola
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 04-23-2017 , 12:19   Re: Emit sound to specific team
Reply With Quote #14

You can't do that with emit_sound. With client_cmd(spk) you can't control the location. It can either be done with AddToFullPack, or it can't be done at all.
__________________

Last edited by OciXCrom; 04-23-2017 at 12:20.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 04-23-2017 , 12:25   Re: Emit sound to specific team
Reply With Quote #15

@Krtola: if you are talking about the result, yes, they both give you the same thing. But, if you use get_players you don't need to check for is_user_alive, put flag "a" in the native.
If you are asking about how they do stuff, then the second one is the right one.
__________________
HamletEagle is offline
Krtola
Veteran Member
Join Date: Oct 2013
Location: Serbia
Old 04-23-2017 , 13:05   Re: Emit sound to specific team
Reply With Quote #16

This interested me unrelated to this emit sound problem.
So I can freely delete in plugin first example and use the second one and get exactly the same result but in a better way.
Krtola is offline
Send a message via Skype™ to Krtola
wickedd
Veteran Member
Join Date: Nov 2009
Old 04-23-2017 , 13:40   Re: Emit sound to specific team
Reply With Quote #17

Yes
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 04-23-2017 , 15:30   Re: Emit sound to specific team
Reply With Quote #18

emit_sound() has to be delivered to clients through the network channel in some way, doesn't it (unless it's a client-side sound, I don't know if reloading is emitted). It may be possible to intercept it for particular clients. SVC_SOUND and SVC_SPAWNSTATICSOUND look interesting.

Last edited by klippy; 04-23-2017 at 15:31.
klippy is offline
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 04-23-2017 , 16:22   Re: Emit sound to specific team
Reply With Quote #19

ReAPI has the native for this.
__________________
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
Krtola
Veteran Member
Join Date: Oct 2013
Location: Serbia
Old 04-23-2017 , 16:57   Re: Emit sound to specific team
Reply With Quote #20

I need an explanation about this:
PHP Code:
static id
    
new numiPlayers[32]
    
get_players(iPlayersnum)
    if( !
num )
    {
        return;
    }
    for(new 
0numi++)
    {
        
id iPlayers[i]

        if(
is_user_alive(id))
        { 
What represent:
PHP Code:
iPlayers 
PHP Code:
num 
PHP Code:
id iPlayers[i
Krtola is offline
Send a message via Skype™ to Krtola
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 18:36.


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