RobbieG-NL Posted June 23, 2013 Share Posted June 23, 2013 Hello, I've been battling this problem I'm having for a while now, but I failed to figure it out. It's a script that replaces some models in GTA with some of my own (a building), and also places some original GTA models into that building. For some reason I can't rotate the original GTA parts. --[[************************************************************************** * * PROJECT: RobbieG-NL * LICENSE: * FILE: :RobbieG-NL/client/burjKhalifa/burj.lua * PURPOSE: Creation and model replacment functions for the Burj Khalifa. * DEVELOPERS: John Lillis <[email protected]> * *****************************************************************************]] local modelsToReplace = {1900, 1901, 1902, 1903, 1904, 1905, 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1913, 1914, 1915} local burjBasePosition, burjZRotation = {0, 0, 0}, 0 --Located in the centre of the map. local burjObjects = {--{modelID, xOffset, yOffset, zOffset} {1915, 0, 0, 0, 0, 0, 0}, {1900, 0, 0, 25.39, 0, 0, 0}, {1901, 0, 0, 29.64205, 0, 0, 0}, {1902, 0, 0, 33.8941, 0, 0, 0}, {1903, 0, 0, 38.14615, 0, 0, 0}, {1904, 0, 0, 42.3982, 0, 0, 0}, {1905, 0, 0, 46.65025, 0, 0, 0}, {1906, 0, 0, 50.9023, 0, 0, 0}, {1907, 0, 0, 55.15435, 0, 0, 0}, {1908, 0, 0, 59.4064, 0, 0, 0}, {1909, 0, 0, 63.65845, 0, 0, 0}, {1910, 0, 0, 67.9105, 0, 0, 0}, {1911, 0, 0, 72.16255, 0, 0, 0}, {1912, 0, 0, 76.4146, 0, 0, 0}, {1913, 0, 0, 80.66665, 0, 0, 0}, {1914, 0, 0, 84,9187, 0, 0, 0}, {14745, -1.638, 25.56, 26.249, 0, 0, 0}, {15039, -9.06, 14.85, 25.704, 0, 0, 180}, {15039, 7.5, 25.65, 25.704, 0, 0, 270}, {15039, 0.07, 47, 25.704, 0, 0, 0}, {15032, 7.15, 40.464, 27.565, 0, 0, 270}, {14535, -6.681, 32.479, 27.7, 0, 0, 90}, {14745, 22.95, -11.36, 26.249, 0, 0, 240}, {15039, 17.392, 0.421, 25.704, 0, 0, 60}, {15039, 19, -18.365, 25.704, 0, 0, 150}, {15039, 40, -23.17, 25.704, 0, 0, 240}, {15032, 31.43, -26.5, 27.565, 0, 0, 150}, {14535, 31.465, -10.45, 27.7, 0, 0, 330}, {14745, -21.32, -14.2, 26.249, 0, 0, 120}, {15039, -8.334, -15.277, 25.704, 0, 0, 300}, {15039, -25.56, -7, 25.704, 0, 0, 30}, {15039, -40.7, -23.413, 25.704, 0, 0, 120}, {15032, -38.64, -14, 27.565, 0, 0, 30}, {14535, -24.785, -22.03, 27.7, 0, 0, 120} } local function resourceStart() local burjKhalifa = createElement("burjKhalifa", "burjKhalifa") setElementPosition(burjKhalifa, burjBasePosition[1], burjBasePosition[2], burjBasePosition[3]) setElementRotation(burjKhalifa, 0, 0, burjZRotation) for i,v in ipairs(burjObjects) do local x, y, z = (burjBasePosition[1] + v[2]), (burjBasePosition[2] + v[3]), (burjBasePosition[3] + v[4]) local newObject = createObject(v[1], x, y, z, 0, 0, burjZRotation) setElementParent(newObject, burjKhalifa) end for i,v in ipairs(modelsToReplace) do local texture = engineLoadTXD("Burj.txd") engineImportTXD(texture, v) local colission = engineLoadCOL("Burj"..i..".col") local model = engineLoadDFF("Burj"..i..".dff", 0) engineReplaceCOL(colission, v) engineReplaceModel(model, v) engineSetModelLODDistance(v, 500) end local burjBlip = createBlip(burjBasePosition[1], burjBasePosition[2], burjBasePosition[3], 19, 2, 255, 0, 0, 255, 0, 500) setElementParent(burjBlip, burjKhalifa) --This is to reload the collision data when the local player gets near the Burj local streamingColShape = createColCircle(burjBasePosition[1], burjBasePosition[2], 250) setElementParent(streamingColShape, burjKhalifa) addEventHandler("onClientColShapeHit", streamingColShape, streamInBurj) --addEventHandler("onClientColShapeLeave", streamingColShape, streamOutBurj) end addEventHandler("onClientResourceStart", resourceRoot, resourceStart) --Streams the burj IN function streamInBurj(hitElement, dimensionMatch) if hitElement ~= localPlayer or not dimensionMatch then return end for i,v in ipairs(modelsToReplace) do local texture = engineLoadTXD("Burj.txd") engineImportTXD(texture, v) local colission = engineLoadCOL("Burj"..i..".col") local model = engineLoadDFF("Burj"..i..".dff", 0) engineReplaceCOL(colission, v) engineReplaceModel(model, v) engineSetModelLODDistance(v, 500) end end --[[ THIS CAUSES A CRASH --Streams the burj OUT function streamOutBurj(hitElement, dimensionMatch) if hitElement ~= localPlayer then return end for i,v in ipairs(modelsToReplace) do engineRestoreCOL(v) engineRestoreModel(v) end end]] Model ID's 14745, 15039, 15032 and 14745 need to be rotated, but in game they keep showing up un-rotated. Please help... Link to comment
Cadu12 Posted June 23, 2013 Share Posted June 23, 2013 Try change line 53-57 to: for i,v in ipairs(burjObjects) do local newObject = createObject(unpack(v)) setElementParent(newObject, burjKhalifa) end Link to comment
RobbieG-NL Posted June 23, 2013 Author Share Posted June 23, 2013 You, sir, are a hero. My saviour in desperate times. You just deserved my everlasting gratitude. Thanks man Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now