AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to bind say command ? (https://forums.alliedmods.net/showthread.php?t=146538)

ALIENMODSX 12-29-2010 04:06

How to bind say command ?
 
Hello ,

I have applied a nanosuit script on my server . To access the nanosuit menu , we have to manually type "/nanosuit" every time .
How can i make it so , that anyone who join the server and presses "t" key , automatically says "/nanosuit" ?

thank u in advance ! :)

Elusive138 12-29-2010 05:28

Re: How to bind say command ?
 
A better way than changing the player's binds (which they might not be happy about) is to
PHP Code:

register_clcmd("say /nanosuit""NanosuitFunction")
register_clcmd("impulse 201" "NanosuitFunction"

impulse 201 is the default bind for the t key, used for the spray. This way you can change what the key does without touching the player's binds on other servers.

ConnorMcLeod 12-29-2010 05:49

Re: How to bind say command ?
 
I think you can't catch impulse this way.

Correct way is register_impulse(201, "callback_function")

Elusive138 12-29-2010 06:39

Re: How to bind say command ?
 
Oh really? Well, if clcmd doesn't work.. :P

Only problem is register_impulse is an engine.inc native.

EDIT: Connor's right, doesn't work.. If you aren't using engine, might I suggest another key, maybe 'c' (radio3)?

MuzzMikkel 12-29-2010 07:26

Re: How to bind say command ?
 
Quote:

Originally Posted by Elusive138 (Post 1381497)
A better way than changing the player's binds (which they might not be happy about) is to
PHP Code:

register_clcmd("say /nanosuit""NanosuitFunction")
register_clcmd("impulse 201" "NanosuitFunction"

impulse 201 is the default bind for the t key, used for the spray. This way you can change what the key does without touching the player's binds on other servers.

Where should paste it? :mrgreen:

Elusive138 12-29-2010 07:48

Re: How to bind say command ?
 
Quote:

Originally Posted by MuzzMikkel (Post 1381588)
Where should paste it? :mrgreen:

Please read the other posts, as that particular method does not work. Also, this is scripting help, so it's probably best if you have some basic understanding of the structure of a script.

Even if it were possible to register_clcmd an impulse, the function is just an example and I highly doubt it's actually called "NanosuitFunction".

ALIENMODSX 12-29-2010 11:59

Re: How to bind say command ?
 
could anyone just give me a working sma .... i am a server owner and im sorry , but i dont even know the "s" of scripting .... so plz provide me with a .sma file which can do what i requested in first post

fysiks 12-29-2010 12:48

Re: How to bind say command ?
 
Next time, post in the requests thread not in Scripting Help.


Quote:

Originally Posted by Elusive138 (Post 1381544)
Only problem is register_impulse is an engine.inc native.

How is that a problem?

meTaLiCroSS 12-29-2010 13:07

Re: How to bind say command ?
 
Quote:

Originally Posted by Elusive138 (Post 1381544)
Only problem is register_impulse is an engine.inc native.

Do you think using fakemeta you'll pr0 scripter? Lol

hleV 12-29-2010 13:14

Re: How to bind say command ?
 
Quote:

Originally Posted by meTaLiCroSS (Post 1381811)
Do you think using fakemeta you'll pr0 scripter? Lol

He said nothing about Fakemeta.


All times are GMT -4. The time now is 02:03.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.