Hi all and thanks for reading
Hopefuly an easy question.
I am trying to make some screenshots for a little project but I need a few peds stood around.I have tried adapting the community scripts but I am having no luck. All I want is to make a command that allows me to spawn a PED with the skin of my choice in the place where my player is currently standing and facing the same direction as the player. No need for it to move or anything just need it to stand there. Only important things are that it faces the same way as I am when I use the command and the ability to choose what skin it spawns with.
EDIT: So far I can make the peds spawn with my choice of skin but they always face the same direction no matter what I do?
the only real change I have made to the script is taking the follow player function out of MAKEPED.LUA from the PEDS resource ::: THIS BIT
addEventHandler( "onClientRender", getRootElement(),
function( )
if myPeds then
for k, ped in pairs( myPeds ) do
if ped then
local x, y, z = getElementPosition( plr );
local px, py, pz = getElementPosition( ped );
local distance = getDistanceBetweenPoints3D( x, y, z, px, py, pz )
if distance < 3.5 then
setPedControlState( ped, "aim_weapon", true );
setPedControlState( ped, "fire", false );
setPedControlState( ped, "fire", true );
setPedControlState( ped, "forwards", false );
if ( isPedDucked( plr ) ~= isPedDucked( ped ) ) then
setPedControlState( ped, "crouch", isPedDucked( getLocalPlayer( ) ));
--setPedControlState( myPed, "crouch", true );
return
end
else
setPedControlState( ped, "forwards", true );
if distance < 6.0 then
if isPedDucked( plr ) ~= isPedDucked( ped ) then
setPedControlState( ped, "crouch", false );
setPedControlState( ped, "crouch", true );
setPedControlState( ped, "walk", false );
setPedControlState( ped, "sprint", false );
return
else
setPedControlState( ped, "walk", true );
setPedControlState( ped, "sprint", false );
end
elseif distance < 10.0 then
setPedControlState( ped, "walk", false );
setPedControlState( ped, "sprint", true );
else
setPedControlState( ped, "walk", false );
setPedControlState( ped, "sprint", true );
end
local X, Y = 0, 0;
X = math.abs( x - px );
Y = math.abs( y - py );
faceMe = math.deg( math.atan2( Y , X ) );
--faceMe = ( 360 - math.deg ( math.atan2 ( ( px - x ), ( py - y ) ) ) ) % 360
if ( x >= px ) and ( y > py ) then -- north-east
faceMe = 90 - faceMe
elseif ( x <= px ) and ( y > py ) then -- north-west
faceMe = 270 + faceMe
elseif ( x >= px ) and ( y <= py ) then -- south-east
faceMe = 90 + faceMe
elseif ( x < px ) and ( y <= py ) then -- south-west
faceMe = 270 - faceMe
end
--guiSetText( label, tostring( faceMe ) );
setPedRotation( ped, faceMe );
setPedLookAt( ped, x, y, z + .5 );
end
end
end
end
end
)
Thank you for any replies.
This is resource I have tried adapting
https://community.multitheftauto.com/index.php?p=resources&s=details&id=285
and this
https://community.multitheftauto.com/index.php?p=resources&s=details&id=234