Twisted. Posted July 10, 2017 Share Posted July 10, 2017 Hello guys, so basically i downloaded the Freeroam Script, and when i try to double click teleport with the map the screen goes black, If i change my skin with /ss, i get teleported to X 0 Y 0 Z 0. I turned on script debug mode. Error: WARNING: mfsz_fun/fr_client.lua:762: Bad argument @ 'processLineOfSight' [Expected vector 3 at argument 1, got nil] [DUP x11] Script: function setPlayerPosition(x, y, z) local elem = getPedOccupiedVehicle(g_Me) local distanceToGround local isVehicle if elem and getPedOccupiedVehicle(g_Me) then local controller = getVehicleController(elem) if controller and controller ~= g_Me then errMsg('Only the driver of the vehicle can set its position.') return false end distanceToGround = getElementDistanceFromCentreOfMassToBaseOfModel(elem) + 3 isVehicle = true else elem = g_Me distanceToGround = 0.4 isVehicle = false end local hit, hitX, hitY, hitZ = processLineOfSight(x, y, 3000, x, y, -3000) <-- LINE 762 if not hit then if isVehicle then server.fadeVehiclePassengersCamera(false) else fadeCamera(false) end if isTimer(g_TeleportMatrixTimer) then killTimer(g_TeleportMatrixTimer) end g_TeleportMatrixTimer = setTimer(setCameraMatrix, 1000, 1, x, y, z) if not grav then grav = getGravity() setGravity(0.001) end if isTimer(g_TeleportTimer) then killTimer(g_TeleportTimer) end g_TeleportTimer = setTimer( function() local hit, groundX, groundY, groundZ = processLineOfSight(x, y, 3000, x, y, -3000) if hit then local waterZ = getWaterLevel(x, y, 100) z = (waterZ and math.max(groundZ, waterZ) or groundZ) + distanceToGround if isPedDead(g_Me) then server.spawnMe(x, y, z) else server.setMyPos(x, y, z) end setCameraPlayerMode() setGravity(grav) if isVehicle then server.fadeVehiclePassengersCamera(true) else fadeCamera(true) end killTimer(g_TeleportTimer) g_TeleportTimer = nil grav = nil end end, 500, 0 ) else if isPedDead(g_Me) then server.spawnMe(x, y, z + distanceToGround) else server.setMyPos(x, y, z + distanceToGround) if isVehicle then setTimer(setElementVelocity, 100, 1, elem, 0, 0, 0) setTimer(setVehicleTurnVelocity, 100, 1, elem, 0, 0, 0) end end end end Link to comment
Simple0x47 Posted July 10, 2017 Share Posted July 10, 2017 Are you sure the function is always called with the required arguments, what about avoiding that warning function setPlayerPosition(x, y, z) if ( ( x ) and ( y ) and ( z ) ) then local elem = getPedOccupiedVehicle(g_Me) local distanceToGround local isVehicle if elem and getPedOccupiedVehicle(g_Me) then local controller = getVehicleController(elem) if controller and controller ~= g_Me then errMsg('Only the driver of the vehicle can set its position.') return false end distanceToGround = getElementDistanceFromCentreOfMassToBaseOfModel(elem) + 3 isVehicle = true else elem = g_Me distanceToGround = 0.4 isVehicle = false end local hit, hitX, hitY, hitZ = processLineOfSight(x, y, 3000, x, y, -3000) <-- LINE 762 if not hit then if isVehicle then server.fadeVehiclePassengersCamera(false) else fadeCamera(false) end if isTimer(g_TeleportMatrixTimer) then killTimer(g_TeleportMatrixTimer) end g_TeleportMatrixTimer = setTimer(setCameraMatrix, 1000, 1, x, y, z) if not grav then grav = getGravity() setGravity(0.001) end if isTimer(g_TeleportTimer) then killTimer(g_TeleportTimer) end g_TeleportTimer = setTimer( function() local hit, groundX, groundY, groundZ = processLineOfSight(x, y, 3000, x, y, -3000) if hit then local waterZ = getWaterLevel(x, y, 100) z = (waterZ and math.max(groundZ, waterZ) or groundZ) + distanceToGround if isPedDead(g_Me) then server.spawnMe(x, y, z) else server.setMyPos(x, y, z) end setCameraPlayerMode() setGravity(grav) if isVehicle then server.fadeVehiclePassengersCamera(true) else fadeCamera(true) end killTimer(g_TeleportTimer) g_TeleportTimer = nil grav = nil end end, 500, 0 ) else if isPedDead(g_Me) then server.spawnMe(x, y, z + distanceToGround) else server.setMyPos(x, y, z + distanceToGround) if isVehicle then setTimer(setElementVelocity, 100, 1, elem, 0, 0, 0) setTimer(setVehicleTurnVelocity, 100, 1, elem, 0, 0, 0) end end end end end . Link to comment
Twisted. Posted July 10, 2017 Author Share Posted July 10, 2017 (edited) Okay, these are the errors when i try to teleport, processLineOfSight is spamming always. function getControlText(...) <-- LINE 408 return guiGetText(getControl(...)) end function getControlNumber(...) return tonumber(guiGetText(getControl(...))) end function getControlNumbers(...) -- getControlNumbers(..., controlnames) -- ... = path to parent window -- controlnames: array of control names -- returns a list value1, value2, ... with the numbers entered in the specified controls local args = {...} local controlnames = table.remove(args) local result = {} for i,name in ipairs(controlnames) do result[i] = getControlNumber(unpack(args), name) end return unpack(result) end function setControlText(...) local args = {...} local text = table.remove(args) local element = getControl(unpack(args)) if (element and isElement(element) and text) then guiSetText(element, text) end end function setControlNumber(...) local args = {...} local num = table.remove(args) guiSetText(getControl(unpack(args)), tostring(num)) end function setControlNumbers(...) -- setControlNumbers(..., controlvalues) -- ... = path to parent window -- controlvalues: a table {controlname = value, ...} with the numbers to set the control texts to local args = {...} local controlvalues = table.remove(args) for name,value in pairs(controlvalues) do setControlNumber(unpack(args), name, value) end end <-- LINE 454 Edited July 10, 2017 by Twisted. 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