bencskrisz Posted December 20, 2019 Share Posted December 20, 2019 local NPC = createPed(285,376.39947509766,-65.617164611816,1001.5078125) setElementInterior( NPC, 10 ) function NPCRotate ( ) local rotX, rotY, rotZ = getElementRotation(NPC) -- get the local players's rotation setElementRotation(NPC,0,0,rotZ+10,"default",true) -- turn the player 10 degrees clockwise end addCommandHandler ( "turn", NPCRotate ) local screenWidth, screenHeight = guiGetScreenSize() local range = 10 function NPCnametag() local x,y,z = getPedBonePosition(NPC,6) local px,py,pz = getElementPosition(localPlayer) if getDistanceBetweenPoints3D(x,y,z,px,py,pz) <= range then local sx,sy = getScreenFromWorldPosition(x,y,z) if sx then dxDrawText("Bob",sx,sy,sx,sy,tocolor ( 255, 255, 0, 255 ), 2,"sans") end end end function HandleTheRendering() addEventHandler("onClientRender",getRootElement(), NPCnametag) end addEventHandler("onClientResourceStart",resourceRoot, HandleTheRendering) Link to comment
Motar2k Posted December 20, 2019 Share Posted December 20, 2019 I don't see any errors. Try this setElementRotation(NCP,0,0,rotZ+10) Link to comment
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