Forum

> > CS2D > Scripts > image disappear when round restart
Forums overviewCS2D overview Scripts overviewLog in to reply

English image disappear when round restart

2 replies
To the start Previous 1 Next To the start

old image disappear when round restart

log_in
User Off Offline

Quote
i made lua that cover player like this.
IMG:https://i.imgur.com/8NzCFzV.png


when round restart, suddenly image is gone except server.

i want to make image doesn't disappear when round restart. please help me

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function array(m)
        local array = {}
        for i = 1, m do
                array[i] = 0
        end
        return array
end
zxc=array(32,0)
asd=array(32,0)
addhook("spawn","sn")
addhook("startround","_st")
function sn(id)
	freeimage(asd[id])
	freeimage(zxc[id])
	asd[id]=image("gfx/Hudplayer.png",320,240,2,id)

end
function _st(id)
	freeimage(asd[id])
	freeimage(zxc[id])
	asd[id]=image("gfx//Hudplayer.png",320,240,2,id)
end

sry for bad English.

old Re: image disappear when round restart

EP
User Off Offline

Quote
well.. i guess these two slashes are wrong in _st

Quote
asd[id]=image("gfx//Hudplayer.png",320,240,2,id)

Quote
//


also, you can use both hooks for sn function only (if i'm not wrong) , your script will look like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function array(m)
        local array = {}
        for i = 1, m do
                array[i] = 0
        end
        return array
end
zxc=array(32,0)
asd=array(32,0)
addhook("spawn","sn")
addhook("startround","sn")
function sn(id)
     freeimage(asd[id])
     freeimage(zxc[id])
     asd[id]=image("gfx/Hudplayer.png",320,240,2,id)

end

old Re: image disappear when round restart

andryp999
User Off Offline

Quote
I have not tried this code yet, but I think it will work. Luck!.
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
function array(m)
        local array = {}
        for i = 1, m do
                array[i] = 0
        end
        return array
end
zxc=array(32,0)
asd=array(32,0)
addhook("always","sn")
addhook("always","_st")
function sn(id)
    if player(id, 'health') > 0 then
     freeimage(asd[id])
     freeimage(zxc[id])
     asd[id]=image("gfx/Hudplayer.png",320,240,2,id)

end
end
function _st(id)
    if player(id, 'health') > 0 then
     freeimage(asd[id])
     freeimage(zxc[id])
     asd[id]=image("gfx//Hudplayer.png",320,240,2,id)
end
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview