about huds ct and tt
11 replies



19.01.20 08:04:24 pm
Hello guys, I have a new topic to unite about, or rather something I need an help on in it
I want to make this be for ct and tt It is a circle surrounded players and it is now a yellow circle and I want to make it blue relative to for counter terrorism and red for terrorist
exapmle
and 
This is code
I want to make this be for ct and tt It is a circle surrounded players and it is now a yellow circle and I want to make it blue relative to for counter terrorism and red for terrorist
exapmle
This is code
Code:
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
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
if sample==nil then sample={} end
sample.glowing={}
--------------------------------------
-- GLOW --
--------------------------------------
-- Glow Function
function sample.glowing.makeallglow()
for i=1,32,1 do
id=image("gfx/sprites/flare2.bmp",1,1,100+i) -- Create image @ Player
imagecolor(id,200,200,0) -- Make image yellow
imageblend(id,1) -- Make image glow
imagealpha(id,0.5) -- Decrease Glow Strength
end
end
-- Make Glow instantly after starting server
sample.glowing.makeallglow()
-- Make Glow after roundstart (because images are deleted on roundstart!)
addhook("startround","sample.glowing.startround")
function sample.glowing.startround()
sample.glowing.makeallglow()
end
sample.glowing={}
--------------------------------------
-- GLOW --
--------------------------------------
-- Glow Function
function sample.glowing.makeallglow()
for i=1,32,1 do
id=image("gfx/sprites/flare2.bmp",1,1,100+i) -- Create image @ Player
imagecolor(id,200,200,0) -- Make image yellow
imageblend(id,1) -- Make image glow
imagealpha(id,0.5) -- Decrease Glow Strength
end
end
-- Make Glow instantly after starting server
sample.glowing.makeallglow()
-- Make Glow after roundstart (because images are deleted on roundstart!)
addhook("startround","sample.glowing.startround")
function sample.glowing.startround()
sample.glowing.makeallglow()
end
Code:
1
2
3
4
5
2
3
4
5
if player(i,"team")==1 then
imagecolor(id, 255,0,0)
elseif player(i,"team")==2 then
imagecolor(id, 0,0,255)
end
imagecolor(id, 255,0,0)
elseif player(i,"team")==2 then
imagecolor(id, 0,0,255)
end
I right blade i did harder than that but now i didn't even know this things are easier anyway thx you
But how do to paste it?
But how do to paste it?
edited 1×, last 19.01.20 09:19:48 pm
@
maninja: You press CTRL+C to copy and CTRL+V to paste.

It's hard being the best girl in the whole entire world
@
Mami Tomoe: More like he asks where to paste it.
Here:

Here:
Code:
Replace the function with this one and it's done. 1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
function sample.glowing.makeallglow()
for i=1,32,1 do
id=image("gfx/sprites/flare2.bmp",1,1,100+i) -- Create image @ Player
if player(i,"team")==1 then
imagecolor(id, 255,0,0)
elseif player(i,"team")==2 then
imagecolor(id, 0,0,255)
end
imageblend(id,1) -- Make image glow
imagealpha(id,0.5) -- Decrease Glow Strength
end
end
for i=1,32,1 do
id=image("gfx/sprites/flare2.bmp",1,1,100+i) -- Create image @ Player
if player(i,"team")==1 then
imagecolor(id, 255,0,0)
elseif player(i,"team")==2 then
imagecolor(id, 0,0,255)
end
imageblend(id,1) -- Make image glow
imagealpha(id,0.5) -- Decrease Glow Strength
end
end
Shit your pants:
Outlast II Mod (29) | Create your UI faster: CS2D UI Framework


Small changes, but somewhat important if you're running larger scripts is in line 11 if your original code (line 3 in
Masea's code) is this.
This ensure the variable is in local scope and doesn't leak into globals. It's good practice to do so.

Code:
local id=image("gfx/sprites/flare2.bmp",1,1,100+i)
This ensure the variable is in local scope and doesn't leak into globals. It's good practice to do so.


