Raised This Month: $ Target: $400
 0% 

Emit sound to specific team


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Krtola
Veteran Member
Join Date: Oct 2013
Location: Serbia
Old 04-23-2017 , 16:57   Re: Emit sound to specific team
Reply With Quote #1

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
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 04-23-2017 , 19:32   Re: Emit sound to specific team
Reply With Quote #2

iPlayer = The array itself with all the players id's ( iPlayers[1] , iPlayers[2] , iPlayers[3] .. etc )

Num - number of results founded ( also is based on the flags, example "a" for alive .. )
id = iPlayer = Insert the result in a variable to do not re-loop again ( i think ? ... sems useless for my this part ... , anyway the loop will be maded again and inserted in the variable so it looks useless this part ) .
__________________
Project: Among Us

Last edited by Craxor; 04-23-2017 at 19:32.
Craxor is offline
Send a message via ICQ to Craxor
wickedd
Veteran Member
Join Date: Nov 2009
Old 04-23-2017 , 17:09   Re: Emit sound to specific team
Reply With Quote #3

get_players()
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 04-24-2017 , 05:09   Re: Emit sound to specific team
Reply With Quote #4

id = iPlayers[i] because we don't want to re-index the array each time we use it. If you use it only once in the code from the loop this step is not needed.

For example:
PHP Code:
for()
{
    
native(iPlayers[i]) //used only once, it's okay to use it directly

PHP Code:
//used multiple times, it's better to do id = iPlayers[i] and use id everywhere
for()
{
    
native(iPlayers[i])
    if(
iPlayers[i])
    {
        
native2(iPlayers[i])
    }

Read the wiki page: https://wiki.alliedmods.net/Optimizi...e-index_Arrays
__________________

Last edited by HamletEagle; 04-24-2017 at 05:11.
HamletEagle is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 04-26-2017 , 06:19   Re: Emit sound to specific team
Reply With Quote #5

Thanks hamlet
__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
Natsheh
Veteran Member
Join Date: Sep 2012
Old 04-26-2017 , 10:12   Re: Emit sound to specific team
Reply With Quote #6

the only way to do this, is to hook emit sound forward check the team of user and the sound thats been passed, if they are not on the same team block the sound.

PS: when playing the sounds must be using emit_sound native.
__________________
@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
PartialCloning
Senior Member
Join Date: Dec 2015
Old 04-26-2017 , 10:20   Re: Emit sound to specific team
Reply With Quote #7

Then it would be blocked for everyone else.

If you're not using ReAPI your best bet is:

Quote:
Originally Posted by KliPPy View Post
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.
PartialCloning is offline
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 17:47.


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