Jump to content

Question about "Bind"


itHyperoX

Recommended Posts

Posted (edited)

Hi. I made a script, player can change hes walking styles. But when i'm alt +tabing, and heading back to MTA,  the player again run. What can i do?

 

Here is the code. 

addEvent("swatWalking",true) 
addEventHandler("swatWalking",root, 
function()
outputChatBox("#FFFFFFYou changed your walking style to #D75959'SWAT'.",source,255,255,255,true)
setPedWalkingStyle(source, 118)
setElementData(source,"account:WalkingStyle",118)
if getElementData(source,"walking") == true then
setControlState(source,"walk",true)
end
end)

 

Edited by TheMOG
Posted (edited)

Disable sprinting if he is not holding space.

setControlState(localPlayer, "sprint", false)

bindKey("space", "both", function()
	if getKeyState("space") then
		setPedControlState(localPlayer, "sprint", true)
	else
		setPedControlState(localPlayer, "sprint", false)
	end
end)

Should work, not tested tho.

Edited by NeXuS™

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