This commit is contained in:
delucecc 2023-05-27 16:50:25 -07:00
commit de97c02393
4 changed files with 92 additions and 0 deletions

60
client/client.lua Normal file
View File

@ -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)

5
config.lua Normal file
View File

@ -0,0 +1,5 @@
Config = {}
Config.Place = 'placemarker' --Command to place marker
Config.Remove = 'removemarker' --Command to remove marker

14
fxmanifest.lua Normal file
View File

@ -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'

13
readme.md Normal file
View File

@ -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)