ScriptsM Smoke

SM-Smoke | Realistic smoking system wit Puff control

Hello! Today I’m showing you my Smoking System script — you can smoke different types of cigarettes, control puff length, put them in your mouth, share with others and more. Check out all the features below!

Installation

Download a resource (opens in a new tab) from keymaster or buy it by buttons at the top

Resource start order

It's important for your resources to start in a logical order to prevent errors from missing dependencies.

start your_framework
start sm-smoking

Adding custom cigarretes & packs

To make custom cigarettes & packs, follow this steps

  1. Open config.lua inside sm-smoking folder
  2. Add this line after Config.CigTypes (For Standalone)
{name = 'CIGNAME', model = 'PROP_MODEL_HERE', puffcount = 50, func= ''},
  1. In name you must write your cigarette name, in model, paste the model of your cigarette. You can find it in here: https://www.gtahash.ru/ (opens in a new tab) For puffcount specify a value of puff count you want. For func option go to step 4
  2. If you want cigarette with effect, you need to add function above. For example you have Config.Joint function. If you want use a function, you need to put your function name into func, like this:
{name = 'CIGNAME', model = 'PROP_MODEL_HERE', puffcount = 50, func= Config.Joint},
  1. For example, you can add this to your function:
level = AddSmokeEffect() -- Adding screen effect and returns your drunk level
if level >= 5 then -- If drunk level >= 5 then doing this actions
RequestAnimSet("move_m@business@a") -- Requesting drunk movement
SetPedMovementClipset(PlayerPedId(), "move_m@business@a", true) -- Applying drunk movement
SetPedIsDrunk(PlayerPedId(), true) -- Enable drunk state for ped
SetPedMotionBlur(PlayerPedId(), true) -- Enable motion blur
local health = GetEntityHealth(PlayerPedId()) -- Get player health
SetEntityHealth(PlayerPedId(), health + 5) -- Add 5 health to player for each puff
else -- If drunk level < 5 then
ResetPedMovementClipset(PlayerPedId(), 0) -- Set normal movement
SetPedIsDrunk(PlayerPedId(), false) -- Disable drunk state
SetPedMotionBlur(PlayerPedId(), false) -- Disable motion blur
end
  1. If you are using framework, go to step 2 and add following lines after Config.PackItems
{packmodel = 'PROP_MODEL_HERE', modelpos = vector3(0.020, -0.05, -0.030), modelrot = vector3(0.0, 0.0, 0.0), packitem = 'INVENTORY_PACK_NAME', cigitem = 'INVENTORY_CIG_NAME', count = CIG_COUNT},
  1. Packmodel you can find here: https://www.gtahash.ru/ (opens in a new tab). For modelpos and modelrot you need to play with this value and place it into hand. Packitem and cigitem is inventory item names. Count is a count of cigarettes in this pack
  2. After Config.CigItems paste this code:
{cigmodel = 'PROP_MODEL_HERE', cigitem = 'INVENTORY_CIG_ITEM', puffcount = 50, func= ''},
  1. In cigmodel, paste the model of your cigarette. You can find it in here: https://www.gtahash.ru/ (opens in a new tab) In cigitem write you cigarette inventory item. For puffcount specify a value of puff count you want. For func option go to step 4

Config

There you can find an config of resource with description for all params

Config = {}
 
Config.Framework = 'none' -- esx/qb/none
 
Config.UseLighter = true -- Use lighter or no
 
Config.LighterItem = 'lighter' -- Lighter item name
 
Config.GiveDist = 1.5 -- Cigarette give distance
 
Config.UseCommand = true -- Use command or not
 
Config.Joint = function() -- Cigarette effect function
level = AddSmokeEffect('spectator9') -- Screen effect. You can find list of all screen effects here: https://wiki.rage.mp/wiki/Timecycle_Modifiers
if level >= 5 then
RequestAnimSet("move_m@business@a")
SetPedMovementClipset(PlayerPedId(), "move_m@business@a", true)
SetPedIsDrunk(PlayerPedId(), true)
SetPedMotionBlur(PlayerPedId(), true)
local health = GetEntityHealth(PlayerPedId())
SetEntityHealth(PlayerPedId(), health + 5)
else
ResetPedMovementClipset(PlayerPedId(), 0)
SetPedIsDrunk(PlayerPedId(), false)
SetPedMotionBlur(PlayerPedId(), false)
end
end
 
