[RELEASE] FX-nAnimsTarget

Simple script to show how to add animation to the target in the same time of the source player. with a notification to ask to accept or refuse.

Screen:
Annotation%202019-11-15%20231918

Download

Installation:

  1. Drag and drop the file into your ressources.

  2. Add it into your server.cfg.

enjoy.

9 Likes

Very interesting! Was looking into doing this kinda thing a while ago with a script of mine.
I love the ask notification, very sleek!

3 Likes

Good release

1 Like

/smd coming soon :eyes:

1 Like

Update incoming to dpEmotes? :heart_eyes::thinking:

2 Likes

I’m working on updating players positions according to animations. I’d like to share with you if I can. I would be happy to contribute to dpEmotes.

1 Like

Hell yea! I got most of it setup without the player positioning, lmk how your testing goes!
I’ll probably make another branch on the dpemotes git with the ‘shared emotes’ testing

@KomsuTeyze
I’ve got this setup atm, working pretty well.
I tried a couple of things to move the players to a set coord correspoding to where the other player was facing.
But man i just cant figure it out, must be some native out there that makes it easier, checking the offset of the players coords etc.
– It can also be set to play 2 different emotes, since the hug/handshake/give all have a target and source emote already.
any way heres what i got so far, with requesting turned off for the videos sake so it just plays instantly on both clients

https://streamable.com/p1kpr - if it doesnt load

2 Likes

Glad to see that can help.

To move the target player to you, try to get exemple on that script shared by Robbster:

I want to share my trial. It’s working but not stable for Face to Face.

First one i divide target and source code.

------------------------------ SOURCE ----------------------

RegisterNetEvent("GiveAnims") --> this event is for play anim when the player accept.
AddEventHandler("GiveAnims", function()
	local ped2 = PlayerPedId()
	local heading = GetEntityHeading(GetPedInFront())
    --local ped = PlayerPedId()
	local playerCoords = GetEntityCoords(ped)
    local giveAnim = "mp_ped_interaction" --> Here is your animLib that u want use.
    RequestAnimDict(giveAnim)
    while not HasAnimDictLoaded(giveAnim) do
        Citizen.Wait(100)
    end
	--SetEntityHeading(ped2, heading - 180.1)
	--SetEntityCoords(ped2, playerCoords["x"], playerCoords["y"], playerCoords["z"] - 1.00)
	--Citizen.Wait(2500)
    TaskPlayAnim(ped2, giveAnim, "kisses_guy_a", 8.0, 8.0, -1, 50, 0, false, false, false)
	FreezeEntityPosition(PlayerPedId(), true)
    Citizen.Wait(2500)
    ClearPedTasks(ped2)
	FreezeEntityPosition(PlayerPedId(), false)
end)

--------------------------------- TARGET ------------------------------------

RegisterNetEvent("GiveAnims2") --> this event is for play anim when the player accept.
AddEventHandler("GiveAnims2", function()
    local heading = GetEntityHeading(GetPedInFront())
	local ped = PlayerPedId()
	local ped2 = GetPedInFront()
	local pedPlayer = GetPlayerFromPed(ped2)
    --local ped2 = GetClosestPlayer()
	local playerCoords = GetEntityCoords(ped2)
	local playerCoords2 = GetEntityCoords(ped)
    local giveAnim = "mp_ped_interaction" --> Here is your animLib that u want use.
    RequestAnimDict(giveAnim)
    while not HasAnimDictLoaded(giveAnim) do
        Citizen.Wait(100)
    end
	SetEntityHeading(ped, heading - 180.1)
	TaskGoStraightToCoord(PlayerPedId(), playerCoords["x"], playerCoords["y"], playerCoords["z"], 1.0, 5000, 0, 0.0)
	--Citizen.Wait(2000)
	--SetEntityCoords(ped, playerCoords2["x"], playerCoords2["y"], playerCoords["z"] - 1.00)
	--FreezeEntityPosition(PlayerPedId(), true)
    TaskPlayAnim(ped, giveAnim, "kisses_guy_a", 8.0, 8.0, -1, 50, 0, false, false, false)
    Citizen.Wait(2500)
    ClearPedTasks(ped)
	--FreezeEntityPosition(PlayerPedId(), false)
	end)

you can get the coordinates of the other player with local ped2 = GetPedInFront()

But you must add this code;

function GetPedInFront()
	local player = PlayerId()
	local plyPed = GetPlayerPed(player)
	local plyPos = GetEntityCoords(plyPed, false)
	local plyOffset = GetOffsetFromEntityInWorldCoords(plyPed, 0.0, 1.3, 0.0)
	local rayHandle = StartShapeTestCapsule(plyPos.x, plyPos.y, plyPos.z, plyOffset.x, plyOffset.y, plyOffset.z, 10.0, 12, plyPed, 7)
	local _, _, _, _, ped2 = GetShapeTestResult(rayHandle)
	return ped2
end

function GetPlayerFromPed(ped2)
	for a = 0, 255 do
		if GetPlayerPed(a) == ped2 then
			return a
		end
	end
	return -1
end

And nonsense trials bla bla bla. I’m fcking untalented developer.

Good stuff! Still having trouble figuring it out, so just uploaded everything i’ve done thus far.

@KomsuTeyze
@MyllyV letting you know i updated!

3 Likes

Is there any way to implement something like this to esx_animations

Nice!

1 Like

Good job ;D

1 Like