Jump to content

[SLOVED]How to Smooth move Player to Ped?


Recommended Posts

Posted (edited)

i want to set Player position to ped smoothly

i try setElementPosition it warp player to ped, not moving smoothly, have any solution?

sloved

You can create object and set the alpha to zero and disable the collisions and attach the ped to the object and then you can use moveObject.

Edited by Guest
Posted

Do you mean like the screen fading out and set the player to the ped position and then fade in?

fadeCamera(player,false,3) 
setElementPosition(player,x,y,z) 
fadeCamera(player,true,3) 

Posted
Do you mean like the screen fading out and set the player to the ped position and then fade in?
fadeCamera(player,false,3) 
setElementPosition(player,x,y,z) 
fadeCamera(player,true,3) 

No, I mean move player position by step until to finish position like moveObject function but it can't use with player.

Posted
getElementPosition (player) 
setElementPosition (player,x,y,z-2) 
setTimer 

what is x y z come from , Now i have problem how to

move player to the ped direction? It's move to wrong direction.

Posted (edited)

Sorry forget something

Is the ped far away from the player?.

And the correct function i was mean is:

local x,y,z = getElementPosition (player) 
setTimer(setElementPosition (player,x,y,z-2), 1000, 0) 

This function is move the player next to him every second.

Or use setPedWalkingStyle.

Edited by Guest
Posted

Ex: for move player and edit it for ped :D

addCommandHandler('set', 
function(player) 
setTimer(function() 
local x,y,z = getElementPosition(player) 
setElementPosition(player,x,y-2,z) 
        end,50,0 
        ) 
    end 
) 
Posted
Ex: for move player and edit it for ped :D

addCommandHandler('set', 
function(player) 
setTimer(function() 
local x,y,z = getElementPosition(player) 
setElementPosition(player,x,y-2,z) 
        end,50,0 
        ) 
    end 
) 

What is the player type?.

Posted
Ex: for move player and edit it for ped :D

addCommandHandler('set', 
function(player) 
setTimer(function() 
local x,y,z = getElementPosition(player) 
setElementPosition(player,x,y-2,z) 
        end,50,0 
        ) 
    end 
) 

What is the player type?.

?? What ??

this code got the position and set the y -2 for the timer.

And 'player' it's defined in the event.

Posted
What event are you talking about?

You're using command handler.

Test the code and tell me :wink:

and please don't post before read the wiki.

player playerSource, string commandName, [string arg1, string arg2, ...] 
Posted
Sorry forget something

Is the ped far away from the player?.

And the correct function i was mean is:

local x,y,z = getElementPosition (player) 
setTimer(setElementPosition (player,x,y,z-2), 1000, 0) 

This function is move the player next to him every second.

Or use setPedWalkingStyle.

distance between ped and player is 5-10 and i have the both position

ex.

pedX,pedY,pedZ = getElementPosition(ped) 
X,Y,Z = getElementPosition(player) 

i try setTimer, but i don't know how to move player to ped's position

Posted
Do you mean like the screen fading out and set the player to the ped position and then fade in?
fadeCamera(player,false,3) 
setElementPosition(player,x,y,z) 
fadeCamera(player,true,3) 

No, I mean move player position by step until to finish position like moveObject function but it can't use with player.

You can create object and set the alpha to zero and disable the collisions and attach the ped to the object and then you can use moveObject.

Posted
You can create object and set the alpha to zero and disable the collisions and attach the ped to the object and then you can use moveObject.

Smart idea, but he said he want to move the player to the ped.

oh, i was mean player not ped how did i said ped, typo mistake. :|

Posted
You can create object and set the alpha to zero and disable the collisions and attach the ped to the object and then you can use moveObject.

Smart idea, but he said he want to move the player to the ped.

oh, i was mean player not ped how did i said ped, typo mistake. :|

wow, it's work! thanks you very much TAPL :D very good idea

i never know that player can attach -0-

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