Jump to content

ped running style [help]


Recommended Posts

Posted

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?

  • Moderators
Posted
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".

Posted
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

Posted
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 )

 

Posted (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 by Annymeols
Posted (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 by Annymeols

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