Forum

> > CS2D > Scripts > Wrench
Forums overviewCS2D overview Scripts overviewLog in to reply

English Wrench

12 replies
To the start Previous 1 Next To the start

old Wrench

KolobokRus
User Off Offline

Quote
I need a script that only ct get the wrench on spawn

old Re: Wrench

archmage
User Off Offline

Quote
1
2
3
4
5
6
function __spawn(id)
	if ( player(id, "team") == 2 ) then
		parse("equip "..id.." 74")
	end
end
addhook("spawn", "__spawn")

old Re: Wrench

DC
Admin Off Offline

Quote
No, don't do that. NEVER EVER use cs2d cmd equip or cs2d cmd strip in the spawn hook! See cs2d lua hook spawn

Use the return value instead!

old Re: Wrench

Cure Pikachu
User Off Offline

Quote
@user DC: Hate to say this, but I tried this:
1
2
3
4
5
6
addhook("spawn","testdrive")
function testdrive(id)
	if player(id,"team") >= 2 then
		return "74"
	end
end
and it never gave me a wrench as a CT upon spawning. Did I mess up somewhere or is that a bug?

old Re: Wrench

MikuAuahDark
User Off Offline

Quote
user Cure Pikachu has written
and it never gave me a wrench as a CT upon spawning. Did I mess up somewhere or is that a bug?
it's not a bug you just mess up something, for single weapon ID it don't need strings
1
2
3
4
5
6
addhook("spawn","testdrive")
function testdrive(id)
	if player(id,"team") >= 2 then
		return 74
	end
end

old Re: Wrench

Alistaire
User Off Offline

Quote
1
2
3
4
5
6
7
addhook('spawn',	'AA_spawn')

function AA_spawn(id)
	if player(id, 'team') == 2 then
		return '74';
	end
end

old Re: Wrench

Avo
User Off Offline

Quote
Hmm... I have never problems when I use equip with spawn hook, but strip doesn't work withi it. Why?

old Re: Wrench

DC
Admin Off Offline

Quote
Because of the internal script execution order. Your hook is executed before the game actually equips the stuff and you can't strip stuff which is not equipped yet.

You would have to use a timer to strip stuff right after spawn.

old Re: Wrench

krabob
User Off Offline

Quote
If you wanted more than one weapon on spawn, you'd have to use equip, right?

old Re: Wrench

Yates
Reviewer Off Offline

Quote
You can make a script where you walkover a weapon it;
1. Equips you with that weapon ID.
2. Removes it from the ground.

Possibilities. Possibilities everywhere.

old Re: Wrench

EngiN33R
Moderator Off Offline

Quote
user krabob has written
If you wanted more than one weapon on spawn, you'd have to use equip, right?


Wrong - you can specify a number of values separated by commas to equip several items at once.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview