Hey guys, and thanks for reading this.
Recently I have started learning Lua, I have learn the basics and have started applying them into CS2D. I have started making a Deathrun map, where I realised a problem.
I'm not sure how to make a script which allows all players to spawn without a pistol (knife only), and help would be much appreciated.
Thanks.
- Vegetarian. Admin/mod comment
read the guidelines when posting. "I need some Halp!" is a bad title. It can be done in map editor:
Just put "info_noweapons" in your map 1
2
3
4
addhook("spawn","meleeonly")
function meleeonly(id)
	return "x"
end
Just use the Info_NoWeapons entity, you don't need a Lua script for this. Oh, I feel dumb >.<. Thanks a bunch guys. Another approach is...
1
2
3
4
5
6
7
8
addhook("spawn","onspawn")
function onspawn(id,wpn)
	wpn = 2 -- Strip specific weapon
	if player(id,"exists") then
		parse("strip "..id.." "..wpn)
		-- STRIP ALL; parse("strip "..id)
	end
end
But both DannyDeth's and EngiN33R's solution seems pretty good. Why need complicated strips on spawn if
DC in info.txt has written
spawn(id) on spawn
-id: player id
>return: "" - (nothing) spawn with regular items
"x" - spawn with melee weapon only
"typeid,typeid,..." - spawn with these items + melee
DC in info.txt has written
"x" - spawn with melee weapon only
Quick question I can just put this anywhere in the map and there will be no weapons? (And I have been wanting this answer all my life but thanks.) Yes, anywhere it will have the same effect. Oh and you just need ONE of them!