Skip to content

Commit

Permalink
Mood
Browse files Browse the repository at this point in the history
  • Loading branch information
aaron1a12 committed Feb 28, 2021
1 parent f09c2d5 commit 1753589
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 0 deletions.
21 changes: 21 additions & 0 deletions __resource.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
resource_manifest_version '05cfa83c-a124-4cfa-a768-c24a5811d8f9'


client_scripts {
'respawn.lua',
'mood.lua',
'client.lua'
}

server_scripts {
--'server.lua',
}

dependencies {
}

ui_page('html/index.html')

files {
'html/index.html',
}
Empty file added client.lua
Empty file.
7 changes: 7 additions & 0 deletions foo.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Citizen.CreateThread(function()
while true do
print("Hello world!")
Citizen.Wait(1000)
end
end)

Empty file added html/index.html
Empty file.
49 changes: 49 additions & 0 deletions mood.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
-- Weather

local weatherType = "FOGGY"

-- Disable normal peds

Citizen.CreateThread(function()
while true do
Citizen.Wait(0)

-- Disabled wanted level
SetPlayerWantedLevel(PlayerId(), 0, false)
SetPlayerWantedLevelNow(PlayerId(), true)

-- No ambient ped spawning
SetPedDensityMultiplierThisFrame(0.0)
SetVehicleDensityMultiplierThisFrame(0.0)
SetParkedVehicleDensityMultiplierThisFrame(0.0)
end
end)

Citizen.CreateThread(function()
while true do
Citizen.Wait(1000)

-- Disable ambient sounds
StartAudioScene("CHARACTER_CHANGE_IN_SKY_SCENE")

-- Make it windy, cool I guess
SetWind(1000.0)

-- No power
SetBlackout(true)

ClearOverrideWeather()
ClearWeatherTypePersist()
SetWeatherTypePersist(weatherType)
SetWeatherTypeNow(weatherType)
SetWeatherTypeNowPersist(weatherType)

NetworkOverrideClockTime(12, 0, 0)

--SetTimecycleModifier("plane_inside_mode")
end
end)


SetTimecycleModifier("int_Lost_small")
SetTimecycleModifierStrength(0.9)
35 changes: 35 additions & 0 deletions respawn.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
-- Turn off automatic respawn here instead of updating FiveM file.
AddEventHandler('onClientMapStart', function()
exports.spawnmanager:spawnPlayer() -- Ensure player spawns into server.
Citizen.Wait(2500)
exports.spawnmanager:setAutoSpawn(false)
end)

spawnPoints = {
{['x'] = 867.07, ['y'] = -551.1, ['z'] = 57.33, ['h'] = 280.0}
}

AddEventHandler("cl_playerHasDied", function()
print("cl_playerHasDied")
respawnPed()
end)

function respawnPed()
NetworkResurrectLocalPlayer(spawnPoints[1].x, spawnPoints[1].y, spawnPoints[1].z, spawnPoints[1].h, true, false)
end

--for _, hospital in pairs(HospitalLocations) do

local bPlayerHasDied = false

-- Death event polling
Citizen.CreateThread(function()
while true do
Citizen.Wait(100)

if IsPedDeadOrDying(GetPlayerPed(-1), true) and not bPlayerHasDied then
TriggerEvent("cl_playerHasDied")
end

end
end)

0 comments on commit 1753589

Please sign in to comment.