FatalTerror Posted January 6, 2012 Posted January 6, 2012 (edited) Hi, I want Move the ped of player as if he walked but i don't know if exist an function for it Possible ? Thanks Edited January 7, 2012 by Guest Paid developer. Twitter: @willia_am - http://www.williamdasilva.fr
Castillo Posted January 6, 2012 Posted January 6, 2012 You want to make a player walk or a ped? for peds: https://wiki.multitheftauto.com/wiki/SetPedControlState for players: https://wiki.multitheftauto.com/wiki/SetControlState San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
FatalTerror Posted January 6, 2012 Author Posted January 6, 2012 I want to player walk automatically of posA to posB I was without touching the keyboard Paid developer. Twitter: @willia_am - http://www.williamdasilva.fr
myonlake Posted January 6, 2012 Posted January 6, 2012 Read what solidsnake told you. If I helped you, please click the like button on the right Thanks!
FatalTerror Posted January 7, 2012 Author Posted January 7, 2012 Ye i see but it don't give me how move him to x, y and z positions Paid developer. Twitter: @willia_am - http://www.williamdasilva.fr
myonlake Posted January 7, 2012 Posted January 7, 2012 getPedRotation setPedRotation setTimer If I helped you, please click the like button on the right Thanks!
FatalTerror Posted January 7, 2012 Author Posted January 7, 2012 getPedRotation setPedRotation setTimer This don't help me addEventHandler("onClientClick", getRootElement(), function( button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement ) if(button == "left")then if(state == "down")then local x, y, z = worldX, worldY, worldZ if x and y and z then -- Move the player to x, y and z end end end) Paid developer. Twitter: @willia_am - http://www.williamdasilva.fr
JR10 Posted January 7, 2012 Posted January 7, 2012 function findRotation ( posX , posY , _posX , _posY ) return 360 - ( math.deg ( math.atan2 ( _posX - posX , _posY - posY ) ) % 360 ) end Will get you the rotation to x,y,z addEventHandler("onClientClick", getRootElement(), function( button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement ) if(button == "left")then if(state == "down")then local x, y, z = worldX, worldY, worldZ if x and y and z then local posx , posy , posz = getElementPosition ( localPlayer ) local rot = findRotation ( posx , posy , x , y ) setPedRotation ( localPlayer , rot ) setControlState ( "forwards" , true ) end end end end) function findRotation ( startx , starty , endx , endy ) return 360 - ( math.deg ( math.atan2 ( endx - startx , endy - starty ) ) % 360 ) end Now you need to work something out for stopping him when he arrive. And prevent him from stopping due to obstacles. Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
FatalTerror Posted January 7, 2012 Author Posted January 7, 2012 function findRotation ( posX , posY , _posX , _posY ) return 360 - ( math.deg ( math.atan2 ( _posX - posX , _posY - posY ) ) % 360 ) end Will get you the rotation to x,y,z addEventHandler("onClientClick", getRootElement(), function( button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement ) if(button == "left")then if(state == "down")then local x, y, z = worldX, worldY, worldZ if x and y and z then local posx , posy , posz = getElementPosition ( localPlayer ) local rot = findRotation ( posx , posy , x , y ) setPedRotation ( localPlayer , rot ) setControlState ( "forwards" , true ) end end end end) function findRotation ( startx , starty , endx , endy ) return 360 - ( math.deg ( math.atan2 ( endx - startx , endy - starty ) ) % 360 ) end Now you need to work something out for stopping him when he arrive. And prevent him from stopping due to obstacles. Big thanks ! Paid developer. Twitter: @willia_am - http://www.williamdasilva.fr
JR10 Posted January 7, 2012 Posted January 7, 2012 You're welcome. Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
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