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(iPlayers, iNum, "ch");
for(new i, iPlayer, iSongID; i < iNum; i++)
{
iPlayer = iPlayers[i];
if(is_user_connected(iPlayer))
{
iSongID = g_iUserSongID[iPlayer];
if(iSongID != NOT_SELECTED_SONG)
{
emit_sound(iPlayer, CHAN_AUTO, g_szSongs[iSongID][szPath], VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
}
}
}
client_print(0, print_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