English about huds ct and tt

11 replies
Goto Page
To the start Previous 1 Next To the start
19.01.20 08:04:24 pm
Up
maninja
User
Offline Off
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
IMG:https://prnt.sc/qpwtnu
and IMG:https://prnt.sc/qpwtyw


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
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
19.01.20 08:14:28 pm
Up
Mora
User
Offline Off
Code:
1
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
19.01.20 09:02:48 pm
Up
maninja
User
Offline Off
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?
edited 1×, last 19.01.20 09:19:48 pm
19.01.20 09:59:52 pm
Up
Mami Tomoe
User
Offline Off
@user maninja: You press CTRL+C to copy and CTRL+V to paste.
It's hard being the best girl in the whole entire world
19.01.20 11:18:30 pm
Up
Masea
Super User
Offline Off
@user Mami Tomoe: More like he asks where to paste it.

Here:
Code:
1
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
Replace the function with this one and it's done.
Shit your pants: file cs2d Outlast II Mod (29) | Create your UI faster: CS2D UI Framework
20.01.20 01:43:26 am
Up
MikuAuahDark
User
Offline Off
Small changes, but somewhat important if you're running larger scripts is in line 11 if your original code (line 3 in user Masea's code) is this.
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.
file cs2d LuaJIT for Dedicated Server (13) JIT POWER! | Know your Lua errors! | Part of LÖVE development team since 11.3
20.01.20 12:07:51 pm
Up
maninja
User
Offline Off
i find error

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
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
20.01.20 01:18:23 pm
Up
TrialAndError
User
Offline Off
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
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
20.01.20 02:33:59 pm
Up
maninja
User
Offline Off
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);" />
20.01.20 02:42:01 pm
Up
TrialAndError
User
Offline Off
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
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
20.01.20 05:22:52 pm
Up
maninja
User
Offline Off
again error

Code:
1
Error: sys/lua/autorun/glowingplayers.lua:25: attempt to index field 'images' (a nil value)
20.01.20 06:00:44 pm
Up
TrialAndError
User
Offline Off
oops, I forgot to add
Code:
1
sample.glowing.images = {}


bellow sample.glowing = {} at the top
To the start Previous 1 Next To the start