Forum

> > CS2D > Scripts > FPS drop ... image
Forums overviewCS2D overview Scripts overviewLog in to reply

English FPS drop ... image

6 replies
To the start Previous 1 Next To the start

old FPS drop ... image

script favor
User Off Offline

Quote
Hi,i'm here again so i found something not normal i just added one image and it lags fps drop to 1 :

my pc spec :
3 GB ram,
1 GB graphic card
Nvidia GeForce 6100
...

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
if not gui then gui = {} end

gui.img = {}

function gui.img.ms100()
	for _, id in ipairs(player(0,"tableliving")) do
		if (player(id,"health")==100) then
			if player(id,"exists")==false or player(id,"exists")==true then
			local id = image("gfx/hp/hpbar.png",40,450,2)
		elseif (player(id,"health")==99) or (player(id,"health")==98) or (player(id,"health")==97) or (player(id,"health")==96) or (player(id,"health")==95) or (player(id,"health")==94) or (player(id,"health")==93) or (player(id,"health")==92) or (player(id,"health")==91) or (player(id,"health")==90) then
			local id = image("gfx/hp/hpbar2.png",40,450,2)
		elseif (player(id,"health")==89) or (player(id,"health")==88) or (player(id,"health")==87) or (player(id,"health")==86) or (player(id,"health")==85) or (player(id,"health")==84) or (player(id,"health")==83) or (player(id,"health")==82) or (player(id,"health")==81) or (player(id,"health")==80) then
			local id = image("gfx/hp/hpbar3.png",40,450,2)
		elseif (player(id,"health")==79) or (player(id,"health")==78) or (player(id,"health")==77) or (player(id,"health")==76) or (player(id,"health")==75) or (player(id,"health")==74) or (player(id,"health")==73) or (player(id,"health")==72) or (player(id,"health")==71) or (player(id,"health")==70) then
			local id = image("gfx/hp/hpbar4.png",40,450,2)
		elseif (player(id,"health")==69) or (player(id,"health")==68) or (player(id,"health")==67) or (player(id,"health")==66) or (player(id,"health")==65) or (player(id,"health")==64) or (player(id,"health")==63) or (player(id,"health")==62) or (player(id,"health")==61) or (player(id,"health")==60) then
			local id = image("gfx/hp/hpbar5.png",40,450,2)
		elseif (player(id,"health")==50) or (player(id,"health")==58) or (player(id,"health")==57) or (player(id,"health")==56) or (player(id,"health")==55) or (player(id,"health")==54) or (player(id,"health")==53) or (player(id,"health")==52) or (player(id,"health")==51) or (player(id,"health")==50) then
		local im=image("gfx/hp/hpbar6.png",40,450,2)
		elseif (player(id,"health")==49) or (player(id,"health")==48) or (player(id,"health")==47) or (player(id,"health")==46) or (player(id,"health")==45) or (player(id,"health")==44) or (player(id,"health")==43) or (player(id,"health")==42) or (player(id,"health")==41) or (player(id,"health")==40) then
		local im=image("gfx/hp/hpbar7.png",40,450,2)
		elseif (player(id,"health")==39) or (player(id,"health")==38) or (player(id,"health")==37) or (player(id,"health")==36) or (player(id,"health")==35) or (player(id,"health")==34) or (player(id,"health")==33) or (player(id,"health")==32) or (player(id,"health")==31) or (player(id,"health")==30) then
		local im=image("gfx/hp/hpbar8.png",40,450,2)
		elseif (player(id,"health")==29) or (player(id,"health")==28) or (player(id,"health")==27) or (player(id,"health")==26) or (player(id,"health")==25) or (player(id,"health")==24) or (player(id,"health")==23) or (player(id,"health")==22) or (player(id,"health")==21) or (player(id,"health")==20) then
		local im=image("gfx/hp/hpbar9.png",40,450,2)
		elseif (player(id,"health")==19) or (player(id,"health")==18) or (player(id,"health")==17) or (player(id,"health")==16) or (player(id,"health")==15) or (player(id,"health")==14) or (player(id,"health")==13) or (player(id,"health")==12) or (player(id,"health")==11) or (player(id,"health")==10) then
		local im=image("gfx/hp/hpbar10.png",40,450,2)
		elseif (player(id,"health")==9) or (player(id,"health")==8) or (player(id,"health")==7) or (player(id,"health")==6) or (player(id,"health")==5) or(player(id,"health")==4) or (player(id,"health")==3) or (player(id,"health")==2) or (player(id,"health")==1) then
		local im=image("gfx/hp/hpbar11.png",40,450,2)
			end
		end
	end
end

	
	


parse("mp_hud 0")

addhook("ms100","gui.img.ms100")
edited 1×, last 19.02.18 07:45:43 pm

old Re: FPS drop ... image

Bowlinghead
User Off Offline

Quote
Why dont you post your script?

Generally, did you try to fix the problem by your self?
- disable graphics, shadow
- on which maps?
- on which scripts? do you have multiple scripts?!?
- ...

old Re: FPS drop ... image

GeoB99
Moderator Off Offline

