yobson1 / glua-soundduration

An alternative to the built in SoundDuration function in Garry's Mod that actually works
MIT License
14 stars 0 forks source link

attempt to index local 'buffer' #5

Closed Fedox-die-Ente closed 7 months ago

Fedox-die-Ente commented 7 months ago

Hello, im using this code: self.nextSound = CurTime() + (NewSoundDuration(sound) or 0) * 1.5 But i get this error after the line is getting called:

[____an_preset_shit] gamemodes/skeleton/plugins/an_core/libs/sh_soundduration.lua:108: attempt to index local 'buffer' (a nil value)
  1. unknown - gamemodes/skeleton/plugins/an_core/libs/sh_soundduration.lua:108
   2. NewSoundDuration - gamemodes/skeleton/plugins/an_core/libs/sh_soundduration.lua:197
    3. PlayAlert - gamemodes/skeleton/plugins/an_core/entities/entities/alarm.lua:148
     4. func - gamemodes/skeleton/plugins/an_core/entities/entities/alarm/shared.lua:392
      5. unknown - addons/____an_preset_shit/lua/autorun/server/net_message_logger_init.lua:45

Line 108 is this one: if buffer:Read(3) == "ID3" then

yobson1 commented 7 months ago

What is sound set to in your code? It would seem there's no file to be read there

Fedox-die-Ente commented 7 months ago

I did some testing and found out that the problem is that there is no "sound/" at the beginning of my sound name, so my mistake xd