Jump to content

Set walking animations for skin ids


plmqq

Recommended Posts

7 hours ago, plmqq said:

Hello!
I want to set different walking animations for different peds

How it's can be done?

hello @plmqq , I have created a code according to your request, you can try

 

local PLAYER_WALKSTYLE = 22 --add a walking style you want
addEventHandler("onPlayerSpawn", root,
    function()
       setPedWalkingStyle(source, PLAYER_WALKSTYLE)
    end
)

 

and use meta.xml

<meta>

 <info type="script"/>

 <min_mta_version server="1.5" client="1.5" />

 <script src="skills.lua" type="server"/>

</meta>

 

Edited by Shady1
Link to comment
1 hour ago, Shady1 said:

hello @plmqq , I have created a code according to your request, you can try

 

local PLAYER_WALKSTYLE = 22 --add a walking style you want
addEventHandler("onPlayerSpawn", root,
    function()
       setPedWalkingStyle(source, PLAYER_WALKSTYLE)
    end
)

 

and use meta.xml

<meta>

 <info type="script"/>

 <min_mta_version server="1.5" client="1.5" />

 <script src="skills.lua" type="server"/>

</meta>

 

I need for example:

Skin id 280 will have 128 walking style

Skin id 84 will have 121 walking style

I need like this

Link to comment
4 hours ago, plmqq said:

I need for example:

Skin id 280 will have 128 walking style

Skin id 84 will have 121 walking style

I need like this

local styles = {
  [280] = 128,
  [84] = 121,

  }

addEventHandler("onPlayerSpawn", root, 
    function()
       local model = getElementModel(source)
       local style = styles[model]
       if style then 
          setPedWalkingStyle(source, style)
       end 
    end 
  )

 

Link to comment
1 hour ago, alex17" said:

 

hi @alex17", I think it would be better to update it every time the model changes instead of using onPlayerSpawn.

local styles = {
  [280] = 128,
  [84] = 121,

}

addEventHandler("onPlayerSpawn", root, 
    function()
       local model = getElementModel(source)
       if (styles[model]) then setPedWalkingStyle(source, styles[model]) end
    end 
  )

addEventHandler("onElementModelChange", root,
    function(_, newModel)
       if(getElementType(source) ~= "player") then return end
       if (styles[newModel]) then setPedWalkingStyle(source, styles[newModel]) end
    end
)

 

Edited by Shady1
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...