-
Notifications
You must be signed in to change notification settings - Fork 0
/
players_hud.txt
110 lines (84 loc) · 2.92 KB
/
players_hud.txt
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
@name Players HUD
@inputs E:wirelink
@persist Ents:array
if(first() | dupefinished()){
E:egpClear()
timer("find",500)
timer("createegp",1000)
timer("updateegp",1500)
Ents = array()
if(E:entity():isValid()){
E:egpHudEnable(1)
}
}
if(clk("find")){
timer("find",10000)
timer("createegp",10) #so that it removes hud entries if someone leaves the game
findIncludeClass("npc*")
findExcludeEntity(owner())
findExcludeClass("sent_vj_ply_spawnpoint")
findExcludeClass("prop_physics_multiplayer")
findExcludeClass("gmod_wire_input")
findExcludeClass("fnp90")
findInSphere(owner():pos(),5000)
findSortByDistance(owner():pos())
FEnts = findToArray()
Plys = players()
Ents = Plys:add(FEnts)
}
if(clk("createegp")){
E:egpClear()
for(I=1,Ents:count()){
Ent = Ents[I,entity]
local Name = I+Ents:count()
local Health = I+Name*2
local Dist = I+Health*2
E:egp3DTracker(I,vec(0))
E:egpParent(I,Ent) #pos becomes local when you parent
if(Ent:name() == ""){
NameS = Ent:type()
}
else{
NameS = Ent:name()
}
E:egpText(Name,NameS,vec2(0,0))
E:egpSize(Name,15)
E:egpAlign(Name,1)
if(Ent:isPlayer()){
E:egpColor(Name,teamColor(Ent:team()))
}
else{
E:egpColor(Name,vec(255,0,0))
}
E:egpText(Health,"HP: "+Ent:health():toString()+" / "+Ent:maxHealth(),vec2(0,15))
E:egpSize(Health,15)
E:egpAlign(Health,1)
E:egpText(Dist,"Dist: "+floor(Ent:pos():distance(owner():pos())):toString(),vec2(0,25))
E:egpSize(Dist,15)
E:egpAlign(Dist,1)
E:egpParent(Name,I)
E:egpParent(Health,Name)
E:egpParent(Dist,Name)
}
}
if(clk("updateegp")){
timer("updateegp",100)
for(I=1,Ents:count()){
Ent = Ents[I,entity]
local Name = I+Ents:count()
local Health = I+Name*2
local Dist = I+Health*2
local HP = Ent:health() / Ent:maxHealth() * 100
if(HP >= 90){ E:egpColor(Health,vec(0,255,0))}
if(HP <= 80 & HP > 70){ E:egpColor(Health,vec(100,255,0))}
if(HP <= 70 & HP > 60){ E:egpColor(Health,vec(150,255,0))}
if(HP <= 60 & HP > 50){ E:egpColor(Health,vec(200,255,0))}
if(HP <= 50 & HP > 40){ E:egpColor(Health,vec(255,255,0))}
if(HP <= 40 & HP > 30){ E:egpColor(Health,vec(255,200,0))}
if(HP <= 30 & HP > 20){ E:egpColor(Health,vec(255,150,0))}
if(HP <= 20 & HP > 10){ E:egpColor(Health,vec(255,100,0))}
if(HP <= 10 & HP > 0){ E:egpColor(Health,vec(255,0,0))}
E:egpSetText(Health,"HP: "+Ent:health():toString()+" / "+Ent:maxHealth())
E:egpSetText(Dist,"Dist: "+floor(Ent:pos():distance(owner():pos())):toString())
}
}