AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Replace words in console (https://forums.alliedmods.net/showthread.php?t=29676)

Martin1 06-10-2006 11:03

Replace words in console
 
I know how to replace letters in chat. But i need to know how to replace letters or words in console such that if someone writes

amxx in console it replaces it to amx, (not what i'm planning to do but still)

+Karma to the one who helps

VEN 06-10-2006 11:22

Same way as you replace letters in chat.

Martin1 06-10-2006 13:13

Example ;)

VEN 06-10-2006 13:58

Just check for certain words in client_command. Use read_argv(0, and read_args to retrieve full command line, then replace what needed with replace_all, then send modified command with client_cmd and block original with return PLUGIN_HANDLED. If you've changed say text, this shouldn't be a problem for you.

jtp10181 06-10-2006 19:49

you are trying to make shortcuts for console admin commands? if you give a real example people will be able to help instead of giving us some generic example that isn't what you want to do.

Martin1 06-11-2006 07:12

GHW Chronic 915 (2:09:36 PM): maybe tell me wtf ur talking about
Rcowzy (2:10:02 PM): Ok
Rcowzy (2:10:11 PM): so don't you hate it when you have caps lock on
Rcowzy (2:10:17 PM): and you type AMX_MAP DE_DUST2
Rcowzy (2:10:27 PM): and console goes like: MAn WTF AMX_MAP isn't a command
Rcowzy (2:10:36 PM): and you wanna say ...... YEAH GIRL, FUCK ME HARD
Rcowzy (2:10:51 PM): so with my plugin it changes A to a, B to b, C to c
Rcowzy (2:11:03 PM): to avoid that stupid ass error

jtp10181 06-11-2006 09:34

Code:

/* Called when client is sending command. */
forward client_command(id);

use that forward to catch all client commands, then if they are not in all lowercase you could convert them and resend them from the same client.

Or an even more accurate way would be to get a full list of commands into an array, and then match against the array using equali and then sedn the exact right command.

JohnJ3 06-11-2006 10:55

Why you changes A to a, B to b, C to c? Better change "AMX_MAP" to "amx_map"! Use strtolower function.


All times are GMT -4. The time now is 08:00.

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