Ivan Orel Posted July 20, 2018 Share Posted July 20, 2018 How to make Walking Style for specific skin (player)? Link to comment
KaMi Posted July 20, 2018 Share Posted July 20, 2018 2 minutes ago, Ivan Orel said: How to make Walking Style for specific skin (player)? use onElementModelChange and setPedWalkingStyle this is an example function changeWalkingStyle(oldModel,newModel) if ( getElementType(source) == "player" ) then if ( newModel == 152 ) then setPedWalkingStyle( source, 133 ) end end end addEventHandler("onElementModelChange", root, changeWalkingStyle) Link to comment
Ivan Orel Posted July 20, 2018 Author Share Posted July 20, 2018 13 minutes ago, <~KaMiKaZe~> said: use onElementModelChange and setPedWalkingStyle this is an example function changeWalkingStyle(oldModel,newModel) if ( getElementType(source) == "player" ) then if ( newModel == 152 ) then setPedWalkingStyle( source, 133 ) end end end addEventHandler("onElementModelChange", root, changeWalkingStyle) doesn't work Link to comment
KaMi Posted July 20, 2018 Share Posted July 20, 2018 1 minute ago, Ivan Orel said: doesn't work You put it in the server-side ? Link to comment
Ivan Orel Posted July 20, 2018 Author Share Posted July 20, 2018 1 minute ago, <~KaMiKaZe~> said: You put it in the server-side ? on client-side Link to comment
KaMi Posted July 20, 2018 Share Posted July 20, 2018 7 minutes ago, Ivan Orel said: on client-side Put that on server-side. There is no "onClientElementModelChange" Link to comment
Ivan Orel Posted July 20, 2018 Author Share Posted July 20, 2018 7 minutes ago, <~KaMiKaZe~> said: Put that on server-side. There is no "onClientElementModelChange" I Put that on server-side, so... Doesn't work Link to comment
KaMi Posted July 20, 2018 Share Posted July 20, 2018 2 minutes ago, Ivan Orel said: I Put that on server-side, so... Doesn't work That only works if you write " /ss 152 ". It's not programmed for every skin. It's only an example Link to comment
Ivan Orel Posted July 20, 2018 Author Share Posted July 20, 2018 18 minutes ago, <~KaMiKaZe~> said: That only works if you write " /ss 152 ". It's not programmed for every skin. It's only an example I do not want to use the command. I want this to happen automatically. Link to comment
KaMi Posted July 20, 2018 Share Posted July 20, 2018 3 minutes ago, Ivan Orel said: I do not want to use the command. I want this to happen automatically. That is automatic. When the player has the skin, their walk style going to change. Link to comment
Ivan Orel Posted July 20, 2018 Author Share Posted July 20, 2018 Just now, <~KaMiKaZe~> said: That is automatic. When the player has the skin, their walk style going to change. I change skin from freeroam and admin panel and doesn't work. Link to comment
KaMi Posted July 20, 2018 Share Posted July 20, 2018 3 minutes ago, Ivan Orel said: I change skin from freeroam and admin panel and doesn't work. Hmm, i really don't know. The code works perfectly on my test server Link to comment
Rockyz Posted July 22, 2018 Share Posted July 22, 2018 function changeWalkingStyle(_, changeModel, _, _, _, spawnModel) local skin = eventName == 'onElementModelChange' and changeModel or (eventName == 'onPlayerSpawn' and spawnModel) local model, walkingStyle = 0, 121; if skin then if getElementType(source) == 'player' then if skin == model then setPedWalkingStyle(source, walkingStyle) else setPedWalkingStyle(source, 0) end end else for _, player in ipairs(getElementsByType('player')) do if getElementModel(player) == model then setPedWalkingStyle(player, walkingStyle) else setPedWalkingStyle(player, 0) end end end end addEventHandler('onElementModelChange', root, changeWalkingStyle) addEventHandler('onPlayerSpawn', root, changeWalkingStyle) addEventHandler('onResourceStart', root, changeWalkingStyle) Link to comment
JeViCo Posted July 23, 2018 Share Posted July 23, 2018 I think it should work: pedwalk = { --[model id] = ped walking style, [0] = 121, } function style(_, skin,_,_,_,skin2) if eventName == "onResourceStart" then for _, player in ipairs(getElementsByType('player')) do setStyle(pl) end elseif eventName == "onElementModelChange" then if getElementType(pl) == "player" or getElementType(pl) == "ped" then setStyle(source,skin) end elseif eventName == "onPlayerSpawn" then setStyle(source,skin2) end end addEventHandler('onResourceStart', root, style) addEventHandler('onElementModelChange', root, style) addEventHandler('onPlayerSpawn', root, style) function setStyle(pl,b) if getElementType(pl) == "player" then -- only for players if not b then b = getElementModel(pl) end -- check if no skin here if pedwalk[b] setPedWalkingStyle(pl, pedwalk[b]) end end end 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