50p, sorry Your script unfortunately not help me
This is video:
http://www.youtube.com/watch?v=kJc9qJWzj7Q
This is me script + Your code. Rotation is bad
local plr = getLocalPlayer();
local PEDEK
function greetingHandler ( ped )
PEDEK = ped
outputChatBox ( "działa" )
addEventHandler( "onClientRender", getRootElement(), firenow)
end
addEvent( "onGreeting", true )
addEventHandler( "onGreeting", getRootElement(), greetingHandler )
function firenow()
local x, y, z = getElementPosition( plr );
local X, Y = 0, 0;
local px, py, pz = getElementPosition( PEDEK );
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( PEDEK, faceMe );
setPedLookAt( PEDEK, x, y, z + .5 );
setPedAimTarget ( PEDEK, x, y, z )
setPedControlState( PEDEK, "fire", true)
end
Very pleas, help.
PS
My ped is bodyguard, in my house.