betasound.c 1.0 KB

1234567891011121314151617181920212223242526272829303132
  1. class BetaSound
  2. {
  3. static SoundOnVehicle SaySound(Object source, string sound_name, float distance, bool looped)
  4. {
  5. bool is_female = source.ConfigGetBool("woman");
  6. string path_class = "CfgActionSounds " + sound_name;
  7. string path_sound = path_class + " sounds";
  8. //is the action sound class defined ? if not, try to play it as a regular sound
  9. if( GetDayZGame().ConfigIsExisting(path_sound) )
  10. {
  11. string path_sound_female = path_class + "_female" + " sounds";
  12. if(is_female && GetDayZGame().ConfigIsExisting(path_sound_female))
  13. {
  14. path_sound = path_sound_female;
  15. }
  16. GetGame().ConfigGetTextArray(path_sound,CachedObjectsArrays.ARRAY_STRING);
  17. int rnd_index = Math.RandomInt(0,CachedObjectsArrays.ARRAY_STRING.Count());
  18. string sound_class = CachedObjectsArrays.ARRAY_STRING.Get(rnd_index);
  19. SoundOnVehicle sound_object = GetGame().CreateSoundOnObject(source, sound_class, distance, looped);
  20. return sound_object;
  21. }
  22. else
  23. {
  24. return GetGame().CreateSoundOnObject(source, sound_name, distance, looped);
  25. }
  26. }
  27. };