you need to bind a player key on connect then
bind KEY openscriptmenu -1 BUTTON_PRESSED_5
(use clientcmd.menu to do that - search forum if you don't know what is it)
PHP Code:
if(response == "BUTTON_PRESSED_5")
self thread spawnSentry();
you need to bind a player key on connect then
bind KEY openscriptmenu -1 BUTTON_PRESSED_5
(use clientcmd.menu to do that - search forum if you don't know what is it)
PHP Code:
if(response == "BUTTON_PRESSED_5")
self thread spawnSentry();
"Don't worry if your code doesn't work correctly - if everything worked, you would not work" ~Mosher's right
Thought I would use this thread instead of creating a new one.
I'm trying to bind a key so it will execute multiple commands, just like:
Example:
This can be done easily if you were to type that command manually into console.Code:bind m "+scores;say A;"
However I need the server to bind the key instead of every user having to bind the key themselves.
The normal way of doing this would be using something like "execClientCommand" or "setClientCvar" but none work in my situation.
With "execClientCommand", you can't use double quotes in a string. Example:
I also tried using escape sequence's;Code:self execClientCommand("bind m "+scores;say test;""); //Won't work.
But for some strange reason it will use single quotations instead of double:Code:self execClientCommand("bind m \"+scores;say test;\"");
Which won't work.Code://Output: bind m '+scores;say test;' //Won't work.
With "setClientCvar", I am able to do this;
However, using vstr will allow +scores to open normally, but it will not close normally (-scores) upon releasing the key. If I don't use vstr and manually type "bind m "+scores;say A;"" into console, it does open and close +scores correctly which is what I need.Code:self setClientCvar("scorebind", "+scores;say A;"); self execClientCommand("bind m vstr scorebind");
So, any ideas on how can I do it?
Last edited by filthy_freak_; 28th May 2014 at 12:36.
I use this. So maybe u can doPHP Code:
self setClientCvar ("clientcmd","disconnect; wait 20; reconnect");
self openMenu ("clientcmd");
self closeMenu ("clientcmd");
PHP Code:
self setClientCvar ("clientcmd","bind m +scores; wait 1; say A");
self openMenu ("clientcmd");
self closeMenu ("clientcmd");
maybe something like this
PHP Code:
player setClientCvar( "tmp" , "your;string;here;" );
player execClientCommand( "vstr tmp" );
filthy_freak_ (29th May 2014),Ni3ls (29th May 2014)
Put the bind in a config file; execute the config file on the player when they are either in a team for the first time (it wont work onPlayerConnect), or when they spawn. Put the config file either on your server in raw format, or put it in your IWD file.
This is the config file I use to bind keys:
I name the config file "custombuttons.cfg".Code:bind I "openScriptMenu clientcmd ibutton" bind L "openScriptMenu clientcmd lbutton" bind M "openScriptMenu clientcmd mbutton" bind K "openScriptMenu clientcmd kbutton"
This is the code I use to execute the config file:
Code:setUpButtons() { self ExecClientCommand( "exec custombuttons.cfg" ); }
filthy_freak_ (29th May 2014),Ni3ls (29th May 2014)
Thanks to both.
I'm pretty sure I tried your solution serthy but I can't remember the results. I'll give it a go.
Also I didn't know you could include .cfg files in your .iwd's and exec them client side. Thanks for the info Tally.
Is there a function to make a player look to the right/left?
I'm editting the vehicles mod, and I would really like for the players to be able to pilot planes and jeeps using the directional keys.
I noticed that I can set these binds:
bind UPARROW "+lookup"
bind DOWNARROW "+lookdown"
bind RIGHTARROW "+mlook"
I noticed that +lookleft or +lookright won't work - are there any similar functions?
I don't know what "+mlook" does, can anybody tell me? It may be helpful.
So, what I'm thinking right now is to execute a script from each of the directional keys. This script would change the player's angles. Is this possible?
Editted: if there are functions to look to the right/left, I'll just use them with up/down and adjust player's sensivity when entering a vehicle.
Editted #2: I also noticed there is a +klook, trying to find out what that is.
Editted #3: Found out about "+right" and "+left". It's just what I needed. All I need now is to adjust the player's sensivity. I'm still accepting suggestions.
Little problem - how to restore the player's original sensivity after he leaves the vehicle? I think I'll write a .cfg file before changing sensivity, and execute it after he leaves the vehicle.
Editted #4: Looks like sensitivity only works with the mouse.
Last edited by guiismiti; 7th September 2014 at 06:02.
I guess that handling wouldnt be as smooth as it is the way it is right now, imho the result isnt worth the time spent
otherwise I'd go the way like Tally suggested it with 2 configs:
- when the player enters a vehicle, rebind their keys and remember the original setup (copy the config unfortunately i forgot the command)
- when the player exits the vehcile reset the config