Forum

> > CS2D > Scripts > Force a player to use a bind.
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Force a player to use a bind.

7 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Force a player to use a bind.

minos
User Off Offline

Zitieren
Hello, I'm searching to force players in using binds when they join the server is there anyway to make that ?
regards,

alt Re: Force a player to use a bind.

Mora
User Off Offline

Zitieren
Before player starting the game(joins team and spawn) you can ask them what the button they would like to use for special action, like setting controls, then recommend them to set controls, if otherwise - the gameplay wont be as it should be with binds.

example like:
"Type the button to do Reload"
and you have to say "R" or "r", w/e.
then next and etc.

alt Re: Force a player to use a bind.

minos
User Off Offline

Zitieren
user Cure Pikachu hat geschrieben
Use a combination of the cs2d lua cmd addbind function and cs2d lua hook key hook. It won't let you overwrite client's controls though.

how that's working ?
1
2
addbind("space")
parse('bind space "say !help"')
I need an example please !

@user Mora I want something that forces them not ask them for writing binds
like this
1
2
3
4
timer(40,"playerbind","")
function playerbind()
parse(bind leftalt "say !help")
end

alt Re: Force a player to use a bind.

Cure Pikachu
User Off Offline

Zitieren
Using that example:
1
2
3
4
5
6
7
8
9
10
addbind("space") -- Add a custom bind for spacebar

addhook("key","_keybind")
function _keybind(id,key,state) -- id parameter is for player id
	if state == 1 then -- If key is *only* pressed down
		if key == "space" then -- If key is spacebar
			-- Whatever saying !help is supposed to do, put it here
		end
	end
end
Also, read up thread cs2d Bind other players keys, it will tell you why you can't just do a parse cs2d cmd bind in a script.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht