-.Paradox.- Posted June 24, 2013 Share Posted June 24, 2013 Hello, I need a resource that if player skin id is 10 his walking style set to 132, i have this resource but i want it without command i mean work automatically addCommandHandler ("s", function ( ped ) setPedWalkingStyle ( 10, 132) end ) Thanks for helping Link to comment
Castillo Posted June 24, 2013 Share Posted June 24, 2013 addEventHandler ( "onElementModelChange", root, function ( _, newModel ) if ( newModel == 132 ) then setPedWalkingStyle ( source, 10 ) else setPedWalkingStyle ( source, 0 ) end end ) This will set it when your skin changes. Link to comment
-.Paradox.- Posted June 24, 2013 Author Share Posted June 24, 2013 Thanks, and can i add one more skin id 45 walking style 118 ? Link to comment
Castillo Posted June 24, 2013 Share Posted June 24, 2013 Yes, you can use 'elseif' statements for that. Link to comment
iMr.3a[Z]eF Posted June 24, 2013 Share Posted June 24, 2013 addEventHandler ( "onElementModelChange", root, function ( _, newModel ) if ( newModel == 132 ) then setPedWalkingStyle ( source, 10 ) else setPedWalkingStyle ( source, 0 ) end end ) This will set it when your skin changes. he want to set the walking style whem he write on console "s" addEventHandler ( "onElementModelChange", root, addCommandHandler ( "s", function ( _, newModel ) if ( newModel == 132 ) then setPedWalkingStyle ( source, 10 ) else setPedWalkingStyle ( source, 0 ) end end ) ) Link to comment
-.Paradox.- Posted June 24, 2013 Author Share Posted June 24, 2013 addEventHandler ( "onElementModelChange", root, function ( _, newModel ) if ( newModel == 132 ) then setPedWalkingStyle ( source, 10 ) else setPedWalkingStyle ( source, 0 ) end elseif ( newModel == 118 ) then setPedWalkingStyle ( source, 45 ) else setPedWalkingStyle ( source, 0 ) end end ) like that Link to comment
Castillo Posted June 24, 2013 Share Posted June 24, 2013 addEventHandler ( "onElementModelChange", root, function ( _, newModel ) if ( newModel == 132 ) then setPedWalkingStyle ( source, 10 ) else setPedWalkingStyle ( source, 0 ) end end ) This will set it when your skin changes. he want to set the walking style whem he write on console "s" addEventHandler ( "onElementModelChange", root, addCommandHandler ( "s", function ( _, newModel ) if ( newModel == 132 ) then setPedWalkingStyle ( source, 10 ) else setPedWalkingStyle ( source, 0 ) end end ) ) Would you please read the topic? i have this resource but i want it without command i mean work automatically @Mr.X001: addEventHandler ( "onElementModelChange", root, function ( _, newModel ) if ( newModel == 132 ) then setPedWalkingStyle ( source, 10 ) elseif ( newModel == 118 ) then setPedWalkingStyle ( source, 45 ) else setPedWalkingStyle ( source, 0 ) end end ) Link to comment
-.Paradox.- Posted June 24, 2013 Author Share Posted June 24, 2013 thanks it work fine You are the best Castillo Link to comment
ixjf Posted June 24, 2013 Share Posted June 24, 2013 Having a couple of if/elseif-statements is pointless. local theModel = ( ( newModel == 132 ) and 10 ) or ( ( newModel == 118 ) and 45 ) or 0 setPedWalkingStyle( source, theModel ) Link to comment
Castillo Posted June 24, 2013 Share Posted June 24, 2013 Well, I gave him one method, which would be easier to understand to him. He also could have used tables. Link to comment
-.Paradox.- Posted June 25, 2013 Author Share Posted June 25, 2013 when i use on addEventHandler ( "onElementModelChange", root, function ( _, newModel ) if ( newModel == 132 ) then setPedWalkingStyle ( source, 10 ) else setPedWalkingStyle ( source, 0 ) end end ) It works but when i add addEventHandler ( "onElementModelChange", root, function ( _, newModel ) if ( newModel == 132 ) then setPedWalkingStyle ( source, 10 ) elseif ( newModel == 118 ) then setPedWalkingStyle ( source, 45 ) else setPedWalkingStyle ( source, 0 ) end end ) Dont work Link to comment
Castillo Posted June 25, 2013 Share Posted June 25, 2013 local skins = { [ 132 ] = 10, [ 118 ] = 45 } addEventHandler ( "onElementModelChange", root, function ( _, newModel ) setPedWalkingStyle ( source, skins [ newModel ] or 0 ) end ) Try it. Link to comment
-.Paradox.- Posted June 26, 2013 Author Share Posted June 26, 2013 when i set skin it show walking style but in a few seconds it get removed Link to comment
Castillo Posted June 26, 2013 Share Posted June 26, 2013 Well, that's strange... maybe you have an script reseting it. Link to comment
Castillo Posted June 27, 2013 Share Posted June 27, 2013 I've tested it on my server and setPedWalkingStyle is always returning 'false'. Link to comment
-.Paradox.- Posted June 27, 2013 Author Share Posted June 27, 2013 So what's the problem ? 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