Forum

> > CS2D > Scripts > Unable to strip knife.
Forums overviewCS2D overview Scripts overviewLog in to reply

English Unable to strip knife.

14 replies
To the start Previous 1 Next To the start

old Unable to strip knife.

hacked
User Off Offline

Quote
1
2
3
4
5
6
addhook("spawn","sp_prison_config")

function sp_prison_config(self)
	parse("strip "..self.." 50")
	parse("equip "..self.." 78")
end

I can't remove the damn knife, I keep spawning with both claw and knife.

old Re: Unable to strip knife.

_oops
User Playing CS2D

Quote
1
2
3
4
5
6
7
addhook("spawn","sp_prison_config")

function sp_prison_config(self)
return "78"
parse("setweapon "..self.." 78")
parse("strip "..self.." 50")
end

didn't test it

old Re: Unable to strip knife.

Avo
User Off Offline

Quote
@user _oops: It won't work because "return" ends function. Everything after "return" will be ignored.

@user hacked: You have to strip a knife after spawn. Note that you won't be able to strip it if it's the only weapon of a player.

old Re: Unable to strip knife.

Mora
User Off Offline

Quote
Just little edit of @user _oops:
1
2
3
4
5
6
addhook("spawn","ssp")
function ssp(id)
parse("equip "..id.." 78")
parse("setweapon "..id.." 78")
parse("strip "..id.." 50")
end

old Re: Unable to strip knife.

DC
Admin Off Offline

Quote
You can't strip the standard melee weapon (well you can but you shouldn't). It will lead to an invalid game state and CS2D will automatically try to fix it be re-equipping the weapon.

old Re: Unable to strip knife.

_Yank
User Off Offline

Quote
@user DC: From what I remember it won't, I already did something similar to this.

1
2
3
4
5
6
7
8
9
function stripem(id)
	parse("strip "..id.." 50")
end

addhook("spawn","_func")
function _func(id)
	timer(30,"stripem",id)
	return 78
end
Didn't tested it by the way.

old Re: Unable to strip knife.

Alistaire
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
addhook('drop', '_dropHook')
addhook('select', '_selectHook')
addhook('spawn', '_spawnHook')

function _dropHook(id, iid, type)
	if type == 78 then
		return 1
	end
end

function _selectHook(id, type, mode)
	if type == 50 then
		parse('equip '..id..' 78')
		parse('setweapon '..id..' 78')
	end
end

function weaponIdToClaw(id)
	parse('setweapon '..id..' 78')
end

function _spawnHook(id)
	timer(50, 'weaponIdToClaw', id)
	return 78
end

old Re: Unable to strip knife.

hacked
User Off Offline

Quote
Doesn't work. I looked at the gun game example, and the knife stripping thing works . Can't figure out why mine doesn't.

EDIT:
user Alistaire, your drop function doesn't seem to work.
edited 1×, last 05.10.14 05:17:42 am

old Re: Unable to strip knife.

muxarus
User Off Offline

Quote
@user hacked: try this code:
1
2
3
4
5
6
7
8
9
10
addhook("spawn" , "weapon")
function weapon(id,weapon)
	parse("equip "..id.." 78 ")
	parse("setweapon "..id.." 78 ")
end

addhook("spawn","_spawn")
_spawn = function(id)
     timer(100, "parse", "strip "..id.." 50")
end

old Re: Unable to strip knife.

VADemon
User Off Offline

Quote
Itemless REspawn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
addhook("die", "instarespawn")
addhook("spawn", "itemlessspawn")
function instarespawn(victim, killer, weapon, x, y)
	local x, y = 128, 128 -- DIY
	local id = victim
	parse("spawnplayer "..id.." "..x.." "..y)
	
	return 0
end

function itemlessspawn(id)

return "0"
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview