Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local picking, testMarker, zDifference
- function pickPosition()
- if (not picking) then
- return false
- end
- if (not isCursorShowing()) then
- return false
- end
- local dumpx, dumpy, worldX, worldY, worldZ = getCursorPosition()
- local px, py, pz = getCameraMatrix()
- local hit, x, y, z, elementHit = processLineOfSight(px, py, pz, worldX, worldY, worldZ)
- if (not hit) then
- return false
- end
- z = z + zDifference
- if (getKeyState("mouse1")) then
- local zone, city = getZoneName(x, y, z), getZoneName(x, y, z, true)
- outputChatBox(x .. " " .. y .. " " .. z)
- outputChatBox(zone .. ", " .. city)
- toggleListening()
- createMarker(x, y, z, "cylinder")
- return true
- elseif (getKeyState("num_8")) then
- zDifference = zDifference + 0.01
- elseif (getKeyState("num_2")) then
- zDifference = zDifference - 0.01
- end
- setElementPosition(testMarker, x, y, z)
- local text = "X: " .. x .. ", Y: " .. y .. ", Z: " .. z
- dxDrawText(text, 0, 0, 0, 0)
- end
- function toggleListening()
- picking = not picking
- if (picking) then
- showCursor(false)
- outputDebugString("Stopped picking")
- picking = false
- destroyElement(testMarker)
- testMarker = nil
- return false
- end
- showCursor(true)
- testMarker = createMarker(0, 0, 0, "corona", 0.15, 255, 0, 0)
- removeEventHandler("onClientRender", root, pickPosition)
- addEventHandler("onClientRender", root, pickPosition)
- outputDebugString("Started picking")
- picking = true
- zDifference = 0
- end
- addCommandHandler("tc", toggleListening)
Advertisement
Add Comment
Please, Sign In to add comment