Forum

> > CS2D > Scripts > Stripping knife when spawn
Forums overviewCS2D overview Scripts overviewLog in to reply

English Stripping knife when spawn

12 replies
To the start Previous 1 Next To the start

old Stripping knife when spawn

Masea
Super User Off Offline

Quote
1
2
3
4
5
addhook("spawn","_spawn")
function _spawn(id)
	timer(1,"parse","strip "..id.." 50")
	return "69"
end
I tried this and it didn't work. I mean, I was equipped with a machete as well as the knife. Would be good if anyone else has an idea to solve this. Thanks in advance.

old Re: Stripping knife when spawn

Yates
Reviewer Off Offline

Quote
Does stripping the knife still even work? Try using the console once you've spawned, if it still works that means you'll have to try different times with the timer to see what works.

@user BcY: Because bugs. The return work perfectly though, so you can still equip on spawn, just not the normal way.

old Re: Stripping knife when spawn

DC
Admin Off Offline

Quote
@user BcY: It's like that because the spawn process itself already equips the player with stuff. So if you want to equip the player with different stuff during spawn you have to tell it the spawn process. This works by using the return value.

Using equip there would clash with the spawn process.

@user Masea: Not sure about the issue. Might be because the player has the knife in the hands on spawn or something.

You could try to also do a cs2d cmd setweapon id 69 before doing the strip. If that alone doesn't work you could try if a higher delay for the timer makes any difference.

old Re: Stripping knife when spawn

Masea
Super User Off Offline

Quote
1
2
3
4
5
6
addhook("spawn","_spawn")
function _spawn(id)
	timer(1,"parse","setweapon "..id.." 69")
	timer(2,"parse","strip "..id.." 50")
	return "69"
end
This one works. Thank you guys!

old Re: Stripping knife when spawn

Talented Doge
User Off Offline

Quote
A rip-off from my script:
1
2
3
4
5
6
7
8
9
weap_class = {"34, 51, 74", "20, 51, 74", "11, 51, 74"}

function _spawn (id)
--blablabla
parse ("strip "..id.." 50")
--bla bla bla
return weap_class[aos.sel[id]]
end
end

And it actually works, stripping the player of knife, and equipping the player with weapons(including a wrench)

old Re: Stripping knife when spawn

DC
Admin Off Offline

Quote
@user Gaios: That's a bad suggestion! Read the documentation and what I wrote above. Return is the better option. It also performs better and is more reliable.

old Re: Stripping knife when spawn

DC
Admin Off Offline

Quote
The problem is that it can fail and lead to weird bugs in some cases. So you really shouldn't use it. Moreover equip is slower and causes more network traffic than using return in spawn.

Therefore I highly recommend not to use equip in spawn at all. If you do so anyway please don't complain about problems. You have been warned.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview