[Release] Blackout From Vehicle Accidents

salty_vehicleblackout

Configurable script that makes players blackout due to accidents when they are in a vehicle.
This script is fully configurable in the config.lua file.

Players can blackout due to rapid deceleration and/or due to vehicle damage, if enabled in the configuration file. You may also configure how long the player is blacked out, the threshold(s) required, and if controls are disabled when they’re blacked out.

The configuration file is listed below so you can see all of the options.

Download: Available on GitHub - https://github.com/SaltyGrandpa/salty_vehicleblackout
Installation: Add it to your [resources] directory and add the resource to your server.cfg. This resource has no dependencies and should work with any/every framework.

config.lua:

Config = {}

-- Amount of Time to Blackout, in Miliseconds
-- 2000 = 2 seconds
Config.BlackoutTime = 2000

-- Enable blacking out due to vehicle damage
-- If a vehicle suffers an impact greater than the specified value, the player blacks out
Config.BlackoutFromDamage = true
Config.BlackoutDamageRequired = 25

-- Enable blacking out due to speed deceleration
-- If a vehicle slows down rapidly over this threshold, the player blacks out
Config.BlackoutFromSpeed = true
Config.BlackoutSpeedRequired = 45 -- Speed in MPH

-- Enable the disabling of controls if the player is blacked out
Config.DisableControlsOnBlackout = true

Requested by @Wojtek2363 here: [SEARCH] black screen after car crash
Video thanks to @davewazere: https://www.youtube.com/watch?v=S36YuTJ9nHE

24 Likes

Nice work :smiley:

2 Likes

to be honest not the greatst what you can make ofc but i know you can do it better for my taste but thx for the release ofc and for you work it would be better that if you can make like heart diagram with sound and to disable control after a bigger crash and after 30sec he is comming back to himself :stuck_out_tongue: i hope you understand what i mean

I have no clue what you mean. If it doesn’t meet your needs, feel free to fork it and adapt it for your server.

4 Likes

Boy someone is salty, and this time it’s not @SaltyGrandpa.

4 Likes

it would be nice to see this with a say seat belt implementation. no seat belt = longer time blacked out or possible death or flying out window? seat belt means short blackout or no black out at all etc. Might fork and add to this when i have time

1 Like

Good idea (20 characters)

Cool script, if anyone wants the screen to shake instead of blacking out replace this lines in the Client.lua file :stuck_out_tongue_winking_eye:

local function blackout()
	-- Only blackout once to prevent an extended blackout if both speed and damage thresholds were met
	if not isBlackedOut then
		isBlackedOut = true
		-- This thread will black out the user's screen for the specified time
		Citizen.CreateThread(function()
			isBlackedOut = true
			ShakeGameplayCam('SMALL_EXPLOSION_SHAKE', 0.1)
			isBlackedOut = false
		end)
	end
end

4 Likes

Cool concept. If I have some extra time, I’ll add it in. Could just be a random chance upon entry of a car that you seatbelt, and based on that different things can happen

maybe you could make it so up to 60km it will shake the screen and at 60+ it will blackout the screen?

1 Like

how could i put text on the screen when it happened saying “you were knocked out” and is it possible to have it go blurry for 5 seconds after you come back from the blackout?

Can we get a video? (20 chars)

really cool script. if you wanted to take it all the way implement the seat belt idea so they can put on a belt and if they choose not to put on a belt. a crash a high rate of speed should throw them thru the window and make them black out. and a crash at a high speed with a belt should only daze them for a few moments

Could you make a script that player jumps off vehicle after crash if player arent wearing seat belt?

:slight_smile:

I agree

20 characters

could I do

math.random(2000, 5000)

for the blackout value?

Yes, that would work fine.

1 Like

video? (20 characters)

Here you go

1 Like

Nice job, @SaltyGrandpa! How about to add light shakey cam and maybe some vision distortion? :slight_smile: