Jump to content

Custom IFP animation not working for serverside.


Recommended Posts

I'm trying to add an animation to a ped that is being created on the server side, but this animation is customized and it doesn't work, I've tested numerous ways and it works only on the client side, but I necessarily need this ped to be created on the side from the server

 

local customIfp = nil 
local customBlockName = "mp_character"
local animationNames = {
    "nameplate"
} 

ped = createPed(...)

--[[ on the client side it is working ]]
setTimer(setPedAnimation, 100, 1, ped, "mp_character", "nameplate", -1, false, false, false)

addEventHandler("onClientResourceStart", resourceRoot,
    function ( startedRes )
        customIfp = engineLoadIFP("ped.ifp", customBlockName)
        if customIfp then 
            bindKeys ()
            outputChatBox ("ped.ifp Loaded successfully")
        else
            outputChatBox ("Failed to load ped.ifp")
        end
    end
)

I wanted to find a solution or for this problem of only working on the client side or a way for me to be able to trigger this animation with a trigger from the client to the server, but I haven't been successful yet, I couldn't get the information from the ped on the side of client

Link to comment

Hi! - read this topic, it might helps you out. (Syncing custom animations.)

I will give you a little preview of this on clientside, if something isn't clear after reading the topic that i linked above.

local customAnimList = {
    ["facepalm"] = {file = "facepalm.ifp", customBlock = "realism", customName = "facepalm"}, --example
}

addEventHandler("onClientResourceStart", resourceRoot, function()
    for _, anim in pairs(customAnimList) do
        local ifp = engineLoadIFP("files/" .. anim.file, anim.customBlock)
        if not ifp then
            outputDebugString("Failed to load custom animation: ("..anim.file..")")
        end
	end
end)

addEvent("replaceCustomAnim", true)
addEventHandler("replaceCustomAnim", root, function(internalBlockName, internalAnimName, customAnimName)
    engineReplaceAnimation(source, internalBlockName, internalAnimName, customAnimList[customAnimName].customBlock, customAnimList[customAnimName].customName)
end)

addEvent("restoreCustomAnim", true)
addEventHandler("restoreCustomAnim", root, function()
    engineRestoreAnimation(source)
end)

addEvent("applyCustomAnim", true)
addEventHandler("applyCustomAnim", root, function(customAnimName, time, loop, posUpdate)
    setPedAnimation(source, customAnimList[customAnimName].customBlock, customAnimList[customAnimName].customName, time, loop, posUpdate, false)
end)

 

  • Thanks 1
Link to comment

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...