OnRenderHUD

From Onset Developer Wiki
Revision as of 12:25, 2 September 2020 by BlueMountains (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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