Raised This Month: $ Target: $400
 0% 

Replace words in console


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Martin1
BANNED
Join Date: May 2006
Old 06-10-2006 , 11:03   Replace words in console
Reply With Quote #1

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
Martin1 is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 06-10-2006 , 11:22  
Reply With Quote #2

Same way as you replace letters in chat.
VEN is offline
Martin1
BANNED
Join Date: May 2006
Old 06-10-2006 , 13:13  
Reply With Quote #3

Example ;)
Martin1 is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 06-10-2006 , 13:58  
Reply With Quote #4

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.
VEN is offline
jtp10181
Veteran Member
Join Date: May 2004
Location: Madison, WI
Old 06-10-2006 , 19:49  
Reply With Quote #5

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.
__________________
jtp10181 is offline
Send a message via ICQ to jtp10181 Send a message via AIM to jtp10181 Send a message via MSN to jtp10181 Send a message via Yahoo to jtp10181
Martin1
BANNED
Join Date: May 2006
Old 06-11-2006 , 07:12  
Reply With Quote #6

GHW Chronic 915 (2:096 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:106 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
Martin1 is offline
jtp10181
Veteran Member
Join Date: May 2004
Location: Madison, WI
Old 06-11-2006 , 09:34  
Reply With Quote #7

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.
__________________
jtp10181 is offline
Send a message via ICQ to jtp10181 Send a message via AIM to jtp10181 Send a message via MSN to jtp10181 Send a message via Yahoo to jtp10181
JohnJ3
Member
Join Date: May 2006
Location: Tomsk
Old 06-11-2006 , 10:55  
Reply With Quote #8

Why you changes A to a, B to b, C to c? Better change "AMX_MAP" to "amx_map"! Use strtolower function.
JohnJ3 is offline
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 08:00.


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