Quote
You asked for help within the Scripts section yet no code is present here. Care to show it? Or is it caused by something else?

• Edit: The culprit of your problem is in your code. Using cs2d lua hook ms100 on functions with cs2d lua cmd image reduces the performance very badly. This is the worst way of doing this and I would not recommend it. Take a look at file cs2d HP Bar to build an idea of how a HP Bar does actually work.
edited 2×, last 19.02.18 08:03:12 pm

old Re: FPS drop ... image

Waldin
User Off Offline

Quote
i think you dont need to create images 1000000000 times per second if you dont free them lol ill lag everything

Attention: Using too many images can lead to lags and other problems!

old Re: FPS drop ... image

Nekomata
User Off Offline

Quote
Don't use ms100! Since you require the image to chance depending on the HP of the player, use it with the hit hook!

Also your code is a mess. Use < and > operators!

This should work.
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 not gui then gui = {} end

gui.img = {}

gui.updateImage = function(id)
        if (player(id,"health")==100) then
               if player(id,"exists")==false or player(id,"exists")==true then
               local id = image("gfx/hp/hpbar.png",40,450,2)
          elseif (player(id,"health")==99) or (player(id,"health")==98) or (player(id,"health")==97) or (player(id,"health")==96) or (player(id,"health")==95) or (player(id,"health")==94) or (player(id,"health")==93) or (player(id,"health")==92) or (player(id,"health")==91) or (player(id,"health")==90) then
               local id = image("gfx/hp/hpbar2.png",40,450,2)
          elseif (player(id,"health")==89) or (player(id,"health")==88) or (player(id,"health")==87) or (player(id,"health")==86) or (player(id,"health")==85) or (player(id,"health")==84) or (player(id,"health")==83) or (player(id,"health")==82) or (player(id,"health")==81) or (player(id,"health")==80) then
               local id = image("gfx/hp/hpbar3.png",40,450,2)
          elseif (player(id,"health")==79) or (player(id,"health")==78) or (player(id,"health")==77) or (player(id,"health")==76) or (player(id,"health")==75) or (player(id,"health")==74) or (player(id,"health")==73) or (player(id,"health")==72) or (player(id,"health")==71) or (player(id,"health")==70) then
               local id = image("gfx/hp/hpbar4.png",40,450,2)
          elseif (player(id,"health")==69) or (player(id,"health")==68) or (player(id,"health")==67) or (player(id,"health")==66) or (player(id,"health")==65) or (player(id,"health")==64) or (player(id,"health")==63) or (player(id,"health")==62) or (player(id,"health")==61) or (player(id,"health")==60) then
               local id = image("gfx/hp/hpbar5.png",40,450,2)
          elseif (player(id,"health")==50) or (player(id,"health")==58) or (player(id,"health")==57) or (player(id,"health")==56) or (player(id,"health")==55) or (player(id,"health")==54) or (player(id,"health")==53) or (player(id,"health")==52) or (player(id,"health")==51) or (player(id,"health")==50) then
          local im=image("gfx/hp/hpbar6.png",40,450,2)
          elseif (player(id,"health")==49) or (player(id,"health")==48) or (player(id,"health")==47) or (player(id,"health")==46) or (player(id,"health")==45) or (player(id,"health")==44) or (player(id,"health")==43) or (player(id,"health")==42) or (player(id,"health")==41) or (player(id,"health")==40) then
          local im=image("gfx/hp/hpbar7.png",40,450,2)
          elseif (player(id,"health")==39) or (player(id,"health")==38) or (player(id,"health")==37) or (player(id,"health")==36) or (player(id,"health")==35) or (player(id,"health")==34) or (player(id,"health")==33) or (player(id,"health")==32) or (player(id,"health")==31) or (player(id,"health")==30) then
          local im=image("gfx/hp/hpbar8.png",40,450,2)
          elseif (player(id,"health")==29) or (player(id,"health")==28) or (player(id,"health")==27) or (player(id,"health")==26) or (player(id,"health")==25) or (player(id,"health")==24) or (player(id,"health")==23) or (player(id,"health")==22) or (player(id,"health")==21) or (player(id,"health")==20) then
          local im=image("gfx/hp/hpbar9.png",40,450,2)
          elseif (player(id,"health")==19) or (player(id,"health")==18) or (player(id,"health")==17) or (player(id,"health")==16) or (player(id,"health")==15) or (player(id,"health")==14) or (player(id,"health")==13) or (player(id,"health")==12) or (player(id,"health")==11) or (player(id,"health")==10) then
          local im=image("gfx/hp/hpbar10.png",40,450,2)
          elseif (player(id,"health")==9) or (player(id,"health")==8) or (player(id,"health")==7) or (player(id,"health")==6) or (player(id,"health")==5) or(player(id,"health")==4) or (player(id,"health")==3) or (player(id,"health")==2) or (player(id,"health")==1) then
          local im=image("gfx/hp/hpbar11.png",40,450,2)
               end
          end
end

function gui.hitHook(id)
     gui.updateImage(id)
end

parse("mp_hud 0")

addhook("hit","gui.hitHook")
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview