Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Commit fa1068b

Browse files
committed
Add DrawTexture function and use it to draw an overhead texture in main.lua
1 parent d1f3771 commit fa1068b

2 files changed

Lines changed: 9 additions & 15 deletions

File tree

hitman/[Core]/[Client]/functions.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,4 +167,12 @@ function devdebug(text)
167167
if Config.DevMode then
168168
print(text)
169169
end
170+
end
171+
172+
function DrawTexture(textureStreamed,textureName,x, y, width, height,rotation,r, g, b, a, p11)
173+
if not HasStreamedTextureDictLoaded(textureStreamed) then
174+
RequestStreamedTextureDict(textureStreamed, false);
175+
else
176+
DrawSprite(textureStreamed, textureName, x, y, width, height, rotation, r, g, b, a, p11);
177+
end
170178
end

hitman/[Core]/[Client]/main.lua

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ AddEventHandler('RootLodge:HitContracts:C:StartMission', function()
8383
DrawInfo('Press [ ~e~K~q~ ] to get paid', 0.5, 0.95, 0.75)
8484
else
8585
DrawInfo('Press [ ~e~G~q~ ] to start a contract', 0.5, 0.95, 0.75)
86+
DrawTexture("overhead", "overhead_ambient_hunter", 0.5, 0.5, 0.251, 0.251, 0.0, 0, 0, 0, 240, false);
8687
end
8788

8889
-- Initiating the contract.
@@ -155,21 +156,6 @@ end)
155156

156157
HandleNPCSpawning()
157158

158-
local function DrawTexture(textureStreamed,textureName,x, y, width, height,rotation,r, g, b, a, p11)
159-
if not HasStreamedTextureDictLoaded(textureStreamed) then
160-
RequestStreamedTextureDict(textureStreamed, false);
161-
else
162-
DrawSprite(textureStreamed, textureName, x, y, width, height, rotation, r, g, b, a, p11);
163-
end
164-
end
165-
166-
Citizen.CreateThread(function()
167-
while true do
168-
Citizen.Wait(0)
169-
DrawTexture("overhead", "overhead_ambient_hunter", 0.5, 0.5, 0.251, 0.251, 0.0, 0, 0, 0, 240, false);
170-
end
171-
end)
172-
173159
-- On reload of resource [DO NOT TOUCH]
174160
AddEventHandler("onResourceStop", function(resourceName)
175161
if (GetCurrentResourceName() ~= resourceName) then

0 commit comments

Comments
 (0)