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)