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:02   Re: Emit_sound but different sound on every client
Reply With Quote #1

in variable
PHP Code:
g_iUserSongID[id
we store what song player is choosing after select it in the menu
so, if player select second song in menu, song id will be 1.

PHP Code:
static iSongID;
    
iSongID g_iUserSongID[id//LET'S GET PLAYER SONG ID IN A STATIC VARIABLE ASSUMING THAT FUNCTION IS USED FREQUENTLY 
here we create a new static var to not do something like this

PHP Code:
emit_sound(idCHAN_AUTOg_szSongs[g_iUserSongID[id]][szPath], VOL_NORMATTN_NORM0PITCH_NORM); //LET'S EMIT THE PLAYER SONG USING THAT GLOBAL VARIABLE WHERE WE HAVE PLAYLIST 
so this
PHP Code:
static iSongID;
    
iSongID g_iUserSongID[id//LET'S GET PLAYER SONG ID IN A STATIC VARIABLE ASSUMING THAT FUNCTION IS USED FREQUENTLY

emit_sound(idCHAN_AUTOg_szSongs[iSongID][szPath], VOL_NORMATTN_NORM0PITCH_NORM); //LET'S EMIT THE PLAYER SONG USING THAT GLOBAL VARIABLE WHERE WE HAVE PLAYLIST 
will emit g_szSongs[iSongID][szPath]. assuming that iSongID is 1 (that means the second song from menu),

g_szSongs[iSongID][szPatth] is sounds/misc/song2.wav
lexzor 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