OnsetLuaScripts icon indicating copy to clipboard operation
OnsetLuaScripts copied to clipboard

Error Client in GameTick event - soundstreamer_c.lua > 188

Open WinTuba opened this issue 5 years ago • 1 comments

sr.CreateAttachedSound3D(ATTACH_PLAYER, player, "sound_path", 800.0)

Sound attached to the player and when the player enters a vehicle: soundstreamer_c:175 - Function IsValidPlayer will return false; soundstreamer_c:188 - SetSound3DLocation (v.sound, x, y, z) with x as nil value;

Sugestion: if v.attach == ATTACH_VEHICLE then if IsValidVehicle(v.id) then x, y, z = GetVehicleLocation(v.id) end elseif v.attach == ATTACH_PLAYER then x, y, z = GetPlayerLocation(v.id)

elseif v.attach == ATTACH_OBJECT then if IsValidObject(v.id) then x, y, z = GetObjectLocation(v.id) end elseif v.attach == ATTACH_NPC then if IsValidNPC(v.id) then x, y, z = GetNPCLocation(v.id) end end if x ~= nil and y ~= nil and z ~= nil then SetSound3DLocation(v.sound, x, y, z) end

WinTuba avatar Jul 20 '20 04:07 WinTuba

Thank you. Just a quick question. This happens when you attach a sound to another player and not yourself right? Because currently IsValidPlayer does not check for the local player. Only for remote players.

BlueMountainsIO avatar Jul 21 '20 15:07 BlueMountainsIO