Jump to content

Problem with engineLoadIFP


MaurO^

Recommended Posts

Posted

I have a problem loading the custom animation, when I write / anim dance1 the animation does not start, if I do it only from the client side it works. Is it possible to do this with triggers?

Cliente.lua:

local name = "bailes_fornite"

local IFP = engineLoadIFP( "bailes.ifp", name)

if not IFP then
    outputChatBox( "Fallo al cargar el archivo 'bailes.ifp'" )
end

function setAnimation(_, animationName)
    if IFP then
		--setPedAnimation(localPlayer, name, anim )
		triggerServerEvent("onAnim", localPlayer, name, animationName)
    end
end
addCommandHandler("anim", setAnimation)

Server.lua:

function animar(name, animationName)
	setPedAnimation(source, name, animationName)
end
addEvent("onAnim", true)
addEventHandler("onAnim", root, animar)

 

Posted

You need to trigger from the server to the client not the other way around.

local name = "bailes_fornite"

local IFP = engineLoadIFP( "bailes.ifp", name)

if not IFP then
    outputChatBox( "Fallo al cargar el archivo 'bailes.ifp'" )
end

function setAnimation(animationName)
	setPedAnimation(source, name, animationName)
end
addEvent("onAnim", true)
addEventHandler("onAnim", root, setAnimation)
function animar(plr, _, animationName)
	triggerClientEvent("onAnim", plr, animationName)
end
addCommandHandler("anim", animar)

 

  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...