Somewhat simple question. Is there any way to add new static emitters to a the map? I’m currently working on a custom interior and would really like to have music similar to the Unicorn Club music play in the background.
I have found the native SET_STATIC_EMITTER_ENABLED that allows you to control already existing static emitters, but I can’t find any natives to attach a new static emitter to an object. I also looked through the props to see if it was just a prop that was tagged as an emitter.
I’m a-okay with reusing one from the game, such as the emitters in the Unicorn Club. Otherwise, I suppose I’ll make a NUI element and just play similar music through that.
I tested it a bit this morning, can’t seem to get anything to play. I attached the static emitter using the native mentioned above to both my player ped, as well as a spawned object, and neither would play. I also made the script iterate through all ~36 radio stations and set the emitter to that radio station for 5 seconds to see if the emitter would play any, and it didn’t
local model = GetHashKey("prop_boombox_01")
Citizen.CreateThread(function()
RequestModel(model)
while not HasModelLoaded(model) do
Citizen.Wait(0)
end
local coords = GetEntityCoords(GetPlayerPed(-1), true)
local thisObject = CreateObject(model, coords.x + 1.0, coords.y + 1.0, coords.z, true, false, false)
Citizen.InvokeNative(0x651D3228960D08AF, "Test_Emitter", thisObject)
SetEmitterRadioStation("Test_Emitter", GetRadioStationName(1))
SetStaticEmitterEnabled("Test_Emitter", true)
end)
local model = GetHashKey("prop_boombox_01")
Citizen.CreateThread(function()
RequestModel(model)
while not HasModelLoaded(model) do
Citizen.Wait(0)
end
local coords = GetEntityCoords(GetPlayerPed(-1), true)
local thisObject = CreateObject(model, coords.x + 1.0, coords.y + 1.0, coords.z, true, false, false)
Citizen.InvokeNative(0x651D3228960D08AF, "SE_Script_Placed_Prop_Emitter_Boombox", thisObject)
SetEmitterRadioStation("SE_Script_Placed_Prop_Emitter_Boombox", GetRadioStationName(1))
SetStaticEmitterEnabled("SE_Script_Placed_Prop_Emitter_Boombox", true)
end)
Which suggests you can’t make ‘new’ static emitters (strings), only move around existing ones. Let me go find the strings in the scripts. (Called by SET_STATIC_EMITTER_ENABLED.)
Thats means i could reuse an emitter, create a radio with my own songs, put it where I want it to be and set it on said created radio, well i mean, I guess it’s doable ?
Yes, that is correct. I’m not sure if you can stream custom music from your server. Personally, I made an internet radio resource that uses an invisible NUI element to stream music from a URL.
what part of this shows what station to play. was thinking about changing the prop name to something that is rare enough that it would not show up in the world. maybe the alien egg that I see in codewalker.
ya using this could be a better prop to use prop_alien_egg_01 but looks like still have to make a new emitter. I’ll figure it out. thanks for the help so far, I’m supprised there has not been a release for that ( yes yes I know its ‘simple’) but how many doorlock scripts do we really need hahaha or reskin’d thew huds.