Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ About a week ago I made a simple script to get the coordinates of a certain posi
- Press any arrow to move arround the marker.
- Press "PAGE UP" and "PAGE DOWN" to change to height of the marker.
- Press "'NUMPAD 4" and "NUMPAD 6" to rotate/change the heading of the marker.
- Press "NUMPAD +" and "NUMPAD -" to change the radius of the marker.
- Press "NUMPAD +" and "NUMPAD -" to change the marker style
- Press "Scroll Wheel Up" and "Scroll Wheel Down" to change the radius of the marker.
- Press "'ENTER" to save the position in the _positions.txt_ file (this one is located in the server folder, and it will be always cleared when you restart the server).

- You can also press "BACKSPACE" to cancel the process.
Expand Down
176 changes: 95 additions & 81 deletions client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ POSITIONS.marker.y = 0.0
POSITIONS.marker.z = 0.0
POSITIONS.marker.h = 0.0
POSITIONS.marker.r = 1.0
POSITIONS.marker.o = 1

POSITIONS.start = function ()
if POSITIONS.marker.active then return end
Expand Down Expand Up @@ -37,95 +38,108 @@ end
Citizen.CreateThread(function ()
while true do
Citizen.Wait(0)
if (IsControlJustReleased(1, 29)) then
POSITIONS.start()
end

if (IsControlPressed(1, 172)) then -- ARROW UP
POSITIONS.marker.x = POSITIONS.marker.x + 0.01
end

if (IsControlPressed(1, 173)) then -- ARROW DOWN
POSITIONS.marker.x = POSITIONS.marker.x - 0.01
end

if (IsControlPressed(1, 174)) then -- ARROW LEFT
POSITIONS.marker.y = POSITIONS.marker.y + 0.01
end

if (IsControlPressed(1, 175)) then -- ARROW RIGHT
POSITIONS.marker.y = POSITIONS.marker.y - 0.01
end

if (IsControlPressed(1, 10)) then -- PAGE UP
POSITIONS.marker.z = POSITIONS.marker.z + 0.01
end

if (IsControlPressed(1, 11)) then --PAGE DOWN
POSITIONS.marker.z = POSITIONS.marker.z - 0.01
end

if (IsControlPressed(1, 108)) then -- NUMPAD 4
POSITIONS.marker.h = POSITIONS.marker.h + 0.5
if POSITIONS.marker.h > 360 then
POSITIONS.marker.h = 0.0
elseif POSITIONS.marker.h < 0 then
POSITIONS.marker.h = 360.0
end
end

if (IsControlPressed(1, 109)) then -- NUMPAD 6
POSITIONS.marker.h = POSITIONS.marker.h - 0.5
if POSITIONS.marker.h > 360 then
POSITIONS.marker.h = 0.0
elseif POSITIONS.marker.h < 0 then
POSITIONS.marker.h = 360.0
end
end

if (IsControlPressed(1, 96)) then -- NUMPAD +
POSITIONS.marker.r = POSITIONS.marker.r + 0.05
Citizen.Wait(10)
end

if (IsControlPressed(1, 97)) then --NUMPAD -
POSITIONS.marker.r = POSITIONS.marker.r - 0.05
Citizen.Wait(10)
end

if (IsControlJustReleased(1, 176)) then -- ENTER
local text = "{x = "..POSITIONS.marker.x..", y = "..POSITIONS.marker.y..", z = "..POSITIONS.marker.z..", h = "..POSITIONS.marker.h..", r = "..POSITIONS.marker.r.."},"
subTitle(text)

TriggerServerEvent("position:s:insert", text)

POSITIONS.marker.x = 0.0
POSITIONS.marker.y = 0.0
POSITIONS.marker.z = 0.0
POSITIONS.marker.h = 0.0
POSITIONS.marker.active = false

subTitle("Position saved !")
end

if (IsControlJustReleased(1, 177)) then
POSITIONS.marker.x = 0.0
POSITIONS.marker.y = 0.0
POSITIONS.marker.z = 0.0
POSITIONS.marker.h = 0.0
POSITIONS.marker.active = false
end

if (IsControlJustReleased(1, 29)) then -- Press B
POSITIONS.start()
end

if(POSITIONS.marker.active) then
if (IsControlPressed(1, 172)) then -- ARROW UP
POSITIONS.marker.x = POSITIONS.marker.x + 0.01
end

if (IsControlPressed(1, 173)) then -- ARROW DOWN
POSITIONS.marker.x = POSITIONS.marker.x - 0.01
end

if (IsControlPressed(1, 174)) then -- ARROW LEFT
POSITIONS.marker.y = POSITIONS.marker.y + 0.01
end

if (IsControlPressed(1, 175)) then -- ARROW RIGHT
POSITIONS.marker.y = POSITIONS.marker.y - 0.01
end

if (IsControlPressed(1, 10)) then -- PAGE UP
POSITIONS.marker.z = POSITIONS.marker.z + 0.01
end

if (IsControlPressed(1, 11)) then --PAGE DOWN
POSITIONS.marker.z = POSITIONS.marker.z - 0.01
end

if (IsControlPressed(1, 108)) then -- NUMPAD 4
POSITIONS.marker.h = POSITIONS.marker.h + 0.5
if POSITIONS.marker.h > 360 then
POSITIONS.marker.h = 0.0
elseif POSITIONS.marker.h < 0 then
POSITIONS.marker.h = 360.0
end
end

if (IsControlPressed(1, 109)) then -- NUMPAD 6
POSITIONS.marker.h = POSITIONS.marker.h - 0.5
if POSITIONS.marker.h > 360 then
POSITIONS.marker.h = 0.0
elseif POSITIONS.marker.h < 0 then
POSITIONS.marker.h = 360.0
end
end

if (IsControlPressed(1, 181)) then -- Scroll Wheel Up +
POSITIONS.marker.r = POSITIONS.marker.r + 0.05
Citizen.Wait(10)
end

if (IsControlPressed(1, 180)) then --Scroll Wheel Up
POSITIONS.marker.r = POSITIONS.marker.r - 0.05
Citizen.Wait(10)
end

if (IsControlPressed(1, 314) and POSITIONS.marker.o < 43) then -- NUMPAD +
POSITIONS.marker.o = POSITIONS.marker.o + 1
Citizen.Wait(200)
end

if (IsControlPressed(1, 315) and POSITIONS.marker.o > 1) then --NUMPAD -
POSITIONS.marker.o = POSITIONS.marker.o - 1
Citizen.Wait(200)
end

if (IsControlJustReleased(1, 176)) then -- ENTER
local text = "{o = "..POSITIONS.marker.o..", x = "..POSITIONS.marker.x..", y = "..POSITIONS.marker.y..", z = "..POSITIONS.marker.z..", h = "..POSITIONS.marker.h..", r = "..POSITIONS.marker.r.."},"
subTitle(text)

TriggerServerEvent("position:s:insert", text)

POSITIONS.marker.x = 0.0
POSITIONS.marker.y = 0.0
POSITIONS.marker.z = 0.0
POSITIONS.marker.h = 0.0
POSITIONS.marker.active = false

subTitle("Position saved !")
end

if (IsControlJustReleased(1, 177)) then
POSITIONS.marker.x = 0.0
POSITIONS.marker.y = 0.0
POSITIONS.marker.z = 0.0
POSITIONS.marker.h = 0.0
POSITIONS.marker.active = false
end
end
end
end)

