Skip to content

Instantly share code, notes, and snippets.

@nullvariable
Created April 23, 2022 17:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nullvariable/535d3182a1a03c623dc3667ecd447b16 to your computer and use it in GitHub Desktop.
Save nullvariable/535d3182a1a03c623dc3667ecd447b16 to your computer and use it in GitHub Desktop.
debug height or whatever
function DrawText3Ds(x, y, z, text)
SetTextScale(0.35, 0.35)
SetTextFont(4)
SetTextProportional(1)
SetTextColour(255, 255, 255, 215)
SetTextEntry("STRING")
SetTextCentre(true)
AddTextComponentString(text)
SetDrawOrigin(x,y,z, 0)
DrawText(0.0, 0.0)
local factor = (string.len(text)) / 370
DrawRect(0.0, 0.0+0.0125, 0.017+ factor, 0.03, 0, 0, 0, 75)
ClearDrawOrigin()
end
function DrawHudText(text,colour,coordsx,coordsy,scalex,scaley)
SetTextFont(4)
SetTextProportional(7)
SetTextScale(scalex, scaley)
local colourr,colourg,colourb,coloura = table.unpack(colour)
SetTextColour(colourr,colourg,colourb, coloura)
SetTextDropshadow(0, 0, 0, 0, coloura)
SetTextEdge(1, 0, 0, 0, coloura)
SetTextDropShadow()
SetTextOutline()
SetTextEntry("STRING")
AddTextComponentString(text)
DrawText(coordsx,coordsy)
end
Citizen.CreateThread(function()
while true do
Wait(0)
local x, y, z = table.unpack(GetEntityCoords(PlayerPedId()))
-- DrawText3Ds(x, y, z+1.0, json.encode({GetFollowVehicleCamViewMode(), GetFollowPedCamViewMode()}))
local context = GetCamActiveViewModeContext()
-- local text = json.encode({GetCamViewModeForContext(context), GetFollowVehicleCamViewMode(), debugX, debugY})
local text = GetEntityHeightAboveGround(PlayerPedId())
DrawHudText(text, {255,255,255, 255}, 0.015, 0.3, 0.5, 0.5)
end
end)
function DrawText3Ds(x, y, z, text)
SetTextScale(0.35, 0.35)
SetTextFont(4)
SetTextProportional(1)
SetTextColour(255, 255, 255, 215)
SetTextEntry("STRING")
SetTextCentre(true)
AddTextComponentString(text)
SetDrawOrigin(x,y,z, 0)
DrawText(0.0, 0.0)
local factor = (string.len(text)) / 370
DrawRect(0.0, 0.0+0.0125, 0.017+ factor, 0.03, 0, 0, 0, 75)
ClearDrawOrigin()
end
function DrawHudText(text,colour,coordsx,coordsy,scalex,scaley)
SetTextFont(4)
SetTextProportional(7)
SetTextScale(scalex, scaley)
local colourr,colourg,colourb,coloura = table.unpack(colour)
SetTextColour(colourr,colourg,colourb, coloura)
SetTextDropshadow(0, 0, 0, 0, coloura)
SetTextEdge(1, 0, 0, 0, coloura)
SetTextDropShadow()
SetTextOutline()
SetTextEntry("STRING")
AddTextComponentString(text)
DrawText(coordsx,coordsy)
end
local max = 0
local debugX = 0
Citizen.CreateThread(function()
while true do
Wait(0)
-- local x, y, z = table.unpack(GetEntityCoords(PlayerPedId()))
-- DrawText3Ds(x, y, z+1.0, json.encode({GetFollowVehicleCamViewMode(), GetFollowPedCamViewMode()}))
-- local context = GetCamActiveViewModeContext()
-- local text = json.encode({GetCamViewModeForContext(context), GetFollowVehicleCamViewMode(), debugX, debugY})
local text = GetEntityHeightAboveGround(GetVehiclePedIsUsing(PlayerPedId()))
-- local text = tostring(debugX)
DrawHudText(text, {255,255,255, 255}, 0.015, 0.3, 0.5, 0.5)
if text > max then max = text end
DrawHudText(tostring(max), {255,0,0, 255}, 0.015, 0.325, 0.5, 0.5)
if IsControlJustReleased(0, 178) then max = 0 end
end
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment