Jump to content

processLineOfSight() Error


Mann56

Recommended Posts

Hey guys,

I am making a script which teleports a guy away from area 51 to random cords but when i used processLineOfSight to detect whether the land is aboveor below the player ( after the teleport , since i didnt change the z cord on teleport) but it just doesn't detect the hit. I want it to detect a world model but it doesn't detect leaving my player either below the world object or far above it after teleport. Can someone help me to detect world objects using processLineOfSight?

function detectProperPos(thePlayer) 
    local x,y,z = getElementPosition(thePlayer) 
    local hit,hitX,hitY,hitZ = processLineOfSight(x,y,z,x,y,z + 300,true,true,true,true,true,false,false,false,thePlayer,true) 
    if hit then 
        setElementPosition(thePlayer,hitX,hitY,hitZ) 
        setElementFrozen(thePlayer,false) 
    else 
        local shit,hitX,hitY,hitZ = processLineOfSight(x,y,z,x,y,z - 300,true,true,true,true,true,false,false,false,thePlayer,true) 
        if shit then 
            setElementPosition(thePlayer,hitX,hitY,hitZ) 
            setElementFrozen(thePlayer,false) 
            outputChatBox(hit) 
        else  
            outputChatBox("Fail") 
        end 
    end 
end 

Thanks,

Mann

Link to comment

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