TaskPlayAnim not working

Yes, yes you can do that :stuck_out_tongue: I am working on doing a smoking pot anim as we speak haha :stuck_out_tongue:

Goes to show how the simplest things in scripting could mess it all up.

Dont forget, the commas!!! lmao, get me everytime.

Like this?

local playerPed = GetPlayerPed(-1)
  local coords    = GetEntityCoords(playerPed)

	Citizen.CreateThread(function()
    
    local playerPed  = GetPlayerPed(-1)
    local coords     = GetEntityCoords(playerPed)
    local boneIndex  = GetPedBoneIndex(playerPed, 18905)
    local boneIndex2 = GetPedBoneIndex(playerPed, 57005)

      RequestAnimDict('anim@safehouse@bong')
        
    while not HasAnimDictLoaded('anim@safehouse@bong') do
      Citizen.Wait(0)
    end
    
    ESX.Game.SpawnObject('hei_heist_sh_bong_01', {
      x = coords.x,
      y = coords.y,
      z = coords.z - 3
    }, function(object)

    ESX.Game.SpawnObject('p_cs_lighter_01', {
      x = coords.x,
      y = coords.y,
      z = coords.z - 3
    }, function(object2)
    
    Citizen.CreateThread(function()
    
      TaskPlayAnim(playerPed, "anim@safehouse@bong", "bong_stage1", 3.5, -8, -1, 49, 0, 0, 0, 0)
      Citizen.Wait(1500)
      AttachEntityToEntity(object2, playerPed, boneIndex2, 0.10, 0.0, 0, 99.0, 192.0, 180.0, true, true, false, true, 1, true)
      AttachEntityToEntity(object, playerPed, boneIndex, 0.10, -0.25, 0, 95.0, 190.0, 180.0, true, true, false, true, 1, true)
      Citizen.Wait(6000)
      DeleteObject(object)
      DeleteObject(object2)
      ClearPedSecondaryTask(playerPed)
      end)
     end)
    end)
  end)
end)

Ohhh niceeee. Yeah that was one of the weed ones I wanted to do :stuck_out_tongue: I am also doing a joint. I was gonna see about making it so if two people type /joint and are near eachother they could pass the join. Like press Q while holding the join to pass it to another player. Then press E to take a toke off it :slight_smile: No idea how to do the passing part, xD

Here is what I have done so far. All i need is an anim that is holding his LEFT arm up. So when you just are holding the bong, you’re holding it upright. All the of the “drink” anims, like beer, coffee, etc. are all RIGHT arm. So He still just holding it sideways 0.o

RegisterCommand("bong",function(source, args)
	local ad1 = "anim@safehouse@bong"
	local ad1a = "bong_stage1"
	local player = GetPlayerPed(-1)
	local plyCoords = GetOffsetFromEntityInWorldCoords(GetPlayerPed(PlayerId()), 0.0, 0.0, -5.0)
	local bongspawned = CreateObject(GetHashKey(bongmodel), plyCoords.x, plyCoords.y, plyCoords.z, 1, 1, 1)
	local netid = ObjToNet(bongspawned)


	if (DoesEntityExist(player) and not IsEntityDead(player)) then 
		loadAnimDict(ad1)
		RequestModel(GetHashKey(bongmodel))
		if holdingbong then
			Wait(100)
			ClearPedSecondaryTask(GetPlayerPed(-1))
			DetachEntity(NetToObj(bong_net), 1, 1)
			DeleteEntity(NetToObj(bong_net))
			bong_net = nil
			holdingbong = false
		else
			Wait(500)
			SetNetworkIdExistsOnAllMachines(netid, true)
			NetworkSetNetworkIdDynamic(netid, true)
			SetNetworkIdCanMigrate(netid, false)
			AttachEntityToEntity(bongspawned,GetPlayerPed(PlayerId()),GetPedBoneIndex(GetPlayerPed(PlayerId()), 18905),0.10,-0.25,0.0,95.0,190.0,180.0,1,1,0,1,0,1)
			Wait(120)
			Notification("Press ~r~[E]~w~ to take a toke!")
			bong_net = netid
			holdingbong = true
		end
	end

	while holdingbong do
		Wait(0)
		local plyCoords2 = GetEntityCoords(player, true)
		local head = GetEntityHeading(player)
		if IsControlJustPressed(0, 38) then
			TaskPlayAnimAdvanced(player, ad1, ad1a, plyCoords2.x, plyCoords2.y, plyCoords2.z, 0.0, 0.0, head, 8.0, 1.0, 4000, 49, 0.25, 0, 0)
			Wait(100)
			Notification("You take a huge rip!")
			Wait(7250)
			TaskPlayAnim(player, ad2, ad2a, 8.0, 1.0, -1, 49, 0, 0, 0, 0)
		end
	end
end, false)

I also cant figure out a smoke particle effect. I am trying to attach it to the player, but to no avail.(not in this code)

Not sure if this going to help you out

SetTimecycleModifier("spectator5")
    SetPedMotionBlur(GetPlayerPed(-1), true)
    SetPedMovementClipset(GetPlayerPed(-1), "MOVE_M@DRUNK@SLIGHTLYDRUNK", true)
    SetPedIsDrunk(GetPlayerPed(-1), true)

worth the try

Nah, I dont need the screen FX I just need an animation with his left arm out like he is holding a cup lol. Buuuut now that you mention it, it would be a fun little thing to add :slight_smile:

ahhh…okay
Question, What the best way of having any sort of emote being done through chat, This is what I tried but…I know for sure theirs better way of doing it?!

RegisterNetEvent("smoke2")
AddEventHandler("smoke2", function()
local lPed = GetPlayerPed(-1)
	if DoesEntityExist(lPed) then
		Citizen.CreateThread(function()
			TaskStartScenarioInPlace(lPed, "WORLD_HUMAN_SMOKING_POT", 0, true)
			Wait(30000)
		end)
	end
end)

RegisterServerEvent("chatMessage")
AddEventHandler("chatMessage", function(source, n, message)
	if message == "/smoke" then
		CancelEvent()
		TriggerClientEvent("smoke", source)
	end
end)

Goto my other post for my emotes. All of mine are chat commands. Take a look see for yourself!:slight_smile: you dont need to have server events. It can all be done in a client.lua just take mine and change it up or use it for referance:) [Release] Daves Emotes /... Now with umbrella!

@davewazere Yea it work out with your release, SO I thank You.

How would go on about just having ‘WORLD_HUMAN_CLIPBOARD’ its self with your …

RegisterCommand("o7",function(source, args)

	local ad = "anim@mp_player_intuppersalute"
	local player = GetPlayerPed( -1 )
	
	if ( DoesEntityExist( player ) and not IsEntityDead( player )) then 
		loadAnimDict( ad )
		if ( IsEntityPlayingAnim( player, ad, "idle_a", 3 ) ) then 
			TaskPlayAnim( player, ad, "exit", 8.0, 1.0, -1, 49, 0, 0, 0, 0 )
			Wait (600)
			ClearPedSecondaryTask(GetPlayerPed(-1))
		else
			TaskPlayAnim( player, ad, "idle_a", 8.0, 1.0, -1, 49, 0, 0, 0, 0 )
			Wait (500)
		end     
	end
end, false)

hi bro. i need it can you
share me for this ?

anyone know how to make the code for example when i am processing drugs well say coke i pour the coke powder into the pooch bags with real animations synced with the props and the person ziplocking the bag if so hit me up on discord please i will pay if u know what u are doing. My discord is breezie21…