From de97c0239395fd9e20df2b86cc1f7185ae4874ac Mon Sep 17 00:00:00 2001 From: delucecc <31872986+delucecc@users.noreply.github.com> Date: Sat, 27 May 2023 16:50:25 -0700 Subject: [PATCH] init --- client/client.lua | 60 +++++++++++++++++++++++++++++++++++++++++++++++ config.lua | 5 ++++ fxmanifest.lua | 14 +++++++++++ readme.md | 13 ++++++++++ 4 files changed, 92 insertions(+) create mode 100644 client/client.lua create mode 100644 config.lua create mode 100644 fxmanifest.lua create mode 100644 readme.md diff --git a/client/client.lua b/client/client.lua new file mode 100644 index 0000000..9e2100e --- /dev/null +++ b/client/client.lua @@ -0,0 +1,60 @@ +local marker = nil +local markerCoords = nil +local distanceText = nil + +function CreateMarker(coords) + if DoesBlipExist(marker) then + RemoveBlip(marker) + end + marker = AddBlipForCoord(coords.x, coords.y, coords.z) + SetBlipSprite(marker, 1) + SetBlipDisplay(marker, 2) + SetBlipColour(marker, 2) + SetBlipAsShortRange(marker, true) + BeginTextCommandSetBlipName("STRING") + AddTextComponentString("Marker") + EndTextCommandSetBlipName(marker) + CreateThread(function() + while DoesBlipExist(marker) do + Wait(0) + DisplayDistance() + end + end) +end + +function MeasureDistance() + local playerPed = PlayerPedId() + local playerCoords = GetEntityCoords(playerPed) + local distance = GetDistanceBetweenCoords(playerCoords, markerCoords.x, markerCoords.y, markerCoords.z, true) + return distance +end + +function DisplayDistance() + local distance = MeasureDistance() + SetTextFont(0) + SetTextScale(0.5, 0.5) + SetTextColour(255, 255, 255, 255) + SetTextOutline() + SetTextEntry("STRING") + AddTextComponentString("Distance to marker: " .. distance) + DrawText(0.2, 0.8) +end + +function RemoveStuff() + function RemoveStuff() + if DoesBlipExist(marker) then + RemoveBlip(marker) + end + end +end + +RegisterCommand(Config.Place, function() + local playerPed = PlayerPedId() + local playerCoords = GetEntityCoords(playerPed) + markerCoords = playerCoords + CreateMarker(markerCoords) +end) + +RegisterCommand(Config.Remove, function() + RemoveStuff() +end) diff --git a/config.lua b/config.lua new file mode 100644 index 0000000..e9fbb69 --- /dev/null +++ b/config.lua @@ -0,0 +1,5 @@ +Config = {} + +Config.Place = 'placemarker' --Command to place marker +Config.Remove = 'removemarker' --Command to remove marker + diff --git a/fxmanifest.lua b/fxmanifest.lua new file mode 100644 index 0000000..fbbb9cf --- /dev/null +++ b/fxmanifest.lua @@ -0,0 +1,14 @@ +Description 'ngd-ruler | Nemesis Gaming Development' +author 'deluce#9077' +fx_version 'cerulean' +game 'gta5' + +shared_scripts { + "config.lua", +} + +client_scripts { + 'client/*.lua', + } + +lua54 'yes' diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..a4d0408 --- /dev/null +++ b/readme.md @@ -0,0 +1,13 @@ +# ngd-ruler + +![ngd-ruler](https://media.discordapp.net/attachments/1077462714902917171/1077462755902247034/Large-Banner.png) + + +**ngd-ruler** is a simple developer tool that uses puts a marker on the map and measures the distance between it and the player. + +www.nemesisgd.com + +https://discord.gg/AnXx2GVGcM + +![image](https://cdn.discordapp.com/attachments/1077462714902917171/1112165262448394280/ngd-ruler.png) +