Jump to content

Alternative for getPedWalkingStyle


..:D&G:..

Recommended Posts

  • Moderators
Posted
setPedAnimation 

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted

I added those functions into my code, but it still doesn't change my walking style:

elseif (source) then 
            outputChatBox("on." source) 
            setPedWalkingStyle(source, 138) 
        if getPedWalkingStyle(source) then 
            outputChatBox("off." source) 
            setPedWalkingStyle(source, 0) 
        end 

76561198066470453.png

SP37Ecj.jpg?2MTA:Rust Pre-Alpha Build v.0.3:SP37Ecj.jpg?2

https://forum.mtasa.com/viewtopic.php?f=114&t=97848

2Pac: ''Only God can judge me!''

Posted

getPedWalkingStyle function will always return a value so I will set you walking style 0. Exactly, what are you trying to do?

State: Inactive

Posted
elseif (source) then 
        if getPedWalkingStyle(source) ~= 138 then 
            outputChatBox("on.", source) 
            setPedWalkingStyle(source, 138) 
        else 
            outputChatBox("off." ,source) 
            setPedWalkingStyle(source, 0) 
        end 

State: Inactive

Posted

You can store the info of the walking style on a data, e.g setAccountData.

  
function putWalkingStyle(player,_,number) 
if tonumber(number) == nil then return end 
setPedWalkingStyle(player,138) 
setAccountData(getPlayerAccount(player),"WalkingStyle",tonumber(number)) 
else 
outputChatBox("Syntax: /walkstyle ",player,255,0,0) 
end 
end  
addCommandHandler("walkstyle",putWalkingStyle) 
function WhatsMyWalkingStyle(player) 
if getAccountData(getPlayerAccount(player),"WalkingStyle") ~= false then 
outputChatBox("Your walking style is: "..getAccountData(getPlayerAccount(player),"WalkingStyle",player) 
else 
outputChatBox("You don't have a walking style, use /walkstyle ",player,255,0,0) 
end 
end 
addCommandHandler("whatsmywalkstyle",WhatsMyWalkingStyle) 
  

Currently developing for International Gaming Community - Join us!

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