I wanted to make a few adjustments to Scammers release.
Street Name Display v2
Displays the street name the player is currently on and the direction of the player over the minimap. Also you can disable this by switching showCompass from true to false.
Thanks to @Marxy for providing help.
V2: added direction text
Download
I added zones but I want to go further and hide the location when not in a vehicle. I managed to get it to hide when I leave the vehicle but the Street Name seemed to stay:
Here’s what I have so far (I’m new to scripting):
-- CONFIG --
local showCompass = false
-- CODE --
local lastStreet = nil
local zones = { ['AIRP'] = "Los Santos International Airport" --There's more but I thought i'd save you the scrolling for every zone.
Citizen.CreateThread(function()
while true do
Citizen.Wait(1)
lastStreetName = ""
x, y, z = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
lastStreet = GetStreetNameAtCoord(x, y, z)
lastStreetName = GetStreetNameFromHashKey(lastStreet)
lastZone = zones[GetNameOfZone(x, y, z)]
SetTextFont(4)
SetTextProportional(1)
SetTextScale(0.0, 0.45)
SetTextColour(255, 255, 255, 255)
SetTextDropshadow(0, 0, 0, 0, 255)
SetTextEdge(1, 0, 0, 0, 255)
SetTextDropShadow()
SetTextOutline()
SetTextEntry("STRING")
if showCompass then
compass = getCardinalDirectionFromHeading(GetEntityHeading(GetPlayerPed(-1)))
lastStreetName = compass .. " | " ..lastStreetName.. " | " .. lastZone
end
AddTextComponentString(lastStreetName)
DrawText(0.169, 0.96)
end
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
ped = GetPlayerPed(source)
if IsPedInAnyVehicle(ped) then
showCompass = true
else
showCompass = false
end
end
end)
Any help would be appreciated!
Try this:
Citizen.CreateThread(function()
while true do
Citizen.Wait(1)
lastStreetName = ""
x, y, z = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
lastStreet = GetStreetNameAtCoord(x, y, z)
lastStreetName = GetStreetNameFromHashKey(lastStreet)
lastZone = zones[GetNameOfZone(x, y, z)]
SetTextFont(4)
SetTextProportional(1)
SetTextScale(0.0, 0.45)
SetTextColour(255, 255, 255, 255)
SetTextDropshadow(0, 0, 0, 0, 255)
SetTextEdge(1, 0, 0, 0, 255)
SetTextDropShadow()
SetTextOutline()
SetTextEntry("STRING")
if showCompass then
compass = getCardinalDirectionFromHeading(GetEntityHeading(GetPlayerPed(-1)))
lastStreetName = compass .. " | " ..lastStreetName.. " | " .. lastZone
AddTextComponentString(lastStreetName)
DrawText(0.169, 0.96)
end
end
end)
Put all of the things you want to draw when in a vehicle or whatever inside of the loop, otherwise you are calculating all of the stuff when it isnt necessary. Also, use labels for the zone names so that they change appropriately and dont need a giant table of all names.
It worked! Thank you for the help!
Yeah I knew it was bad and planned on doing that after the hiding was figured out. Thanks for the additional information.