i find error
This is error
and this code
This is error
Code:
1
LUA ERROR: sys/lua/autorun/glowingplayers.lua:1: attempt to index field 'glowing' (a nil value)
and this code
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function sample.glowing.makeallglow()
for i=1,32,1 do
local id=image("gfx/sprites/flare2.bmp",1,1,100+i) -- Create image @ Player
if player(i,"team")==1 then
imagecolor(id, 255,0,0)
elseif player(i,"team")==2 then
imagecolor(id, 0,0,255)
end
imageblend(id,1) -- Make image glow
imagealpha(id,0.5) -- Decrease Glow Strength
end
end
-- Make Glow instantly after starting server
sample.glowing.makeallglow()
-- Make Glow after roundstart (because images are deleted on roundstart!)
addhook("startround","sample.glowing.startround")
function sample.glowing.startround()
sample.glowing.makeallglow()
end
for i=1,32,1 do
local id=image("gfx/sprites/flare2.bmp",1,1,100+i) -- Create image @ Player
if player(i,"team")==1 then
imagecolor(id, 255,0,0)
elseif player(i,"team")==2 then
imagecolor(id, 0,0,255)
end
imageblend(id,1) -- Make image glow
imagealpha(id,0.5) -- Decrease Glow Strength
end
end
-- Make Glow instantly after starting server
sample.glowing.makeallglow()
-- Make Glow after roundstart (because images are deleted on roundstart!)
addhook("startround","sample.glowing.startround")
function sample.glowing.startround()
sample.glowing.makeallglow()
end
You forgot the beginning part
Code:
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
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
if sample==nil then sample={} end
sample.glowing={}
--------------------------------------
-- GLOW --
--------------------------------------
-- Glow Function
function sample.glowing.makeallglow()
for i = 1, 32 do
-- Create image @ Player
local img = image('gfx/sprites/flare2.bmp', 1, 1, 100 + i)
local team = player(i, 'team');
if team == 1 then
imagecolor(img, 255, 0, 0)
elseif team == 2 then
imagecolor(img, 0, 0, 255)
end
-- Make image glow
imageblend(img, 1)
-- Decrease Glow Strength
imagealpha(img, 0.5)
end
end
-- Make Glow instantly after starting server
sample.glowing.makeallglow()
-- Make Glow after roundstart (because images are deleted on roundstart!)
addhook('startround', 'sample.glowing.startround')
function sample.glowing.startround()
sample.glowing.makeallglow()
end
sample.glowing={}
--------------------------------------
-- GLOW --
--------------------------------------
-- Glow Function
function sample.glowing.makeallglow()
for i = 1, 32 do
-- Create image @ Player
local img = image('gfx/sprites/flare2.bmp', 1, 1, 100 + i)
local team = player(i, 'team');
if team == 1 then
imagecolor(img, 255, 0, 0)
elseif team == 2 then
imagecolor(img, 0, 0, 255)
end
-- Make image glow
imageblend(img, 1)
-- Decrease Glow Strength
imagealpha(img, 0.5)
end
end
-- Make Glow instantly after starting server
sample.glowing.makeallglow()
-- Make Glow after roundstart (because images are deleted on roundstart!)
addhook('startround', 'sample.glowing.startround')
function sample.glowing.startround()
sample.glowing.makeallglow()
end
The color has not changed relative to the two teams I see only the white color
https://prnt.sc/qq9e6j" alt="IMG: https://prnt.sc/qq9e6j" border="0" style="margin: 5px 0px 5px 0px" width="1" height="1" onLoad="handleImg(this);" />
Try this
Code:
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
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
if sample==nil then sample={} end
sample.glowing={}
-- Glow Function
function sample.glowing.makeglow(id)
-- Create image @ Player
sample.glowing.images[id] = image('gfx/sprites/flare2.bmp', 1, 1, 100 + id)
-- Make image glow
imageblend(sample.glowing.images[id], 1)
-- Decrease Glow Strength
imagealpha(sample.glowing.images[id], 0.5)
end
-- Make Glow after roundstart (because images are deleted on roundstart!)
addhook('startround', 'sample.glowing.startround')
function sample.glowing.startround()
local players = player(0, "tableliving");
for i = 1, #players do
sample.glowing.makeglow(players[i])
end
end
addhook('spawn', 'sample.glowing.spawn')
function sample.glowing.spawn(id)
if (not sample.glowing.images[id]) then
sample.glowing.makeglow(id);
end
local team = player(id, 'team');
if team == 1 then
imagecolor(sample.glowing.images[id], 255, 0, 0)
elseif team == 2 then
imagecolor(sample.glowing.images[id], 0, 0, 255)
end
end
addhook('leave', 'sample.glowing.leave')
function sample.glowing.leave(id)
sample.glowing.images[id] = nil
end
sample.glowing={}
-- Glow Function
function sample.glowing.makeglow(id)
-- Create image @ Player
sample.glowing.images[id] = image('gfx/sprites/flare2.bmp', 1, 1, 100 + id)
-- Make image glow
imageblend(sample.glowing.images[id], 1)
-- Decrease Glow Strength
imagealpha(sample.glowing.images[id], 0.5)
end
-- Make Glow after roundstart (because images are deleted on roundstart!)
addhook('startround', 'sample.glowing.startround')
function sample.glowing.startround()
local players = player(0, "tableliving");
for i = 1, #players do
sample.glowing.makeglow(players[i])
end
end
addhook('spawn', 'sample.glowing.spawn')
function sample.glowing.spawn(id)
if (not sample.glowing.images[id]) then
sample.glowing.makeglow(id);
end
local team = player(id, 'team');
if team == 1 then
imagecolor(sample.glowing.images[id], 255, 0, 0)
elseif team == 2 then
imagecolor(sample.glowing.images[id], 0, 0, 255)
end
end
addhook('leave', 'sample.glowing.leave')
function sample.glowing.leave(id)
sample.glowing.images[id] = nil
end
again error
Code:
1
Error: sys/lua/autorun/glowingplayers.lua:25: attempt to index field 'images' (a nil value)



