Raised This Month: $ Target: $400
 0% 

How to bind a key ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
K.K.Lv
Veteran Member
Join Date: Aug 2008
Location: GameFolder
Old 06-04-2009 , 10:26   How to bind a key ?
Reply With Quote #1

Hi ! everybody!
I just want to bind a key to call a menu!
please look at the following code:
PHP Code:
 register_clcmd("amx_info""CmdMenu")
 
//...
public client_putinserver(id)
{
 
set_task(4.0"bind_key"id)
 return 
PLUGIN_CONTINUE
}
 
public 
bind_key(id)
{
 
client_cmd(id"bind l amx_info")
//...
}
 
public 
CmdMenu(id)
{
 
//..

but when i press the "L" key, will print "unknow command: amx_info" in the console!
do I wrong ??
please tell me the mistake!!
thanks for you all!!!!

Last edited by K.K.Lv; 06-04-2009 at 10:29.
K.K.Lv is offline
Send a message via MSN to K.K.Lv
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-04-2009 , 11:12   Re: How to bind a key ?
Reply With Quote #2

Bind a key is not allow if you don't ask player's permission first.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-04-2009 , 15:37   Re: How to bind a key ?
Reply With Quote #3

It's working as it should . return PLUGIN_HANDLED
__________________
fysiks is offline
K.K.Lv
Veteran Member
Join Date: Aug 2008
Location: GameFolder
Old 06-04-2009 , 23:19   Re: How to bind a key ?
Reply With Quote #4

Quote:
Originally Posted by ConnorMcLeod View Post
Bind a key is not allow if you don't ask player's permission first.
why?
K.K.Lv is offline
Send a message via MSN to K.K.Lv
K.K.Lv
Veteran Member
Join Date: Aug 2008
Location: GameFolder
Old 06-04-2009 , 23:22   Re: How to bind a key ?
Reply With Quote #5

Quote:
Originally Posted by fysiks View Post
It's working as it should . return PLUGIN_HANDLED
you mean add return PLUGIN_HANDLED behind the client_cmd(id, "bind l amx_info")
K.K.Lv is offline
Send a message via MSN to K.K.Lv
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-04-2009 , 23:39   Re: How to bind a key ?
Reply With Quote #6

Quote:
Originally Posted by K.K.Lv View Post
why?
Because you are changing a client's settings without their permission, and it is not allowed here.

Quote:
Originally Posted by K.K.Lv View Post
you mean add return PLUGIN_HANDLED behind the client_cmd(id, "bind l amx_info")
No, he meant in the function that handles the command.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
K.K.Lv
Veteran Member
Join Date: Aug 2008
Location: GameFolder
Old 06-05-2009 , 01:11   Re: How to bind a key ?
Reply With Quote #7

can you give me a example???
K.K.Lv is offline
Send a message via MSN to K.K.Lv
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-05-2009 , 01:15   Re: How to bind a key ?
Reply With Quote #8

Quote:
Originally Posted by K.K.Lv View Post
can you give me a example???
PHP Code:
public CmdMenu(id)
{
 
//..
 
return PLUGIN_HANDLED

I'm smart . As far as asking permission, that's a bit more involved, I'm not that smart (well . . .) LOL .
__________________
fysiks is offline
K.K.Lv
Veteran Member
Join Date: Aug 2008
Location: GameFolder
Old 06-05-2009 , 02:10   Re: How to bind a key ?
Reply With Quote #9

Quote:
I'm smart
may be you are right!!


thanks you code!!!
K.K.Lv is offline
Send a message via MSN to K.K.Lv
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:05.


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