Forum

> > CS2D > Scripts > how to check "mode" in hit hook
Forums overviewCS2D overview Scripts overviewLog in to reply

English how to check "mode" in hit hook

9 replies
To the start Previous 1 Next To the start

old how to check "mode" in hit hook

loldlold123
User Off Offline

Quote
how to check weapon mode in hit hook...

i tried to use weapon("mode") but its not working...help me pls

i need

addhook("hit","xhit")
function xhit(id,src,wep)
if weapon("mode")==2 then
xxxx
xxx
xx
x

old Re: how to check "mode" in hit hook

Bowlinghead
User Off Offline

Quote
I dont know .
Maybe something like that?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
addhook("always","attackreset")
function attackreset()
for _,id in ipairs(player(0,"tableliving")) do
atk=0 -- Reset: May you have change to ms100...
end
end
addhook("attack2","lol")
function lol(id,mode)
if player(id,"weapontype")==50 then -- Knife
atk=1
end
end
addhook("hit","lol2")
function lol2(id,src,w)
if atk==1 then
-- HERE IS YOUR CODE IF ATTACK2 WITH KNIFE
end
end
-- 100% wrong / Untestet

old Re: how to check "mode" in hit hook

Banaan
User Off Offline

Quote
If you are sure that your players do not wear kevlar, you could use the hpdmg parameter of the hit function. If you know the amount of damage a primary and secondary knife attack will do, you can check that the weapon is knife and that the amount of damage done is greater than a primary knife attack. Note that kevlar and armor might cause some trouble.

1
2
3
4
5
6
7
addhook("hit", "CheckSecondaryKnifeHit")

function CheckSecondaryKnifeHit(id, source, weapon, hpdmg)
	if weapon == 50 and hpdmg == 90 then	-- secondary knife does 90 damage without any armor
		print("Secondary knife hit!")
	end
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview