Forum

> > CS2D > Scripts > Join hook issue
Forums overviewCS2D overview Scripts overviewLog in to reply

English Join hook issue

4 replies
To the start Previous 1 Next To the start

old Join hook issue

Deleted User

Quote
Hello guys, I don't know if that was posted before, but I got some kind of problem.

So, when I tried to add HUD to player on join hook, client would not always see it

1
2
3
4
5
6
7
8
Player = {}

addhook('join', 'JoinHook')
function JoinHook(id)
	Player[id] = {
		hudimg = image('gfx/RPGx/panel.png', 320, 240, 2, id); 
	}
end

When I asked my friend to join, he said that he can't see the HUD. I was thinking and then I get a solution.

1
2
3
4
5
6
7
8
9
10
11
12
13
Player = {}

function Join(id)
	id = tonumber(id)
	Player[id] = {
		hudimg = image('gfx/RPGx/panel.png', 320, 240, 2, id); 
	}
end

addhook('join', 'JoinHook')
function JoinHook(id)
	timer(100, "Join", id)
end

Join hook will only work with timer

So I want to ask you guys, is this problem because of me or is it because CS2D bug?

Edit: Also, I tried to run the server on dedi. Problem was still occur, but this time even with me.

old Re: Join hook issue

Gaios
Reviewer Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
function array(size,value) 
	local array = {}
	for i = 1, size do
		array[i]=value
	end
	return array
end 
Player=array(32,0)

Player = {}
addhook('join', 'JoinHook')
function JoinHook(id)
	Player[id] = {
		hudimg = image('gfx/RPGx/panel.png', 320, 240, 2, id); 
		}
end

old Re: Join hook issue

Deleted User

Quote
user Gaios has written
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
function array(size,value) 
	local array = {}
	for i = 1, size do
		array[i]=value
	end
	return array
end 
Player=array(32,0)

Player = {}
addhook('join', 'JoinHook')
function JoinHook(id)
	Player[id] = {
		hudimg = image('gfx/RPGx/panel.png', 320, 240, 2, id); 
		}
end

Are you stupid or something?

Why the fuck you added the

1
2
3
4
5
6
7
8
function array(size,value) 
	local array = {}
	for i = 1, size do
		array[i]=value
	end
	return array
end 
Player=array(32,0)

part and after that

Player = {}

makes Player table blank again.

That's dosen't fix the problem, the problem is in join hook not in your stupid arrays.

old Re: Join hook issue

omg
User Off Offline

Quote
couldnt u just initialize the whole array of images at the start? btw, how are ur personal projects? i heard u were working on something

old Re: Join hook issue

Deleted User

Quote
user omg has written
couldnt u just initialize the whole array of images at the start? btw, how are ur personal projects? i heard u were working on something
It's doin' good, ty
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview