AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Binding keys when player connects (https://forums.alliedmods.net/showthread.php?t=107605)

Jelle 10-28-2009 06:56

Binding keys when player connects
 
Hey. I found this in the trash. I wanted to see how it worked, but it is totally wrong.

If I use this command:
PHP Code:

client_cmd(id,"bind F12 say AntiCheat: F12 Pressed."); 

What is does is binding the key to the say command and makes the player say what ever I change it to.

However, when I connect to the server with this running, it wont bind it.
I found out why. I have to write it like this in console:
Code:

bind F12 "say AntiCheat: F12 Pressed"
But I can not use those " in the code, since I am getting errors when compiling it then. So my question is:
Is there any way to get this to work, so I can use " in the client_cmd?

xPaw 10-28-2009 06:57

Re: Binding keys when player connects
 
1. Slowhacking is not allowed here.
2. Detecting cheaters with binding keys is the worst method ever.

Jelle 10-28-2009 07:00

Re: Binding keys when player connects
 
I know this is totally crap.

It is not the plugin I am concerned about. Lets say I wanted them to say "jelle is awesome" when they press a button.
I just want to know if it is possible to use the " in a code, any code at all. Not only regarding this, but all plugins.

micke1101 10-28-2009 07:22

Re: Binding keys when player connects
 
Yes it is possible

Jelle 10-28-2009 07:27

Re: Binding keys when player connects
 
Then howcome I can not compile this code?
PHP Code:

#include <amxmodx>

#define PLUGIN "AntiCheatBind"
#define VERSION "1.0"
#define AUTHOR "Xf0X"

public plugin_init()
{
    
register_plugin(PLUGIN,VERSION,AUTHOR)
}

public 
client_connect(id)
{
    
client_cmd(id,"bind F12 "say AntiCheatF12 Pressed."");
    
client_cmd(id,"bind -F12 "say AntiCheatF12 Pressed."");
    
client_cmd(id,"bind -end "say AntiCheatEND Pressed."");
    
client_cmd(id,"bind end "say AntiCheatEND Pressed."");
    
client_cmd(id,"bind insert "say AntiCheatINSERT Pressed."");
    
client_cmd(id,"bind -insert "say AntiCheatINSERT Pressed."");
    
client_cmd(id,"bind -F11 "say AntiCheatF11 Pressed."");
    
client_cmd(id,"bind F11 "say AntiCheatF11 Pressed."");


I get:
error: expected token "," but found "-identifier-" on line 14
error: Undefined symbol "say" on line 14

and a warning:
Expression has no effect, still on line 14.

micke1101 10-28-2009 07:35

Re: Binding keys when player connects
 
I can not help in this matter...
Quote:

Originally Posted by xPaw (Post 974185)
1. Slowhacking is not allowed here.


Jelle 10-28-2009 07:39

Re: Binding keys when player connects
 
Well, My intention is not slowhacking. My intention is to learn this, and how it is done.

I just wanted to learn why I can not use the client_cmd like this:
"bind F12 "say blah blah blah"")

Or any other matter, whatsoever.

drakeris 10-28-2009 07:44

Re: Binding keys when player connects
 
why dont you simple download the bind.sma plugins and look how its done there?

Jelle 10-28-2009 07:45

Re: Binding keys when player connects
 
Searching for bind.sma gets me only this post. Any link?

micke1101 10-28-2009 07:46

Re: Binding keys when player connects
 
Slow hacking is when you make a setting on the client side which is what youre doing with your code.

But if it isnt your intention (which i doubt)

Code:
client_print(id, print_chat, "^"")


All times are GMT -4. The time now is 17:32.

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