This repository was archived by the owner on Aug 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhud.lua
More file actions
60 lines (55 loc) · 2.78 KB
/
hud.lua
File metadata and controls
60 lines (55 loc) · 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
--[[
Script Name: RP2D HUD Functions
Script URI: https://github.com/sqpp/RP2D
Author: Marcell (#6943)
Author URI: https://unrealsoftware.de/profile.php?userid=6943
Description: .... modify later
Version: 0.0.0.1
License: GNU General Public License v3
License URI: http://www.gnu.org/licenses/gpl-3.0.html
Tags: cs2d, roleplay, hud
This script is licensed under the GPL.
(C) 2020 Marcell
]]
function RP2D.HUD()
for _,pid in pairs (player(0,"table")) do
usgn = player(pid, "usgn")
if player(pid, "usgn") == 0 then -- If player has no USGN ID then return nothing
return false
else
file = io.open("sys/lua/cache/usgn_"..usgn..".dat", "r")
jsondata = file:read("*a")
data = json.decode(jsondata)
money = getPlayerMoney(pid) -- Get last money from save
drink = getPlayerThirst(pid) -- Get last thrist from save
food = getPlayerHunger(pid) -- Get last hunger from save
local x = player(pid,"screenw") -- Player screen width in pixels
local y = player(pid,"screenh") -- Player screen height in pixels
if (x == 1912 or x == 1920) and (y == 1080) then -- FULLHD
playerTable[pid].ui_bg = image("gfx/miami/gui/CS2D.png", (x-200), (y/2), 2, pid)
parse('hudtxt2 '..pid.. ' 1 " '..color['Green'].. " " ..usgn.. '" '..x..' '..((y/2)-135)..' 2 0 25')
parse('hudtxt2 '..pid.. ' 2 " '..color['Green'].. "$" ..money.. '" '..x..' '..((y/2)-10)..' 2 0 25')
parse('hudtxt2 '..pid.. ' 3 " '..color['Red'].. " " ..drink.. '%" '..x..' '..((y/2)+50)..' 2 0 25')
parse('hudtxt2 '..pid.. ' 4 " '..food.. '%" '..x..' '..((y/2)+100)..' 2 0 25')
end
if (x == 850) and (y == 480) then -- 850x480
playerTable[pid].ui_bg = image("gfx/miami/gui/CS2D.png", (x-140), (y/2), 2, pid)
imagescale(playerTable[pid].ui_bg,0.7,0.7)
parse('hudtxt2 '..pid.. ' 1 " '..color['Green'].. " " ..usgn.. '" '..x..' '..((y/2)-93)..' 2 0 15')
parse('hudtxt2 '..pid.. ' 2 " '..color['Green'].. "$" ..money.. '" '..x..' '..((y/2)-5)..' 2 0 15')
parse('hudtxt2 '..pid.. ' 3 " '..color['Red'].. " " ..drink.. '%" '..x..' '..((y/2)+35)..' 2 0 15')
parse('hudtxt2 '..pid.. ' 4 " '..food.. '%" '..x..' '..((y/2)+70)..' 2 0 15')
end
end
end
end
function RP2D.RemHUD()
for _,pid in pairs (player(0,"table")) do
freeimage (playerTable[pid].ui_bg)
playerTable[pid].ui_bg = nil
parse('hudtxt2 '..pid.. ' 1 ')
parse('hudtxt2 '..pid.. ' 2 ')
parse('hudtxt2 '..pid.. ' 3 ')
parse('hudtxt2 '..pid.. ' 4 ')
end
end