Citizen.CreateThread(function ()
while true do
Citizen.Wait(0)
if POSITIONS.marker.active then
DrawMarker(26, POSITIONS.marker.x, POSITIONS.marker.y, POSITIONS.marker.z, 0, 0, 0, 0, 0, POSITIONS.marker.h, POSITIONS.marker.r, POSITIONS.marker.r, 0.5, 0, 0, 255, 120, 0, 0, 2, 0, 0, 0, 0)
DrawMarker(POSITIONS.marker.o, POSITIONS.marker.x, POSITIONS.marker.y, POSITIONS.marker.z, 0, 0, 0, 0, 0, POSITIONS.marker.h, POSITIONS.marker.r, POSITIONS.marker.r, 0.5, 0, 0, 255, 120, 0, 0, 2, 0, 0, 0, 0)

local text = "{x = "..POSITIONS.marker.x..", y = "..POSITIONS.marker.y..", z = "..POSITIONS.marker.z..", h = "..POSITIONS.marker.h..", r = "..POSITIONS.marker.r.."},"
local text = "{o = "..POSITIONS.marker.o..", x = "..POSITIONS.marker.x..", y = "..POSITIONS.marker.y..", z = "..POSITIONS.marker.z..", h = "..POSITIONS.marker.h..", r = "..POSITIONS.marker.r.."},"
subTitle(text)
end
end
end)
end)