Forum

> > CS2D > Scripts > show image for the player when join
Forums overviewCS2D overview Scripts overviewLog in to reply

English show image for the player when join

3 replies
To the start Previous 1 Next To the start

old show image for the player when join

j0kER aR
User Off Offline

Quote
Hi everyone, i need your help again.

I want that when a player joins the server an image appears, but only for him.

I need something like this
HUDImage[id]


I want it to be with this same code, just tell me how I can do it so that it appears only to the player who connects and that the image does not appear to all of us who are playing there

1
2
3
4
5
6
function SoundOnJoin(id)
     HUDImage = image('gfx/img.png', 320 , 240, 2)
     timer(3000, "hideHUDImage", nil, 1)
end

addhook('join', 'SoundOnJoin')

thanks so much

old Re: show image for the player when join

Rainoth
Moderator Off Offline

Quote
Refer to cs2d lua cmd image
It has an optional "pl" parameter which allows you to create that image for a specific player.
Oh and you say you need
HUDImage[id]
but in your
SoundOnJoin
function you wrote it as
HUDImage
so you should fix that part.

TL;DR to make it work:
1.
HUDImage
>
HUDImage[id]

2.
image('gfx/img.png', 320 , 240, 2)
>
image('gfx/img.png', 320 , 240, 2, id)


Good luck.

old Re: show image for the player when join

j0kER aR
User Off Offline

Quote
@user Rainoth: i use this

1
2
3
4
5
6
7
8
9
10
function SoundOnJoin(id)
     HUDImage = image('gfx/img.png', 320 , 240, 2)
     timer(3000, "hideHUDImage", nil, 1)
end

addhook('join', 'SoundOnJoin')

function hideHUDImage()
    tween_alpha(HUDImage, 3000, 0) -- 0: invisible @ 1: visible
end

old Re: show image for the player when join

Rainoth
Moderator Off Offline

Quote
Cool. I told you how to fix it. Do it.
Now that you've shown how you hide it, change your hideHUDImage function to have id parameter and then pass it down when you call timer function.

Good luck.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview