added option to comma separate the soundfiles
This commit is contained in:
		
							parent
							
								
									d57bd5655e
								
							
						
					
					
						commit
						effc246b45
					
				| @ -13,7 +13,7 @@ | ||||
|         "human spawn protection" "10.0" | ||||
|         "Global command"    "mp_afterroundmoney 16000" | ||||
|         "Global command"    "bot_difficulty 3" | ||||
|         "ambientSound"      "ambient/zr/zr_ambience.mp3" | ||||
|         "ambientSound"      "ambient/zr/zr_ambience.mp3,ambient/zr/ambience_1.mp3" | ||||
|         "ambientLoopDuration" "60.3" | ||||
|         "bossSound"         "ambient/zr/satanic_demona.mp3" | ||||
|         "bossLoopDuration"     "155.3" | ||||
|  | ||||
| @ -44,8 +44,8 @@ char g_cZMSounds[g_dIndexes][g_dLength]; | ||||
| char g_cWeaponEntity[g_dIndexes][g_dLength]; | ||||
| char g_cWeaponNames[g_dIndexes][g_dLength]; | ||||
| char g_cWeaponCommand[g_dIndexes][g_dLength]; | ||||
| char g_cAmbientSOund[512]; | ||||
| char g_cBossSound[512]; | ||||
| char g_cAmbientSOund[64][512]; | ||||
| 
 | ||||
| float g_fAmbientSoundLoopDuration; | ||||
| float g_fBossSoundLoopDuration; | ||||
| @ -913,7 +913,7 @@ public void LoadExtraSettings() | ||||
|         if (StrContains(l_cLine, "ambientSound", false) > -1) | ||||
|         { | ||||
|             ReplaceStrings(l_cLine, "ambientSound"); | ||||
|             Format(g_cAmbientSOund, sizeof(g_cAmbientSOund), l_cLine); | ||||
|             ExplodeString(l_cLine, ",", g_cAmbientSOund, 64, 512); | ||||
|         } | ||||
|         if (StrContains(l_cLine, "ambientLoopDuration") > -1) | ||||
|         { | ||||
| @ -1157,10 +1157,25 @@ public void Event_roundStart(Handle event, const char[] name, bool dontBroadcast | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         EmitAmbience(g_cAmbientSOund); | ||||
|         int index = ambient_index(); | ||||
|         EmitAmbience(g_cAmbientSOund[index]); | ||||
|         g_hAmbient = CreateTimer(g_fAmbientSoundLoopDuration, Timer_Ambient, INVALID_HANDLE, TIMER_REPEAT); // 0.3 seconds without sound | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| public int ambient_index() | ||||
| { | ||||
|     int index = 0; | ||||
|     for (int i = 0; i < sizeof(g_cAmbientSOund); i++) | ||||
|     { | ||||
|         if (strlen(g_cAmbientSOund[i]) == 0) | ||||
|         { | ||||
|             index = (g_iWave - 1) % i; | ||||
|             break; | ||||
|         } | ||||
|     } | ||||
|     return index; | ||||
| } | ||||
| //---------------------------------------------------------------------------------------------------- | ||||
| // Purpose:  | ||||
| //---------------------------------------------------------------------------------------------------- | ||||
| @ -2248,7 +2263,8 @@ public Action Timer_Ambient(Handle timer, any userid) | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         EmitAmbience(g_cAmbientSOund); | ||||
|         int index = ambient_index(); | ||||
|         EmitAmbience(g_cAmbientSOund[index]); | ||||
|     } | ||||
|     return Plugin_Handled; | ||||
| } | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user