Shopping Cart

[HOW TO] Take away Stress w/ Smoking Cigarette – Modding Tutorials

[ad_1]

FiveM Modding Tutorial

Thought I’d share this since I’ve seen it requested right here and there.

Please be aware the animation sucks and im certain this may very well be significantly improved but it surely does work.
I’ll replace this after I’ve improved it.

Necessities:
esx_basicneeds
linden-inventory (provided that utilizing this stock after all, you will have a diff requirement)

Step #1: Observe this for including stress system:

Add the next in esx_basicneedsservermain.lua:

ESX.RegisterUsableItem('cigarette', perform(supply)
	native xPlayer = ESX.GetPlayerFromId(supply)
	xPlayer.removeInventoryItem('cigarette', 1)

	TriggerClientEvent('esx_status:take away', supply, 'stress', 100000)
	TriggerClientEvent('esx_basicneeds:onSmoke', supply)
	xPlayer.showNotification(_U('used_cigarette'))
finish)

Add the next to esx_basicneedsclientmain.lua:

RegisterNetEvent('esx_basicneeds:onSmoke')
AddEventHandler('esx_basicneeds:onSmoke', perform(prop_name)
	if not IsAnimated then
		prop_name = prop_name or 'ng_proc_cigarette01a'
		IsAnimated = true

		Citizen.CreateThread(perform()
		native playerPed = PlayerPedId()
		native x,y,z = desk.unpack(GetEntityCoords(playerPed))
		native prop = CreateObject(GetHashKey(prop_name), x, y, z + 0.2, true, true, true)
		native boneIndex = GetPedBoneIndex(playerPed, 18905)
		AttachEntityToEntity(prop, playerPed, boneIndex, 0.12, 0.028, 0.001, 10.0, 175.0, 0.0, true, true, false, true, 1, true)
		
		ESX.Streaming.RequestAnimDict('[email protected][email protected]@idle_a', perform()
			TaskStartScenarioInPlace(playerPed, 'WORLD_HUMAN_SMOKING', 0, false)

			Citizen.Wait(3000)
			IsAnimated = false
			ClearPedSecondaryTask(playerPed)
			DeleteObject(prop)
		finish)
	finish)

	finish
finish)

For linden-inventory customers:

linden_inventoryshareditems.lua:

	['cigarette'] = {
		removeStress = 200000,
		animDict="[email protected][email protected]@idle_a",
		anim = 'idle_a',
		mannequin="ng_proc_cigarette01a",
		coords = { x = 0.03, y = 0.0, z = 0.02 },
		rotation = { x = 0.0, y = -13.5, z = -1.5 },
		useTime = 2500,
		occasion="linden_inventory:cigarette"
	},

linden_inventoryclientmain.lua:

					if knowledge.stress then 
						TriggerEvent('esx_status:add', 'stress', knowledge.stress) 
					finish
					if knowledge.removeStress then 
						TriggerEvent('esx_status:take away', 'stress', knowledge.removeStress) 
					finish

[ad_2]

Unique supply: https://discussion board.cfx.re/t/how-to-remove-stress-w-smoking-cigarette/2886485

Leave a Reply
FiveM ESX Scripts

The best scripts and maps

Best support

Problems? We are there to help!

Wide range of products

We have a wide range of products

100% Secure Checkout

Stripe