Raised This Month: $ Target: $400
 0% 

Solved Redefine client_print function with a condition


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-19-2017 , 18:10   Re: Redefine client_print function with a condition
Reply With Quote #1

Quote:
Originally Posted by KliPPy View Post
Have an editor that can do a Find & Replace with Regex. Then search for
Code:
client_print\s*\((.+?),\s*print_chat\s*,(.+?)\)
and replace with
Code:
CC_SendMessage($1,$2)
Just tested in Sublime Text 3.
You mean users will need to use a different editor in order to do that? What I want to do is simply add a #include which will contain a #define or something like that which will replace all print_chat messages with a custom function. If it requires down loading/using additional files, I can live without it. The point is to keep it simple and easy for people to use.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-19-2017 , 19:17   Re: Redefine client_print function with a condition
Reply With Quote #2

Quote:
Originally Posted by OciXCrom View Post
You mean users will need to use a different editor in order to do that? What I want to do is simply add a #include which will contain a #define or something like that which will replace all print_chat messages with a custom function. If it requires down loading/using additional files, I can live without it. The point is to keep it simple and easy for people to use.
Regex a very powerful tool that can be used to make many things much easier and quicker. I actually use it several times a week. Therefore, for me, this is a simple task.

If you really want to do it as you suggest with a simple precompiler definition, you'll need to have a function with the same prototype. In that function, you need to check if the second parameter is print_chat. If it is, do the modified functionality otherwise call client_print() like normal.
__________________

Last edited by fysiks; 03-19-2017 at 19:20.
fysiks 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 17:56.


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