Raised This Month: $ Target: $400
 0% 

Solved Redefine client_print function with a condition


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

What I'm trying to do is automatically transform a client_print(id, print_chat, message[]) message in a CC_SendMessage(id, message[]) function. So, I tried several methods:

PHP Code:
#define client_print(%1,%2,%3) CC_SendMessage(%1,%3) 
This is correct, but it will work for all messages type, not only print_chat.

PHP Code:
#define client_print(%1,print_chat,%3) CC_SendMessage(%1,%3) 
This is also correct, but it works only if the function is written without spaces, which is very rarely the case.

PHP Code:
#define client_print CC_PrintTransform

stock CC_PrintTransform(const id, const iType, const szInput[], any:...)
{
    if(
iType != print_chat)
        return
        
    new 
szMessage[188]
    
vformat(szMessagecharsmax(szMessage), szInput4)
    
CC_SendMessage(idszMessage)

This worked, but it will block all other print types.

So, I'm out of ideas. Is it possible to use some kind of a condition with the preprocessor, such as:

PHP Code:
#define client_print(%1,%2,%3) (if(%2 == print_chat) CC_SendMessage(%1,%3)) 
?
__________________

Last edited by OciXCrom; 03-19-2017 at 19:48.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
 


Thread Tools
Display Modes

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