Added join transition.

+ Added Join-Transition script.
This commit is contained in:
Jacob
2022-04-21 21:23:44 +01:00
parent eddc17c49f
commit 09ffdb22b5
6 changed files with 191 additions and 2 deletions
+2
View File
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
+41
View File
@@ -0,0 +1,41 @@
# Compiled Lua sources
luac.out
# luarocks build files
*.src.rock
*.zip
*.tar.gz
# Object files
*.o
*.os
*.ko
*.obj
*.elf
# Precompiled Headers
*.gch
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
*.def
*.exp
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
+27
View File
@@ -0,0 +1,27 @@
# JoinTransition
A simple script that adds a transition between the loading screen and spawning in-game. Should work with most custom loading screens, as well as the stock FiveM loading screen.
## Demo
![](https://streamable.com/kcsk4)
_In case that embedded preview doesn't work, try this: https://streamable.com/kcsk4_
## Installation
1. Download the [latest release](https://github.com/TomGrobbe/jointransition/releases/latest).
2. Put the folder into your resources folder. (make sure that you end up with the __resource.lua being in the following location: `resources/jointransition/__resource.lua`)
3. Add `start jointransition` to your **server.cfg** file.
4. Start the server, enjoy.
## Issues
- There might be a few issues, because joining servers can sometimes be glitchy, this is usually caused by some buggy resource.
- If you spot an issue in this resource itself, or have found a way to improve this, feel free to create a pull request. Or, if you just found the issue but don't know how to solve it yourself, create an Issue on the GitHub page and make sure to provide as much information as possible.
## Copyright
Copyright © Vespura 2018
Edit it if you want, but don't re-release this without my permission, and never claim it to be yours!
Pull requests for improvements are welcome!
+5
View File
@@ -0,0 +1,5 @@
-- Copyright © Vespura 2018
-- Edit it if you want, but don't re-release this without my permission, and never claim it to be yours!
resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937'
client_script 'cloading.lua'
+113
View File
@@ -0,0 +1,113 @@
-- Copyright © Vespura 2018
-- Edit it if you want, but don't re-release this without my permission, and never claim it to be yours!
------- Configurable options -------
-- set the opacity of the clouds
local cloudOpacity = 0.01 -- (default: 0.01)
-- setting this to false will NOT mute the sound as soon as the game loads
-- (you will hear background noises while on the loading screen, so not recommended)
local muteSound = true -- (default: true)
------- Code -------
-- Mutes or un-mutes the game's sound using a short fade in/out transition.
function ToggleSound(state)
if state then
StartAudioScene("MP_LEADERBOARD_SCENE");
else
StopAudioScene("MP_LEADERBOARD_SCENE");
end
end
-- Runs the initial setup whenever the script is loaded.
function InitialSetup()
-- Stopping the loading screen from automatically being dismissed.
SetManualShutdownLoadingScreenNui(true)
-- Disable sound (if configured)
ToggleSound(muteSound)
-- Switch out the player if it isn't already in a switch state.
if not IsPlayerSwitchInProgress() then
SwitchOutPlayer(PlayerPedId(), 0, 1)
end
end
-- Hide radar & HUD, set cloud opacity, and use a hacky way of removing third party resource HUD elements.
function ClearScreen()
SetCloudHatOpacity(cloudOpacity)
HideHudAndRadarThisFrame()
-- nice hack to 'hide' HUD elements from other resources/scripts. kinda buggy though.
SetDrawOrigin(0.0, 0.0, 0.0, 0)
end
-- Sometimes this gets called too early, but sometimes it's perfectly timed,
-- we need this to be as early as possible, without it being TOO early, it's a gamble!
InitialSetup()
Citizen.CreateThread(function()
-- In case it was called too early before, call it again just in case.
InitialSetup()
-- Wait for the switch cam to be in the sky in the 'waiting' state (5).
while GetPlayerSwitchState() ~= 5 do
Citizen.Wait(0)
ClearScreen()
end
-- Shut down the game's loading screen (this is NOT the NUI loading screen).
ShutdownLoadingScreen()
ClearScreen()
Citizen.Wait(0)
DoScreenFadeOut(0)
-- Shut down the NUI loading screen.
ShutdownLoadingScreenNui()
ClearScreen()
Citizen.Wait(0)
ClearScreen()
DoScreenFadeIn(500)
while not IsScreenFadedIn() do
Citizen.Wait(0)
ClearScreen()
end
local timer = GetGameTimer()
-- Re-enable the sound in case it was muted.
ToggleSound(false)
while true do
ClearScreen()
Citizen.Wait(0)
-- wait 5 seconds before starting the switch to the player
if GetGameTimer() - timer > 5000 then
-- Switch to the player.
SwitchInPlayer(PlayerPedId())
ClearScreen()
-- Wait for the player switch to be completed (state 12).
while GetPlayerSwitchState() ~= 12 do
Citizen.Wait(0)
ClearScreen()
end
-- Stop the infinite loop.
break
end
end
-- Reset the draw origin, just in case (allowing HUD elements to re-appear correctly)
ClearDrawOrigin()
end)
+3 -2
View File
@@ -161,13 +161,14 @@ start carsounds
start carsounds4
start rcore_pool
start asedrussounds
//start LegacyFuel
//start refuelingnozzle
start LegacyFuel
start refuelingnozzle
start wheelvarietypack
start cummins5924v
start stretcher
start stretcherscript
start Seat-Switcher
start Join-Transition
#[-----Discord Perms-----]
start discord_perms