Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <sdktools>
- #include <sdkhooks>
- bool OnMusic[64] = {true, ...};
- char g_sSounds[][] =
- {
- "ideas/ambient/casapapell.mp3",
- "ideas/ambient/funkk.mp3",
- "ideas/ambient/marvell.mp3",
- "ideas/ambient/gogg3.mp3",
- "ideas/ambient/funkk.mp3",
- "ideas/ambient/gogg.mp3",
- "ideas/ambient/gogg2.mp3",
- "ideas/ambient/marvell2.mp3",
- "ideas/ambient/marvell4.mp3",
- }
- public void OnPluginStart()
- {
- HookEvent("round_start", OnRoundStart);
- RegConsoleCmd("sm_music", sm_music)
- }
- public Action sm_music(client, args)
- {
- OnMusic[client] = !OnMusic[client];
- PrintToChat(client, "[IDEAS] \x07 You turned %s music for the next rounds !", OnMusic[client] ? "on":"off");
- }
- public void OnMapStart()
- {
- for(int i = 0; i < sizeof(g_sSounds); i++)
- {
- AddFileToDownloadsTable("sound/ideas/ambient/casapapell.mp3")
- AddFileToDownloadsTable("sound/ideas/ambient/funkk.mp3")
- AddFileToDownloadsTable("sound/ideas/ambient/funkk2.mp3")
- AddFileToDownloadsTable("sound/ideas/ambient/gogg.mp3")
- AddFileToDownloadsTable("sound/ideas/ambient/gogg2.mp3")
- AddFileToDownloadsTable("sound/ideas/ambient/gogg3.mp3")
- AddFileToDownloadsTable("sound/ideas/ambient/marvell.mp3")
- AddFileToDownloadsTable("sound/ideas/ambient/marvell2.mp3")
- AddFileToDownloadsTable("sound/ideas/ambient/marvell4.mp3")
- PrecacheSound(g_sSounds[i], true); // Precache sound file...
- }
- }
- public Action OnRoundStart(Event event, const char[] name, bool db)
- {
- CreateTimer(1.0, tTimerRandomSound, _, TIMER_FLAG_NO_MAPCHANGE); // Start a timer on every map start that ends when map ends.
- }
- public Action tTimerRandomSound(Handle timer)
- {
- // void EmitSoundToAll(const char[] sample, int entity, int channel, int level, int flags, float volume, int pitch, int speakerentity, const float origin[3], const float dir[3], bool updatePos, float soundtime)
- int random = GetRandomInt(0, sizeof(g_sSounds)-1);
- for (int i = 1; i <= MaxClients; i++)
- {
- if(!IsClientInGame(i) || !OnMusic[i]) continue;
- EmitSoundToClient(i, g_sSounds[random], _, _, _, _, 0.4);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement