Annymeols Posted March 1, 2019 Share Posted March 1, 2019 hello guys, i've got script to change players style to sneak but when i press alt and moving its shown like bad can anyone help me to make the running like default with sneak style? Link to comment
Moderators Patrick Posted March 1, 2019 Moderators Share Posted March 1, 2019 30 minutes ago, Annymeols said: hello guys, i've got script to change players style to sneak but when i press alt and moving its shown like bad can anyone help me to make the running like default with sneak style? Every walking style have different "sneak style". Link to comment
Annymeols Posted March 1, 2019 Author Share Posted March 1, 2019 5 hours ago, stPatrick said: Every walking style have different "sneak style". i know but as i see in other servers they can edit it and much servers change the running of sneak style Link to comment
Mr.Loki Posted March 1, 2019 Share Posted March 1, 2019 local walkTable = {} function toggleSneak( player, _, state ) if state == "down" then -- if the player presses the walk key down. walkTable[player] = getPedWalkingStyle( player ) -- save the current player's walkstyle to the walkTable table. setPedWalkingStyle( player, 69 ) -- change the walkstyle. else -- if the player releases the key. setPedWalkingStyle( player, walkTable[player] ) -- restore the walkstyle to the original on release. walkTable[player] = nil -- remove the player from the table. end end -- Bind the function to walk key for every player in the server when resource starts. addEventHandler( "onResourceStart", resourceRoot, function( ) for _,player in pairs(getElementsByType'player') do bindKey(player,"walk","both",toggleSneak) end end ) -- Bind the function to walk key when player joins. addEventHandler( "onPlayerJoin", root, function( ) bindKey(source,"walk","both",toggleSneak) end ) Link to comment
Annymeols Posted March 1, 2019 Author Share Posted March 1, 2019 (edited) 15 minutes ago, Mr.Loki said: local walkTable = {} function toggleSneak( player, _, state ) if state == "down" then -- if the player presses the walk key down. walkTable[player] = getPedWalkingStyle( player ) -- save the current player's walkstyle to the walkTable table. setPedWalkingStyle( player, 69 ) -- change the walkstyle. else -- if the player releases the key. setPedWalkingStyle( player, walkTable[player] ) -- restore the walkstyle to the original on release. walkTable[player] = nil -- remove the player from the table. end end -- Bind the function to walk key for every player in the server when resource starts. addEventHandler( "onResourceStart", resourceRoot, function( ) for _,player in pairs(getElementsByType'player') do bindKey(player,"walk","both",toggleSneak) end end ) -- Bind the function to walk key when player joins. addEventHandler( "onPlayerJoin", root, function( ) bindKey(source,"walk","both",toggleSneak) end ) i think you didnt got me i mean the running mode of sneak like when you u press alt and moving with sneak style ped moving slowly anyway thank you for trying to help me Edited March 1, 2019 by Annymeols Link to comment
Mr.Loki Posted March 1, 2019 Share Posted March 1, 2019 (edited) You can just invert the function. Change 69 to 0 in the toggleSneak function. My bad. Edited March 1, 2019 by Mr.Loki Link to comment
Annymeols Posted March 2, 2019 Author Share Posted March 2, 2019 (edited) 8 hours ago, Mr.Loki said: You can just invert the function. Change 69 to 0 in the toggleSneak function. My bad. but if i did that the player cant move faster with weapon like the sneak style i just want the sneak style with the default running of default you got me? Edited March 2, 2019 by Annymeols 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