Forum

> > CS2D > Scripts > How to end round image
Forums overviewCS2D overview Scripts overviewLog in to reply

English How to end round image

4 replies
To the start Previous 1 Next To the start

old How to end round image

HOLAsoyGERMAN
User Off Offline

Quote
Hello I wanted saver that does not walk me the following script


1
2
3
4
5
6
7
8
9
10
11
12
13
addhook("endround", "endroundhook")

function endroundhook(mode)
     if (mode == 1) then
          local imageid = image("gfx\zmwin.png", 320, 240, 2)
          
          timer(3000, "freeimage", image)
     elseif (mode == 2) then
          local imageid = image("gfxhmwin.png", 320, 240, 2)
          
          timer(3000, "freeimage", image)
     end
end

This is the end of a game when you win one of the team deveria out an image but nothing comes out if you could please help me

old Re: How to end round image

Chingy
User Off Offline

Quote
user HOLAsoyGERMAN has written
Hello I wanted saver that does not walk me the following script

This is the end of a game when you win one of the team deveria out an image but nothing comes out if you could please help me

Hard translation into english:
Hello, I want a script that does not look like the following one. or Hello, there's something wrong with this script.
and
When the game ends and a one of the team wins, there should be a picture shown on the screen, what suddenly does not happen. I would be glad if you help me, thank you for your time.

old Re: How to end round image

Mami Tomoe
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
addhook("endround", "endroundhook")
function endroundhook(mode)
	if (mode == 1) then
		twin = image("gfx/zmwin.png", 320, 240, 2)
		timer(3000, "freeimage", twin)
	elseif (mode == 2) then
		ctwin = image("gfx/hmwin.png", 320, 240, 2)
		timer(3000, "freeimage", ctwin)
	end
end

Make sure you have the zmwin.png and hmwin.png in the proper place or it wont work, also make sure they are indeed .png files.

old Re: How to end round image

GeoB99
Moderator Off Offline

Quote
It'd be appreciated if you could refrain at using any kind of translators as they won't help you at improving your English to be proper in any way. You're basically violating even the Rules §4.1 - Use proper, understandable language. No dialects / translation tools. rule so keep this in mind. Furthermore, there are Code tags for a reason (the tag is [code][/code]) - always use them whenever you attempt to post a snippet of code! I added them anyway.

Aside, as for your problem, the main factor that prevents the script from showing an image when the round ends is because of the cs2d lua cmd timer last parameter. From what I see, you want the specific image to be shown only for 3 seconds till it'll disappear however as you're using locals to denote these two variables which have the cs2d lua cmd image function as local ones in the scope, you cannot free-image the image function itself thus resulting in "bad argument, got function" issue or something similar. You must use the local variable name as you assigned them to the image function instead but do not keep the same name for two or more local variables!

That's basically was your problem. Since user Mami Tomoe already provided to you with a fixed code, I just only explained your problem and gave a tip about local variables which it can be very useful for you in the future. Never use same name for local variables and always use them.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview