Forum

> > CS2D > Scripts > Menu only for F2/F3 ?
Forums overviewCS2D overview Scripts overviewLog in to reply

English Menu only for F2/F3 ?

9 replies
To the start Previous 1 Next To the start

old Menu only for F2/F3 ?

Remulux
User Off Offline

Quote
Hi, is it possible to a menu of classes open only when press F2 or F3?

Sorry for my english.

DELETE
edited 1×, last 05.12.13 12:58:37 pm

old Re: Menu only for F2/F3 ?

Necr0
User Off Offline

Quote
More >


This should work.

old Re: Menu only for F2/F3 ?

Rainoth
Moderator Off Offline

Quote
TheCode >


You should use cs2d lua hook serveraction for reference. Check the other hooks and what parameters they have.

old Re: Menu only for F2/F3 ?

Necr0
User Off Offline

Quote
I don't get what you mean user Remulux.
It doesn't open the menu when you change the team.
Did you mean it is not working because it also opens when you press f4?
If that is what you mean please don't say it's not working.
You should describe what is wrong next time because you made me think it reports an error in the console.

old Re: Menu only for F2/F3 ?

Rainoth
Moderator Off Offline

Quote
user Necr0 has written
Did you mean it is not working because it also opens when you press f4?
You should describe what is wrong next time because you made me think it reports an error in the console.


Quote
open only when press F2 or F3?


Isn't it clear enough ? Anyways, I think you just made it work in a way that it works on all keys and he took it as error. Give him time. I'm sure he'll understand what is what after a while.

old Re: Menu only for F2/F3 ?

Remulux
User Off Offline

Quote
THX for help.

Scripting in lua I'm learning

But is it possible to show class menu on spawn?

More >

I use only F2
edited 1×, last 03.12.13 04:42:11 pm

old Re: Menu only for F2/F3 ?

Rainoth
Moderator Off Offline

Quote
Dude. Lemme tell you something Engy taught me almost in the begining.

1
function name(a,b,c)

"function" - will begin DECLARING your function. Basically by writing "function" you tell the computer that you're making some kind of mechanism that may work in the future.

"name" - This is the name of your function. Try not to make the name as cs2d hooks or other functions that might already be declared if you use multiple scripts.

"()" - the brackets where you declare the arguments for the function

"a,b,c" - the actual arguments. You can name them whatever you want, what really matters is the ORDER. For example a is health, b is armor and c is speed. You can name them "speed,health,armor" and use "speed" to actually change health. It's not advised as you'll just confuse yourself, but what I mean is - it'll work as long you get the order right. One thing you should note is that you shouldn't try to name them after the functions (yet) or it might get a bit too complicated for you.

Now. cs2d lua hook spawn is what you need in spawn. CHECK THAT SITE. Seriously. Look up all the hooks and their arguments. Your function for class menu only requires ID ! It means that you can make a menu pop-up in any way you want, you just have to find a hook that stores id of a player. Sometimes ID may appear in shape of another expression in cs2d (for example "killer","victim","source" and similar) so keep that in mind too.

I hope this helps a lot. I'm sorry if it is a bit unclear to you but this is THE BASICS and if you can't understand it, you should try to ask someone else to explain the same thing.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview