⚙️Configuration

To ensure you have everything you need, we are constantly updating our config files.

-- Change the framework to 'QB' or 'ESX':
tosun_config.framework = 'QB'

-- If you have custom frameworks names, you can change them here:
tosun_config.QB = 'qb-core'
tosun_config.ESX = 'es_extended'

-- Set it to true if you want the Logout Button to Open Multicharacter instead of making you leave the server.
tosun_config.MulticharacterLogout = false

-- You can change the background blur from here:
tosun_config.tosun_blur = true

-- Change disconnect message from here:
tosun_config.disconnect = '[Tosun_pausemenu] You have been disconnected from the server'

-- Put here your discord server invite link:
tosun_config.discord = 'https://discord.gg/FwedjEV6kY'

-- Here you can translate the script to the language you prefer
tosun_trans.discord = 'join our discord.'
tosun_trans.maps = 'MAPS'
tosun_trans.mapstxt = 'SHOW THE MAP OF THE CITY.'
tosun_trans.settings = 'SETTINGS'
tosun_trans.settingstxt = 'OPEN GAME SETTINGS MENU.'
tosun_trans.back = 'Go back to game.'
tosun_trans.disconnect = 'Disconnect from server.'
tosun_trans.infostitle = 'Character Information.'
tosun_trans.fname = 'First Name'
tosun_trans.lname = 'Last Name'
tosun_trans.gender = 'Gender'
tosun_trans.male = 'MALE'
tosun_trans.female = 'FEMALE'
tosun_trans.dob = 'Birthdate'
tosun_trans.job = 'Job'
tosun_trans.cash = 'Cash'
tosun_trans.bank = 'Bank'
tosun_trans.currency = '$'

Client Side :

local tosun_menu_enabled = true

RegisterKeyMapping("tosun-pausemenu:show", "", "keyboard", "ESCAPE")
RegisterCommand('tosun-pausemenu:show', function ()
	if not IsPauseMenuActive() and not IsNuiFocused() then
		if not IsEntityDead(GetPlayerPed(-1)) then
			if (tosun_menu_enabled) then
				tosun_pausemenu_show()
			end
		end
	end
end)

function tosun_pausemenu_hide()
    DisableIdleCamera(false)
	SetNuiFocus(false, false)
	SetNuiFocusKeepInput(false)
	SendNUIMessage({
		type = "hide",
		toggle = false,
	});
end

RegisterNetEvent('tosun-pausemenu:hide')
AddEventHandler('tosun-pausemenu:hide', function()
	tosun_pausemenu_hide()
end)

RegisterNetEvent('tosun-pausemenu:disable')
AddEventHandler('tosun-pausemenu:disable', function()
	tosun_menu_enabled = false
end)

RegisterNetEvent('tosun-pausemenu:enable')
AddEventHandler('tosun-pausemenu:enable', function()
	tosun_menu_enabled = true
end)

-- You can also add custom events to happen when you click on the disconnecting button.
function tosun_call_logout()
	TriggerEvent('tosun-multicharacter:start') -- Replace this event to whatever you want event you want to be triggered after clicking on the Disconnect Button.
	-- TriggerEvent('qb-multicharacter:client:chooseChar') For default qb-multicharacter
end

Hide/Disable Pause Menu when Player is dead.

Configuration for QBCore :

  • Step 1 : Open qb-ambulancejob -> client -> laststand.lua

  • Step 2 : Search for the SetLastStand function.

    Copy

    function SetLaststand(bool)
  • Step 3 : Add the following events

    Copy

    TriggerEvent('tosun-pausemenu:hide')
    TriggerEvent('tosun-pausemenu:disable')
    
    -----------------------------------------------------------------------------------
                                     How it should be: 
    -----------------------------------------------------------------------------------
    
    
    function SetLaststand(bool)
        local ped = PlayerPedId()
        if bool then
            Wait(1000)
            while GetEntitySpeed(ped) > 0.5 or IsPedRagdoll(ped) do Wait(10) end
            local pos = GetEntityCoords(ped)
            local heading = GetEntityHeading(ped)
            TriggerServerEvent("InteractSound_SV:PlayOnSource", "demo", 0.1)
            LaststandTime = Laststand.ReviveInterval
            if IsPedInAnyVehicle(ped) then
                local veh = GetVehiclePedIsIn(ped)
                local vehseats = GetVehicleModelNumberOfSeats(GetHashKey(GetEntityModel(veh)))
                for i = -1, vehseats do
                    local occupant = GetPedInVehicleSeat(veh, i)
                    if occupant == ped then
                        NetworkResurrectLocalPlayer(pos.x, pos.y, pos.z + 0.5, heading, true, false)
                        SetPedIntoVehicle(ped, veh, i)
                    end
                end
            else
                NetworkResurrectLocalPlayer(pos.x, pos.y, pos.z + 0.5, heading, true, false)
            end
            SetEntityHealth(ped, 150)
            if IsPedInAnyVehicle(ped, false) then
                LoadAnimation("veh@low@front_ps@idle_duck")
                TaskPlayAnim(ped, "veh@low@front_ps@idle_duck", "sit", 1.0, 8.0, -1, 1, -1, false, false, false)
            else
                LoadAnimation(lastStandDict)
                TaskPlayAnim(ped, lastStandDict, lastStandAnim, 1.0, 8.0, -1, 1, -1, false, false, false)
            end
            InLaststand = true
            TriggerEvent('tosun-pausemenu:hide')
            TriggerEvent('tosun-pausemenu:disable')
            TriggerServerEvent('hospital:server:ambulanceAlert', Lang:t('info.civ_down'))
            CreateThread(function()
                while InLaststand do
                    ped = PlayerPedId()
                    local player = PlayerId()
                    if LaststandTime - 1 > Laststand.MinimumRevive then
                        LaststandTime = LaststandTime - 1
                        Config.DeathTime = LaststandTime
                    elseif LaststandTime - 1 <= Laststand.MinimumRevive and LaststandTime - 1 ~= 0 then
                        LaststandTime = LaststandTime - 1
                        Config.DeathTime = LaststandTime
                    elseif LaststandTime - 1 <= 0 then
                        QBCore.Functions.Notify(Lang:t('error.bled_out'), "error")
                        SetLaststand(false)
                        local killer_2, killerWeapon = NetworkGetEntityKillerOfPlayer(player)
                        local killer = GetPedSourceOfDeath(ped)
                        if killer_2 ~= 0 and killer_2 ~= -1 then killer = killer_2 end
                        local killerId = NetworkGetPlayerIndexFromPed(killer)
                        local killerName = killerId ~= -1 and GetPlayerName(killerId) .. " " .. "("..GetPlayerServerId(killerId)..")" or Lang:t('info.self_death')
                        local weaponLabel = Lang:t('info.wep_unknown')
                        local weaponName = Lang:t('info.wep_unknown')
                        local weaponItem = QBCore.Shared.Weapons[killerWeapon]
                        if weaponItem then
                            weaponLabel = weaponItem.label
                            weaponName = weaponItem.name
                        end
                        TriggerServerEvent("qb-log:server:CreateLog", "death", Lang:t('logs.death_log_title', {playername = GetPlayerName(-1), playerid = GetPlayerServerId(player)}), "red", Lang:t('logs.death_log_message', {killername = killerName, playername = GetPlayerName(player), weaponlabel = weaponLabel, weaponname = weaponName}))
                        deathTime = 0
                        OnDeath()
                        DeathTimer()
                    end
                    Wait(1000)
                end
            end)
        else
            TaskPlayAnim(ped, lastStandDict, "exit", 1.0, 8.0, -1, 1, -1, false, false, false)
            InLaststand = false
            LaststandTime = 0
        end
        TriggerServerEvent("hospital:server:SetLaststandStatus", bool)
    end
  • Step 4 : Open qb-ambulance -> client -> main.lua

  • Step 5 : Go to 'hospital:client:Revive' event

    Copy

    RegisterNetEvent('hospital:client:Revive', function()
  • Step 6 : Add the following Trigger after or before ResetAll()

    Copy

    TriggerEvent('tosun-pausemenu:enable')
    ResetAll()
    
    -----------------------------------------------------------------------------------
                                     How it should be: 
    -----------------------------------------------------------------------------------
    
    RegisterNetEvent('hospital:client:Revive', function()
        local player = PlayerPedId()
    
        if isDead or InLaststand then
            local pos = GetEntityCoords(player, true)
            NetworkResurrectLocalPlayer(pos.x, pos.y, pos.z, GetEntityHeading(player), true, false)
            isDead = false
            SetEntityInvincible(player, false)
            SetLaststand(false)
        end
    
        if isInHospitalBed then
            loadAnimDict(inBedDict)
            TaskPlayAnim(player, inBedDict , inBedAnim, 8.0, 1.0, -1, 1, 0, 0, 0, 0 )
            SetEntityInvincible(player, true)
            canLeaveBed = true
        end
    
        TriggerServerEvent("hospital:server:RestoreWeaponDamage")
        SetEntityMaxHealth(player, 200)
        SetEntityHealth(player, 200)
        ClearPedBloodDamage(player)
        SetPlayerSprint(PlayerId(), true)
        ResetAll()
        ResetPedMovementClipset(player, 0.0)
        TriggerServerEvent('hud:server:RelieveStress', 100)
        TriggerServerEvent("hospital:server:SetDeathStatus", false)
        TriggerServerEvent("hospital:server:SetLaststandStatus", false)
        TriggerEvent('tosun-pausemenu:enable')
        emsNotified = false
        QBCore.Functions.Notify(Lang:t('info.healthy'))
    end)

Configuration for ESX :

  • Step 1 : Open esx_ambulancejob > client -> main.lua

  • Step 2 : Add the following events under function OnPlayerDeath()

    Copy

    TriggerEvent('tosun-pausemenu:hide')
    TriggerEvent('tosun-pausemenu:disable')
    
    -----------------------------------------------------------------------------------
                                     How it should be: 
    -----------------------------------------------------------------------------------
    
    function OnPlayerDeath()
        isDead = true
        ESX.CloseContext()
        ClearTimecycleModifier()
        SetTimecycleModifier("REDMIST_blend")
        SetTimecycleModifierStrength(0.7)
        SetExtraTimecycleModifier("fp_vig_red")
        SetExtraTimecycleModifierStrength(1.0)
        SetPedMotionBlur(PlayerPedId(), true)
        TriggerServerEvent('esx_ambulancejob:setDeathStatus', true)
        StartDeathTimer()
        StartDeathCam()
        StartDistressSignal()
        TriggerEvent('tosun-pausemenu:hide')
        TriggerEvent('tosun-pausemenu:disable')
    end
  • Step 3 : Add the following Event in 'esx_ambulancejob:revive' event

    Copy

    TriggerEvent('tosun-pausemenu:enable')
    
    -----------------------------------------------------------------------------------
                                     How it should be: 
    -----------------------------------------------------------------------------------
    
    RegisterNetEvent('esx_ambulancejob:revive')
    AddEventHandler('esx_ambulancejob:revive', function()
      local playerPed = PlayerPedId()
      local coords = GetEntityCoords(playerPed)
      TriggerServerEvent('esx_ambulancejob:setDeathStatus', false)
    
      DoScreenFadeOut(800)
    
      while not IsScreenFadedOut() do
        Wait(50)
      end
    
      local formattedCoords = {x = ESX.Math.Round(coords.x, 1), y = ESX.Math.Round(coords.y, 1), z = ESX.Math.Round(coords.z, 1)}
    
      RespawnPed(playerPed, formattedCoords, 0.0)
      isDead = false
      TriggerEvent('tosun-pausemenu:enable')
      ClearTimecycleModifier()
      SetPedMotionBlur(playerPed, false)
      ClearExtraTimecycleModifier()
      EndDeathCam()
      DoScreenFadeIn(800)
    end)

Last updated