Forum

> > CS2D > Scripts > image when join
Forums overviewCS2D overview Scripts overviewLog in to reply

English image when join

17 replies
To the start Previous 1 Next To the start

old image when join

lennon
User Off Offline

Quote
> I trying to make img when anybody join server, the image will disapear after x secound's, can some one help me, hard to make it...

old Re: image when join

Rainoth
Moderator Off Offline

Quote
It's definitely not hard.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
img = image("gfx/747.bmp",0,1,2)
imagepos(img,240,240,0)
imagealpha(img,0)

addhook("join","yey")
function yey(id)
     tween_alpha(img,1500,1)
     freetimer("woosh")
     timer(2500,"woosh")
end

function woosh()
     tween_alpha(img,1500,0)
end

Works as following. A person joins, image appears out of nowhere, stays for a second, then disappears again. If a player joins within that time, it looks like it's appearing again.
edited 1×, last 12.07.14 10:58:29 pm

old Re: image when join

lennon
User Off Offline

Quote
not work, i check on my new game ,and on server. Everything is loading there's no error but i dont see my img. Also when i make wrong on path to img and any error like (gfx/bla/bla.png) error not such file. Do you check it ?

old Re: image when join

Rainoth
Moderator Off Offline

Quote
Fine let me run it myself.
// Ok. It DID work but only after the first person joined. No idea why. I added id parameter to the hook function and now it works perfectly (tested). Why the hell do I need id argument if I'm not using it..? No idea. Well whatever.

old Re: image when join

Rainoth
Moderator Off Offline

Quote
Hooks don't have parameters. They supply them if you give parameters for functions attached to them. I edited the code anyway so you can just copy paste it again and change path.

old Re: image when join

lennon
User Off Offline

Quote
i know why dosnt work for me even with ID parameter. I have on my server another addhook join. First i trying to check it with my other scripts, now i tried to start it alone. Raining do u have some idea for it? And question this image shows for all, or just for each other players ?

old Re: image when join

AlcatrazZ
BANNED Off Offline

Quote
By adding a hook (join) you tell the script that when a player enters the server function is called with parameters that are assigned to this hook.

example:
1. CS2D is finding hook (join).
2. CS2D found hook (join).
3. CS2D is sending parameters to function of hook.
4. SCRIPT calls the function.

function myJoin(id)
	msg2(id,"Hello, this message see only you because your id is "..id)
end
addhook("join","myJoin")

old Re: image when join

lennon
User Off Offline

Quote
example:
1. I have script welcome message with addhock (join)
2. Now i add this script with image which have too addhock (join)

SO this script's do not inferfere togheter?

NEXT: about my little know, i check log's and i dont see 2x adding function x to hook "join", so i use hook fix (some lua) and restart so now i saw 2x adding function x to hook join. Now propably should to work but my reason is this script image when join dont work with any hud txt on server. Anyway THANK U Raining for U time, big beer for u from poland ! ! !
edited 1×, last 12.07.14 11:58:18 pm

old Re: image when join

Rainoth
Moderator Off Offline

Quote
@user lennon: They shouldn't interfere. It's not a say hook or something. I used to run multiple scripts running 5 different functions assigned to join. Wasn't a problem. It works for me. Maybe your image is totally black?

old Re: image when join

lennon
User Off Offline

Quote
when i start only your script img without other img work fine. But when i start it with other scripts dont work. I bet that what i say, this lua cant be working with any hud lua.

Im a little sad, i making this all day, what do u think about it ? This is what u mean about tottaly black?
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview