Forum

> > CS2D > Scripts > Select Hook
Forums overviewCS2D overview Scripts overviewLog in to reply

English Select Hook

6 replies
To the start Previous 1 Next To the start

old Select Hook

_Vava_
User Off Offline

Quote
1
2
3
4
5
6
addhook("select","onselecting")
function onselectiong(id,type,mode)
if player(id,"weapon")==51 then
parse('hudtxt2 "..id.." 1 "Mode:BlaBlaBla 290 250')
end
end
ERROR:
LUA ERROR: attempt to call a nil value

old Re: Select Hook

eledah
User Off Offline

Quote
1
2
addhook("select","onselecting")
function ---> onselectiong <--- (id,type,mode)

1
parse('hudtxt2 "..id.." 1 "Mode:BlaBlaBla 290 250')
This one won't work as well.

old Re: Select Hook

Talented Doge
User Off Offline

Quote
1
2
3
4
5
6
addhook("select", "onSelecting")
function onSelecting(id, t, md)
	if t == 51 then
		parse ('hudtxt2 '..id..' 1 "Mode: BlaBlaBla" 290 250 1')
	end
end

Where id = player id
type = weapon type
mode = item mode (silence, scope etc)

cs2d lua hook select has shown the above information.

In fact your script didn't work because... You used
1
if player(id, "weapon") == 51

You should use
1
if t == 51
instead of
1
if player(id, "weapontype") == 51

There is no such thing called weapon, there is only weapontype, but you got a simpler one (t) , why would you use the more complicated one?

And t is type in your script

If you want to know what is mode, see this
1
2
3
4
5
6
addhook("select", "onSelecting")
function onSelecting(id, t, md)
	if t == 1 and md == 1 then
		parse ('hudtxt2 '..id..' 1 "Mode: BlaBlaBla" 290 250 1')
	end
end

What will this do?
This will check both whether the player selected usp and if the usp is silenced.
That's what mode is.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview