plmqq Posted January 9, 2023 Share Posted January 9, 2023 Hello! I want to set different walking animations for different peds How it's can be done? Link to comment
Trust aka Tiffergan Posted January 9, 2023 Share Posted January 9, 2023 https://wiki.multitheftauto.com/wiki/SetPedWalkingStyle Link to comment
Shady1 Posted January 9, 2023 Share Posted January 9, 2023 (edited) 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 January 9, 2023 by Shady1 Link to comment
plmqq Posted January 9, 2023 Author Share Posted January 9, 2023 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
alex17" Posted January 9, 2023 Share Posted January 9, 2023 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
Shady1 Posted January 9, 2023 Share Posted January 9, 2023 (edited) 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 January 9, 2023 by Shady1 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now