Skip to content

Commit

Permalink
feat(server): Throw exception when creating VoiceChannel but voice is…
Browse files Browse the repository at this point in the history
… not enabled
  • Loading branch information
xLuxy committed Jan 18, 2024
1 parent fe2dc17 commit 29f76b5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions server/src/factories/VoiceChannelFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,13 @@ static js::FactoryHandler voiceChannelFactory(alt::IBaseObject::Type::VOICE_CHAN

float maxDistance = args.Get<float>("maxDistance");

// Check if voice chat is enabled
const auto config = alt::ICore::Instance().GetServerConfig()->Get("voice");
if (config->IsNone())
{
js::Throw("Failed to create voice channel, make sure external voice chat is enabled.");
return nullptr;
}

return alt::ICore::Instance().CreateVoiceChannel(spatial, maxDistance);
});

0 comments on commit 29f76b5

Please sign in to comment.