[How to]How to add Alcoholic effect?

How to add Alcoholic effect for a specific object?
For this items[“vodka”]

-- define some basic inventory items

local items = {}

local function play_eat(player)
  local seq = {
    {"mp_player_inteat@burger", "mp_player_int_eat_burger_enter",1},
    {"mp_player_inteat@burger", "mp_player_int_eat_burger",1},
    {"mp_player_inteat@burger", "mp_player_int_eat_burger_fp",1},
    {"mp_player_inteat@burger", "mp_player_int_eat_exit_burger",1}
  }

  vRPclient.playAnim(player,{true,seq,false})
end

local function play_drink(player)
  local seq = {
    {"mp_player_intdrink","intro_bottle",1},
    {"mp_player_intdrink","loop_bottle",1},
    {"mp_player_intdrink","outro_bottle",1}
  }

  vRPclient.playAnim(player,{true,seq,false})
end

-- gen food choices as genfunc
-- idname
-- ftype: eat or drink
-- vary_hunger
-- vary_thirst
local function gen(ftype, vary_hunger, vary_thirst)
  local fgen = function(args)
    local idname = args[1]
    local choices = {}
    local act = "Unknown"
    if ftype == "eat" then act = "Eat" elseif ftype == "drink" then act = "Drink" end
    local name = vRP.getItemName(idname)

    choices[act] = {function(player,choice)
      local user_id = vRP.getUserId(player)
      if user_id ~= nil then
        if vRP.tryGetInventoryItem(user_id,idname,1,false) then
          if vary_hunger ~= 0 then vRP.varyHunger(user_id,vary_hunger) end
          if vary_thirst ~= 0 then vRP.varyThirst(user_id,vary_thirst) end

          if ftype == "drink" then
            vRPclient.notify(player,{"~b~ Выпил "..name.."."})
            play_drink(player)
          elseif ftype == "eat" then
            vRPclient.notify(player,{"~o~ Съел "..name.."."})
            play_eat(player)
          end

          vRP.closeMenu(player)
        end
      end
    end}

    return choices
  end

  return fgen
end

-- DRINKS --

items["water"] = {"Бутылка воды","", gen("drink",0,-25),0.5}
items["milk"] = {"Молоко","", gen("drink",0,-5),0.5}
items["coffee"] = {"Растворимый кофе","", gen("drink",0,-10),0.2}
items["tea"] = {"Заварной чай","", gen("drink",0,-15),0.2}
items["icetea"] = {"Холодный чай","", gen("drink",0,-20), 0.5}
items["orangejuice"] = {"Гранатовый сок.","", gen("drink",0,-25),0.5}
items["gocagola"] = {"Кока-кола","", gen("drink",0,-35),0.3}
items["redgull"] = {"Энергетик","", gen("drink",0,-40),0.3}
items["lemonlimonad"] = {"Лимонад","", gen("drink",0,-45),0.3}
items["vodka"] = {"Виски","", gen("drink",15,-65),0.5}

--FOOD

-- create Breed item
items["bread"] = {"Кекс","", gen("eat",-10,0),0.5}
items["donut"] = {"Шоколадка","", gen("eat",-15,0),0.2}
items["tacos"] = {"Чипсы","", gen("eat",-20,0),0.2}
items["sandwich"] = {"Хот-дог", gen("eat",-25,0),0.5}
items["kebab"] = {"Сэндвич","", gen("eat",-45,0),0.85}
items["pdonut"] = {"Круассан","", gen("eat",-25,0),0.5}

return items

By calling this native:
https://runtime.fivem.net/doc/reference.html#_0x80C8B1846639BB19

where do i add it?I asked for help with code

if vRP.tryGetInventoryItem(user_id,idname,1,false) then
         --other code
        -- Invoke native
 end

Some where in that if statement. (assuming that is where you use the item). Hard to tell when it’s not your code.

Can also refer to this

1 Like

I do not know where to write this in the code …

Can you help me?Please

I don’t know. Ask whoever’s resource it is. I’ve never used it.

if not HasAnimSetLoaded("MOVE_M@DRUNK@VERYDRUNK") then
	RequestAnimSet("MOVE_M@DRUNK@VERYDRUNK")
	while not HasAnimSetLoaded("MOVE_M@DRUNK@VERYDRUNK") do
		Citizen.Wait(0)
	end
end

SetPedIsDrunk(GetPlayerPed(-1), true)
ShakeGameplayCam("DRUNK_SHAKE", 1.0)
SetPedConfigFlag(GetPlayerPed(-1), 100, true)
SetPedMovementClipset(GetPlayerPed(-1), "MOVE_M@DRUNK@VERYDRUNK", 1.0)

This way the ped acts like he is drunk. I will not explain how to trigger it or whatever, that depends on what you want to do with it

1 Like

How does it bind specifically to a particular drink?Look my code please.

Would someone be able to do the same for the peyote/weed post procecssing effects? Can’t seem to find those anywhere really.

Maybe someone ask the same question and get no answer… WHERE I can insert this code, customscripts?

you can add the code to esx_drugs, basicneeds or optionalneeds to get your characters to use and have effects from drugs, hope that answered your question. I have been rebuilding the drugs in my server and it is tough not know where to put certain lines to get the outcome you want. Cheers everyone and thank you all for the great communication.