Config.CigTypes = { -- Cigarette types for /smoke command
	{name = 'cig', model = 'prop_cs_ciggy_01', puffcount = 20, func= ''}, -- name is argument name for command use, model is cig model, func is function for cigarette, view example above
	{name = 'joint', model = 'p_cs_joint_02', puffcount = 10, func= Config.Joint},
	{name = 'cigar', model = 'prop_cigar_03', puffcount = 50, func= ''},
}
 
Config.PackItems = { -- Pack items for frameworks
	{packmodel = 'prop_cigar_pack_01', modelpos = vector3(0.020, -0.05, -0.010), modelrot = vector3(100.0, 0.0, 0.0), packitem = 'redwood_pack', cigitem = 'redwood_cig', count = 20}, -- packmodel is model name for pack. packitem is name of inventory item, cigitem is name of inventory item, count is count of cig in pack
	{packmodel = 'ng_proc_cigpak01a', modelpos = vector3(0.020, -0.05, -0.030), modelrot = vector3(0.0, 0.0, 0.0), packitem = 'joint_pack', cigitem = 'joint', count = 5},
	{packmodel = 'ng_proc_cigpak01a', modelpos = vector3(0.020, -0.05, -0.030), modelrot = vector3(0.0, 0.0, 0.0), packitem = 'cigar_pack', cigitem = 'cigar', count = 5},
}
 
Config.CigItems = { -- Cigarette items for frameworks
	{cigmodel = 'prop_cs_ciggy_01', cigitem = 'redwood_cig', puffcount = 20, func= ''}, -- cig model is a cigarette model name, cigitem is a cig item inventory name, func is function for cigarette, view example above
	{cigmodel = 'p_cs_joint_02', cigitem = 'joint', puffcount = 10, func= Config.Joint},
	{cigmodel = 'prop_cigar_03', cigitem = 'cigar', puffcount = 50, func= ''},
}
 
Config.LocalesDefault = { -- Locales
    ['command_description'] = "Light a cigarette",
    ['arg_name'] = 'Cigarette type',
    ['args'] = 'cig / joint / cigar',
}
 
Config.LocalesPed = { -- Locales if you are on foot
    ['help_keys'] = "~INPUT_PICKUP~ - Puff\n~INPUT_VEH_DUCK~ - Drop\n~INPUT_DETONATE~ - Put in mouth\n~INPUT_VEH_HEADLIGHT~ - Give\nPuffs left: ",
    ['puff'] = "~g~Doing puff",
    ['in_mouth'] = "~INPUT_DETONATE~ - Take out of mouth",
    ['give_other'] = "~INPUT_PICKUP~ - Give\n~INPUT_VEH_DUCK~ - Cancel",
    ['give_confirm'] = "~INPUT_PICKUP~ - Take\n~INPUT_VEH_DUCK~ - Cancel",
    ['give_cancel'] = "~INPUT_VEH_DUCK~ - Cancel give",
    ['give_canceled'] = "~r~Give cancelled",
    ['give_canceled_already_have'] = "~r~Player already have a cig",
 
    ['command_description'] = "Light a cigarette",
    ['arg_name'] = 'Cigarette type',
    ['args'] = 'cig / joint',
}
 
Config.LocalesVeh = { -- Locales if you are in vehicle
    ['help_keys'] = "~INPUT_MAP_POI~ - Puff\n~INPUT_VEH_DUCK~ - Drop\n~INPUT_DETONATE~ - Put in mouth\n~INPUT_MP_TEXT_CHAT_TEAM~ - Give\nPuffs left: ",
    ['puff'] = "~g~Doing puff",
    ['in_mouth'] = "~INPUT_DETONATE~ - Take out of mouth",
    ['give_other'] = "~INPUT_MAP_POI~ - Give\n~INPUT_VEH_DUCK~ - Cancel",
    ['give_confirm'] = "~INPUT_MAP_POI~ - Take\n~INPUT_VEH_DUCK~ - Cancel",
    ['give_cancel'] = "~INPUT_VEH_DUCK~ - Cancel give",
    ['give_canceled'] = "~r~Give cancelled",
    ['give_canceled_already_have'] = "~r~Player already have a cig",
}
 
Config.PedKeys = { -- Keys if you are on foot, find keys here: https://docs.fivem.net/docs/game-references/controls/
    ['puff'] = 38,
    ['cancel'] = 73,
    ['mouth'] = 47,
    ['give'] = 74,
}
 
Config.VehKeys = { -- Keys if you are in vehicle, find keys here: https://docs.fivem.net/docs/game-references/controls/
    ['puff'] = 348,
    ['cancel'] = 73,
    ['mouth'] = 47,
    ['give'] = 246, 
}