Jump to content

[Question] Ped movement


kieran

Recommended Posts

Posted

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?

Posted

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.

Posted

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 xD

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