What is wrong with my script? I'd like my ped to rotate but it doesn't..

Recommended Posts

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
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") 

function HandleTheRendering()
       addEventHandler("onClientRender",getRootElement(), NPCnametag)
addEventHandler("onClientResourceStart",resourceRoot, HandleTheRendering)

Share this post

Link to post

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.