Forum

> > CS2D > Scripts > Make Image on screen?
Forums overviewCS2D overview Scripts overviewLog in to reply

English Make Image on screen?

6 replies
To the start Previous 1 Next To the start

old Make Image on screen?

Blaster-Blade
User Off Offline

Quote
Hello guys!
Plase help me for my scripts!
In my scripts im want add some IMAGE on main Screen server!
Like Image Stats ( City life ) or image like Title ( Iran town )
other says to me : This is HudImage?? , and help me find the
HudImage.. scripts. thanks.

old Re: Make Image on screen?

VADemon
User Off Offline

Quote
It's not hard. Just read cs2d lua cmd image thoroughly and make use of the image() function.
Take a look at file cs2d [ADMN] TooManyWeapons 1.3b it uses one big image as menu, the white/red buttons are just resized single-color squares.
When you create an image, you have to store its "address" in a variable (per-player! if it's a HUD image and not on the map) to be able to remove it at a later point. Also, you have to clean these variables/recreate images at round start because every image is removed on round start.

old Re: Make Image on screen?

Blaster-Blade
User Off Offline

Quote
@user VADemon: Ok , thanks for your Lua Scripts but im not understand with your scripts Your Lua scripts very HARD for me im just newbie , You can show me some Example scripts?? Example But Easy! Thanks.

old Re: Make Image on screen?

Rainoth
Moderator Off Offline

Quote
1
image(path,x,y,2)
That "2" is what defines an image to be HUD image. For the rest you just need to fill it with your image path and x/y modes (not position)

old Re: Make Image on screen?

VADemon
User Off Offline

Quote
user Blaster-Blade you can use image() wherever you want, just keep in mind:
if you want to remove the image at later time then you have to save the returned value in a variable:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
hudimagetable = {}

addhook("join", "imageJoin")
function imageJoin( id ) -- < sets the variable id which equals the player ID who joined
   hudimagetable[ id ] = image(path, x, y, 2) -- saves the returned value in the table exclusively for this player
end

addhook("spawn", "imageSpawn")
function imageSpawn(id) -- remove image when this player spawns

   if hudimagetable[id] ~= nil then -- does the address of the image exist?
      freeimage( hudimagetable[ id] ) -- retrieve the saved value for this player

      hudimagetable[id] = nil -- delete the image address
   end

end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview