--[[ ░▒▓████████▓▒░▒▓██████▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓███████▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓████████▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓███████▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓██████▓▒░ ░▒▓█▓▒░░▒▓█▓▒░░▒▓██████▓▒░░▒▓███████▓▒░ This File Leaked By TC HUB Team, Join Our Server For More DISCORD: - https://discord.gg/k3S8RjkPWc - https://t.me/+RgDxwPX3L7w2ODBk - https://tchub.shop/ --]] Components.Effects = {} Components.Effects.Data = { states = { wall = false, }, wallData = {}, canBeToggled = true, } local function LerpVector3(start, target, ratio) return vector3( start.x + (target.x - start.x) * ratio, start.y + (target.y - start.y) * ratio, start.z + (target.z - start.z) * ratio ) end local function SubdivideQuad(p1, p2, p3, p4, segments) local quadList = {} for i = 0, segments - 1 do local ratio1 = i / segments local ratio2 = (i + 1) / segments table.insert(quadList, { a = LerpVector3(p1, p3, ratio1), b = LerpVector3(p1, p3, ratio2), c = LerpVector3(p2, p4, ratio1), d = LerpVector3(p2, p4, ratio2) }) end return quadList end function Components.Effects.WallPreWarmup(coords) local p = promise.new() SpawnVehicle(1426219628, vector3(coords.x, coords.y, coords.z), coords.w, function(veh) Components.Effects.Data.wallData = {} local wallData = Components.Effects.Data.wallData wallData.right_wall = SubdivideQuad( GetOffsetFromEntityInWorldCoords(veh, 8.0, -8.0, -0.37), GetOffsetFromEntityInWorldCoords(veh, 8.0, 8.0, -0.37), GetOffsetFromEntityInWorldCoords(veh, 8.0, -8.0, 8.0), GetOffsetFromEntityInWorldCoords(veh, 8.0, 8.0, 8.0), 10 ) wallData.left_wall = SubdivideQuad( GetOffsetFromEntityInWorldCoords(veh, -8.0, 8.0, -0.37), GetOffsetFromEntityInWorldCoords(veh, -8.0, -8.0, -0.37), GetOffsetFromEntityInWorldCoords(veh, -8.0, 8.0, 8.0), GetOffsetFromEntityInWorldCoords(veh, -8.0, -8.0, 8.0), 10 ) wallData.back_wall = SubdivideQuad( GetOffsetFromEntityInWorldCoords(veh, -8.0, -8.0, -0.37), GetOffsetFromEntityInWorldCoords(veh, 8.0, -8.0, -0.37), GetOffsetFromEntityInWorldCoords(veh, -8.0, -8.0, 8.0), GetOffsetFromEntityInWorldCoords(veh, 8.0, -8.0, 8.0), 10 ) wallData.upper_wall = SubdivideQuad( GetOffsetFromEntityInWorldCoords(veh, -8.0, 8.0, 8.0), GetOffsetFromEntityInWorldCoords(veh, 8.0, 8.0, 8.0), GetOffsetFromEntityInWorldCoords(veh, -8.0, -8.0, 8.0), GetOffsetFromEntityInWorldCoords(veh, 8.0, -8.0, 8.0), 10 ) wallData.lower_wall = SubdivideQuad( GetOffsetFromEntityInWorldCoords(veh, 8.0, -8.0, -0.37), GetOffsetFromEntityInWorldCoords(veh, -8.0, -8.0, -0.37), GetOffsetFromEntityInWorldCoords(veh, 8.0, 8.0, -0.37), GetOffsetFromEntityInWorldCoords(veh, -8.0, 8.0, -0.37), 10 ) DeleteEntity(veh) while DoesEntityExist(veh) do Wait(0) end Components.Effects.Data.canBeToggled = Components.Effects.CheckIfWallCanBeToggled() p:resolve(true) end, true, true) Citizen.Await(p) return true end function Components.Effects.CheckIfWallCanBeToggled() local vehicle = GetVehiclePedIsIn(PlayerPedId(), false) if vehicle == 0 then return false end local coords = GetEntityCoords(vehicle) local offset1 = GetOffsetFromEntityInWorldCoords(vehicle, 0.0, -8.0, 0.0) local offset2 = GetOffsetFromEntityInWorldCoords(vehicle, -8.0, 0.0, 0.0) local offset3 = GetOffsetFromEntityInWorldCoords(vehicle, 8.0, 0.0, 0.0) local hit1 = Math.Raycast(coords, offset1) local hit2 = Math.Raycast(coords, offset2) local hit3 = Math.Raycast(coords, offset3) return (hit1 == 0 and hit2 == 0 and hit3 == 0) end local wallTransitions = {} local wallAnimationInProgress = false function Components.Effects.Wall(enable) if wallAnimationInProgress then return end if not enable then if not Components.Effects.Data.states.wall then return end wallAnimationInProgress = true local threadsDone = false CreateThread(function() for wallName, segments in pairs(Components.Effects.Data.wallData) do for i = 1, #segments do wallTransitions[wallName][i] = false end end threadsDone = true end) while not threadsDone do Wait(0) end local completed = false CreateThread(function() local segmentCount = #Components.Effects.Data.wallData.back_wall for i = segmentCount, 1, -1 do local time = GetGameTimer() wallTransitions.back_wall[i] = time wallTransitions.upper_wall[i] = time wallTransitions.lower_wall[i] = time wallTransitions.left_wall[i] = time wallTransitions.right_wall[i] = time Wait(35) Components.Effects.Data.states.wall = false end Wait(410) completed = true end) Citizen.CreateThread(function() local totalSegments = #Components.Effects.Data.wallData.back_wall * 5 local completedCount = 0 while not completed do local time = GetGameTimer() for wallName, segments in pairs(Components.Effects.Data.wallData) do for i, quad in ipairs(segments) do local state = wallTransitions[wallName][i] if type(state) == "number" then local progress = 1.0 - ((time - state) / 400) if progress > 0 then local alpha = math.floor(progress * Config.Effects.Wall.alpha) DrawPoly(quad.a.x, quad.a.y, quad.a.z, quad.b.x, quad.b.y, quad.b.z, quad.c.x, quad.c.y, quad.c.z, Config.Effects.Wall.r, Config.Effects.Wall.g, Config.Effects.Wall.b, alpha) DrawPoly(quad.b.x, quad.b.y, quad.b.z, quad.d.x, quad.d.y, quad.d.z, quad.c.x, quad.c.y, quad.c.z, Config.Effects.Wall.r, Config.Effects.Wall.g, Config.Effects.Wall.b, alpha) end if progress <= 0 then wallTransitions[wallName][i] = "done" completedCount = completedCount + 1 end elseif state == "done" then else DrawPoly(quad.a.x, quad.a.y, quad.a.z, quad.b.x, quad.b.y, quad.b.z, quad.c.x, quad.c.y, quad.c.z, Config.Effects.Wall.r, Config.Effects.Wall.g, Config.Effects.Wall.b, Config.Effects.Wall.alpha) DrawPoly(quad.b.x, quad.b.y, quad.b.z, quad.d.x, quad.d.y, quad.d.z, quad.c.x, quad.c.y, quad.c.z, Config.Effects.Wall.r, Config.Effects.Wall.g, Config.Effects.Wall.b, Config.Effects.Wall.alpha) end end end Wait(0) end wallAnimationInProgress = false end) else if not Components.Effects.Data.canBeToggled then return debugPrint("[^3EFFECTS^7] Disabling wall effect. Object collision detected.") end Components.Effects.Data.states.wall = true for wallName, segments in pairs(Components.Effects.Data.wallData) do wallTransitions[wallName] = {} for i = 1, #segments do wallTransitions[wallName][i] = false end end CreateThread(function() local segmentCount = #Components.Effects.Data.wallData.back_wall for i = 1, segmentCount do local time = GetGameTimer() wallTransitions.back_wall[i] = time wallTransitions.upper_wall[i] = time wallTransitions.lower_wall[i] = time wallTransitions.left_wall[i] = time wallTransitions.right_wall[i] = time Wait(35) end end) Citizen.CreateThread(function() while Components.Effects.Data.states.wall do local time = GetGameTimer() for wallName, segments in pairs(Components.Effects.Data.wallData) do for i, quad in ipairs(segments) do local state = wallTransitions[wallName][i] if state ~= false then local progress = 1.0 if type(state) == "number" then progress = (time - state) / 400 if progress > 1.0 then progress = 1.0 end end local alpha = math.floor(progress * Config.Effects.Wall.alpha) DrawPoly(quad.a.x, quad.a.y, quad.a.z, quad.b.x, quad.b.y, quad.b.z, quad.c.x, quad.c.y, quad.c.z, Config.Effects.Wall.r, Config.Effects.Wall.g, Config.Effects.Wall.b, alpha) DrawPoly(quad.b.x, quad.b.y, quad.b.z, quad.d.x, quad.d.y, quad.d.z, quad.c.x, quad.c.y, quad.c.z, Config.Effects.Wall.r, Config.Effects.Wall.g, Config.Effects.Wall.b, alpha) end end end Wait(0) end end) end end function Components.Effects.SetBackgroundBlur(camera, nearDof, farDof) local defaultNear = 10.5 local defaultFar = 3.8 local vehicle = GetVehiclePedIsIn(PlayerPedId(), false) if not vehicle or vehicle == 0 or not DoesEntityExist(vehicle) then SetCamUseShallowDofMode(camera, true) SetCamNearDof(camera, 0.0) SetCamFarDof(camera, nearDof or defaultNear) SetCamDofStrength(camera, farDof or defaultFar) return end local coords = GetEntityCoords(vehicle) local offsetCoords = GetOffsetFromEntityInWorldCoords(vehicle, 0.0, -30.0, 0.0) local hit, _, hitCoords = Math.Raycast(coords, offsetCoords) if hit ~= 0 and hitCoords then local x = hitCoords.x - coords.x local y = hitCoords.y - coords.y local z = hitCoords.z - coords.z local dist = math.sqrt((x * x) + (y * y) + (z * z)) if dist < 10.0 then defaultFar = 0.0 elseif dist < 21.0 and dist > 10.0 then defaultNear = dist / 2 defaultFar = dist / 2 end end local selectedNear = nearDof or defaultNear local selectedFar = farDof or defaultFar SetCamUseShallowDofMode(camera, true) SetCamNearDof(camera, 0.0) SetCamFarDof(camera, selectedNear) SetCamDofStrength(camera, selectedFar) end function Components.Effects.FadeOutBlur(camera, duration) Citizen.CreateThread(function() local maxDof = 5.0 local startTime = GetGameTimer() local endTime = startTime + duration local currentTime = startTime while endTime > currentTime do currentTime = GetGameTimer() local progress = (currentTime - startTime) / duration SetCamUseShallowDofMode(camera, true) SetCamDofStrength(camera, (1.0 - progress) * maxDof) Wait(0) end end) end function Components.Effects.SetLoaderState(state) NUI.SendMessage("SET_LOADER_STATE", { state = state }) end local currentLoaderState = false local savedFov = -1 local loaderTransitionActive = false RegisterNUICallback("effects.loader.applyState", function(data, cb) local state = data.state if currentLoaderState == state then cb("ok") return end currentLoaderState = state local currentFov = GetCamFov(Components.Camera.Data.object) local targetFov if state then targetFov = currentFov + 5.0 else targetFov = savedFov end Cameras.AnimFov(Components.Camera.Data.object, targetFov, 300) if state then savedFov = currentFov SetTimecycleModifier("hud_def_blur") end if loaderTransitionActive then loaderTransitionActive = false end loaderTransitionActive = true Citizen.CreateThread(function() local startTime = GetGameTimer() local duration = 200 local endTime = startTime + duration local currentTime = startTime while true do if not (endTime > currentTime) and loaderTransitionActive then break end currentTime = GetGameTimer() local progress = (currentTime - startTime) / duration local strength if state then strength = progress else strength = 1.0 - progress end if strength < 0.0 then strength = 0.0 end if strength > 1.0 then strength = 1.0 end SetTimecycleModifierStrength(strength) Wait(0) end if not state then ClearTimecycleModifier() end loaderTransitionActive = false end) cb("ok") end)