Forum

> > CS2D > Scripts > Wrench
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Wrench

12 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Wrench

KolobokRus
User Off Offline

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

alt Re: Wrench

archmage
User Off Offline

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

alt Re: Wrench

DC
Admin Off Offline

Zitieren
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!

alt Re: Wrench

Cure Pikachu
User Off Offline

Zitieren
@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?

alt Re: Wrench

MikuAuahDark
User Off Offline

Zitieren
user Cure Pikachu hat geschrieben
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

alt Re: Wrench

Alistaire
User Off Offline

Zitieren
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

alt Re: Wrench

Avo
User Off Offline

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

alt Re: Wrench

DC
Admin Off Offline

Zitieren
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.

alt Re: Wrench

krabob
User Off Offline

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

alt Re: Wrench

Yates
Reviewer Off Offline

Zitieren
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.

alt Re: Wrench

EngiN33R
Moderator Off Offline

Zitieren
user krabob hat geschrieben
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.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht