Forum

> > CS2D > Scripts > Start Hat Round
Forums overviewCS2D overview Scripts overviewLog in to reply

English Start Hat Round

2 replies
To the start Previous 1 Next To the start

old Start Hat Round

sheeL
User Off Offline

Quote
Hi People
I came here wondering what the beginning of each round Comes with Hat
Type: I already have the Script Hat
More ... How does the beginning of each round to start in the Hat
hat and can not quit writing! nohat,! nohat out

examples:

Round Start> All players will Hats>
Sorry for my english

old Re: Start Hat Round

Yates
Reviewer Off Offline

Quote
1
2
3
4
addhook("spawn","hat")
function hat()
	hat=image("gfx/[YOURIMAGEFOLDERSHITHERE]",1,1,200+id)
end

Would be a trouble if you want to remove it. Because the hat would be added every time you spawn, so best to use this as well;

1
2
3
4
addhook("die","hat2")
function hat2()
	freeimage(hat)
end

And then you could use your code with the "!nohat" shit (If you want to, or you don't. I cannot really understand your post), just make sure it says "freeimage(hat)".

I do think it should work, yet I started today working with hats/images.
edited 1×, last 16.12.11 09:04:51 pm

old Re: Start Hat Round

KimKat
GAME BANNED Off Offline

Quote
I think the script should look more like this. Try it, hope it works. It's been over a year since I've practiced Lua scripting.

1
2
3
4
5
6
7
8
9
10
11
addhook("die","remove_hat")
function remove_hat(id)
	if player(id,"exists") then
		freeimage(id)
	end
end

addhook("spawn","add_hat")
function add_hat(id)
	id=image("gfx/hats/myhat.png",1,1,200+id)
end


Here's one using the say hook.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
addhook("die","remove_hat")
function remove_hat(id)
	if player(id,"exists") then
		freeimage(id)
	end
end

addhook("say","add_hat")
function add_hat(id,txt)
if (txt=="!add hat") then
	id=image("gfx/hats/myhat.png",1,1,200+id)
elseif (txt=="!remove hat") then
	freeimage(id)
end

Hope I've helped.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview