kieran Posted July 2, 2017 Posted July 2, 2017 So I been messing with peds movement and can't seem to figure out what I'm doing wrong... Basically I am trying to make a simple script that makes a local ped run in a big square... function forwards() local x, y, z = getElementPosition(localPlayer) local myPed = createPed(0, x + 1, y, z) if myPed then setPedControlState(myPed,"forwards", true) setTimer ( function () setPedControlState(myPed,"forwards", false) --if this line is taken out he runs diagonal setPedControlState(myPed,"right", true) end, 10000, 1 ) --trying to set it on timers setTimer ( function () setPedControlState(myPed,"backwards", true) --problem making him go backwards, he runs diagonally and if right is false here it doesn't work end, 10000, 1 ) end end addCommandHandler("ped",forwards) --command since I am testing just now Is the problem that I don't have anything to check if control state is true or false?
DNL291 Posted July 3, 2017 Posted July 3, 2017 What are you trying to do exactly? By looking at the code, it looks like you're making the ped go backwards at the same time he should go to the right. Please do not PM me with scripting related question nor support, use the forums instead.
kieran Posted July 4, 2017 Author Posted July 4, 2017 So I should set right to false on third controlstate? Basically trying to make a ped automatically move clientside... So trying to time the control states and make him run round
Moderators IIYAMA Posted July 4, 2017 Moderators Posted July 4, 2017 Use: setPedCameraRotation Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
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