Jump to content

[HELP] setPedWalkingStyle


Backsage

Recommended Posts

Posted

Hello. I'm trying to set the player's walking style based on the skin, but it doesn't work.

Server side:

  
function skate() 
    local maleSkin = 99 
    local femSkin = 92 
    local skin = getElementModel(source) 
    if (skin == 92) or (skin == 99) then 
        setPedWalkingStyle(source,138)   
    end 
end 
addEventHandler("onResourceStart",root,skate) 
  

It only works via runcode when I do /run setPedWalkingStyle(root, 138)

I think it might be because of source, but I'm not sure what I should replace it with.

Edit: it's fixed. Just had to specify the players.

Edit 2: little bug

  
function skate2(_, newModel) 
    if (newModel == 99) then 
        setPedWalkingStyle(source,138)  
    elseif (newModel == 92) then 
        setPedWalkingStyle(source,138)  
    end 
end 
addEventHandler("onElementModelChange",root,skate2) 
  

It works when I change it to the girl skin via the F1 freerom panel, but not for the guy skin.

Posted
function skate2(_, newModel) 
    if (newModel == 99) or (newModel == 92) and (getElementType(source) == "player") then 
        setPedWalkingStyle(source, 138) 
    end 
end 
addEventHandler("onElementModelChange", root, skate2) 

  • Like 1

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