Raised This Month: $ Target: $400
 0% 

Emit_sound but different sound on every client


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
lexzor
Veteran Member
Join Date: Nov 2020
Old 06-12-2022 , 13:10   Re: Emit_sound but different sound on every client
Reply With Quote #1

so, let's say you want a command that will emit a sound for all connected players that selected a sound

you can do something like this

PHP Code:
public emit_for_all_players(id)
{
    new 
iPlayers[MAX_PLAYERS], iNum;
    
get_players(iPlayersiNum"ch");

    for(new 
iiPlayeriSongIDiNumi++)
    {
        
iPlayer iPlayers[i];

        if(
is_user_connected(iPlayer))
        {
            
iSongID g_iUserSongID[iPlayer];

            if(
iSongID != NOT_SELECTED_SONG)
            {
                
emit_sound(iPlayerCHAN_AUTOg_szSongs[iSongID][szPath], VOL_NORMATTN_NORM0PITCH_NORM); 
            }
        }
    }

    
client_print(0print_chat"[SONGS] Admin emit your selected sound");

    return 
PLUGIN_HANDLED;

in that loop we get song id from every player, check if user is connected and he has selected a song then we emit the song he selected

Last edited by lexzor; 06-12-2022 at 13:23.
lexzor is offline
Dexon
Member
Join Date: Aug 2019
Old 06-12-2022 , 13:16   Re: Emit_sound but different sound on every client
Reply With Quote #2

Thank you for taking time, but Im not quite sure that you understand my question.
What function you just wrote is emitting sound from all players, but I want to emit a sound from ONLY 1 player, and every client should hear that sound BUT that sound what each of them chosen already.
1 emit, different sounds for different players.
Lets say, there are 16 players on the server. One of them emits a sound, but the other 15 players hear a different sound what they chose from lets say a menu.
Dexon 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 00:19.


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