OnRenderHUD

From Onset Developer Wiki
OnRenderHUD

Type: Event
Context: Client
Introduced: v1.0

Description

This function is called every time the HUD is rendered for the player. This function can be used as a game tick event.

Syntax

OnRenderHUD()

Example

https://github.com/BlueMountainsIO/OnsetLuaScripts/blob/master/horizon/client/esp.lua

local EnableESP = 0

function SetEnableESP(enable)
	EnableESP = enable
end
AddRemoteEvent("SetEnableESP", SetEnableESP)

function OnRenderHUD()
	if EnableESP ~= 1 then
		return
	end

	local ScreenX, ScreenY = GetScreenSize()
	local t = { 1 }
	for k, v in pairs(GetStreamedPlayers()) do
		local x, y, z = GetPlayerLocation(v)
		local sX, sY, sZ = WorldToScreen(x, y, z)
		if sZ ~= 0.0 then
			DrawLine(ScreenX / 2, ScreenY, sX, sY)
			DrawBox(sX - 50, sY - 100, 100, 200)
		end
	end
end
AddEvent("OnRenderHUD", OnRenderHUD)

See also