English Force a player to use a bind.

7 replies
Goto Page
To the start Previous 1 Next To the start
17.06.18 07:14:22 pm
Up
Hello, I'm searching to force players in using binds when they join the server is there anyway to make that ?
regards,
l
17.06.18 08:34:32 pm
Up
Cure Pikachu
User
Online On
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.
IMG:https://i.imgur.com/5UWPaft.png
IMG:https://i.imgur.com/xpsyQRX.png
17.06.18 09:59:17 pm
Up
Mora_rus
User
Offline Off
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.
I will finally join the army at 5.07.18 and back after year. bb
17.06.18 11:00:52 pm
Up
user Cure Pikachu has written:
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 ?
Code:
1
2
addbind("space")
parse('bind space "say !help"')

I need an example please !

@user Mora_rus I want something that forces them not ask them for writing binds
like this
Code:
1
2
3
4
timer(40,"playerbind","")
function playerbind()
parse(bind leftalt "say !help")
end
l
17.06.18 11:08:19 pm
Up
Cure Pikachu
User
Online On
Using that example:
Code:
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.
IMG:https://i.imgur.com/5UWPaft.png
IMG:https://i.imgur.com/xpsyQRX.png
17.06.18 11:46:38 pm
Up
@user Cure Pikachu: thank you but still only work for the server player but not for other players.
l
18.06.18 12:31:44 am
Up
Cure Pikachu
User
Online On
Please don't tell me you put
parse('bind space "say !help"')
in there
IMG:https://i.imgur.com/5UWPaft.png
IMG:https://i.imgur.com/xpsyQRX.png
18.06.18 12:32:48 am
Up
@user Cure Pikachu: xd no i'm not that dumb i have put my function there
menu(id,"Admin Menu,Mouse actions,Teleport,Save,Reload")

xdd thank you it works i just miss something there
l
To the start Previous 1 Next To the start