Jump to content

Animação de client para server


Recommended Posts

Esse script de animação está aparecendo só para quem usa (client) gostaria de deixar para server

 

local animTable = { 

    ifp = {},

    anims = {
        "BIKEd_Back",
        "BIKEd_drivebyFT",
        "BIKEd_drivebyLHS",
        "BIKEd_drivebyRHS",
        "BIKEd_Fwd",
        "BIKEd_getoffBACK",
        "BIKEd_getoffLHS",
        "BIKEd_getoffRHS",
        "BIKEd_hit",
        "BIKEd_jumponL",
        "BIKEd_jumponR",
        "BIKEd_kick",
        "BIKEd_Left",
        "BIKEd_passenger",
        "BIKEd_pushes",
        "BIKEd_Ride",
        "BIKEd_Right",
        "BIKEd_Snatch_L",
        "BIKEd_Snatch_R",
        "BIKEd_Still",
    }

}

addEventHandler("onClientResourceStart", resourceRoot,
    function()

        animTable.ifp["block"] = "biked"
        animTable.ifp["ifp"] = engineLoadIFP("biked.ifp", animTable.ifp["block"])

        for _, v in ipairs(animTable.anims) do
            engineReplaceAnimation(localPlayer, "biked", v, animTable.ifp["block"], v)
        end

    end
)

>

Link to comment

Fala Igor, tudo bem? Espero que sim.

A modificação que fiz no seu script anterior move a lógica de carregamento das animações para o lado do servidor usando o evento onResourceStart. Isso deve ajudar a resolver o teu problema.

 

Segue:

local animTable = {
    ifp = {},
    anims = {
        "BIKEd_Back",
        "BIKEd_drivebyFT",
        -- Adicione suas outras animações aqui conforme o necessário.
    }
}

function loadAnimations()
    animTable.ifp["block"] = "biked"
    animTable.ifp["ifp"] = engineLoadIFP("biked.ifp", animTable.ifp["block"])

    for _, v in ipairs(animTable.anims) do
        engineReplaceAnimation(source, "biked", v, animTable.ifp["block"], v)
    end
end

addEventHandler("onResourceStart", resourceRoot, loadAnimations)

Qualquer dúvida, volte a postar aqui que a gente tenta resolver, até a próxima :)

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