Raised This Month: $12 Target: $400
 3% 

Solved Correct parameter for using "TextMsg"


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 08-14-2019 , 23:04   Correct parameter for using "TextMsg"
Reply With Quote #1

Hi allied, I'm having trouble printing the name of the player who sent the radio command, instead of the name of the sender, is printing the name of the receiver, I've tried both with the iMsgDest parameter, and with id, I'm a bit lost and I know the answer is probably obvious, thanks in advance.

PHP Code:
register_message(get_user_msgid("TextMsg"), "MessageHook_TextMsg"

public 
MessageHook_TextMsg(iMsgiMsgDestid)  
{  
        if(
get_msg_args() != || !g_eSettings[VarRadio]) return PLUGIN_CONTINUE  

        
static message200 ]
        static 
handleCvar
        
new str100 
    
        new const 
messageParam 5
        
new sz_Health get_user_health id )

        
get_msg_arg_string(messageParammessagecharsmax(message))
    
        if(
TrieGetCell(RadioDatasmessagehandleCvar) && get_pcvar_string(handleCvarmessagecharsmax(message)))
        {
            
formatex(strcharsmax (str ), "^3[^4%s^3]^1:^4 %n^x01 (RADIO) (^4HP^1:^x03%d^x01):^x04 %s"g_eSettings[VarTagPrefixWithoutColor], id sz_Health message 
            
            
set_msg_arg_string(3str
        } 
        return 
PLUGIN_CONTINUE  

__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/

Last edited by iceeedr; 09-09-2019 at 17:58.
iceeedr is offline
Send a message via Skype™ to iceeedr
Mistrick
Senior Member
Join Date: Aug 2012
Location: Russia
Old 08-15-2019 , 09:23   Re: Correct parameter for using "TextMsg"
Reply With Quote #2

Sender placed in first string param. NumAsString(entindex()) in ClientPrint.

https://github.com/s1lentq/ReGameDLL...hbang.cpp#L177
https://github.com/s1lentq/ReGameDLL...layer.cpp#L435
https://github.com/s1lentq/ReGameDLL.../util.cpp#L664

PHP Code:
public MessageHook_TextMsg(iMsgiMsgDestreciever)   
{   
        if(
get_msg_args() != || !g_eSettings[VarRadio]) return PLUGIN_CONTINUE   

        
static message200 
        static 
handleCvar 
        
new str100 ]  
     
        new const 
messageParam 

        
new sendertemp[8];
        
// first param is WRITE_BYTE(msg_dest);
        // second sender index as string
        
get_msg_arg_string(2tempcharsmax(temp));
        
sender str_to_num(temp);
        
        new 
sz_Health get_user_health sender 
        
        
get_msg_arg_string(messageParammessagecharsmax(message)) 
     
        if(
TrieGetCell(RadioDatasmessagehandleCvar) && get_pcvar_string(handleCvarmessagecharsmax(message))) 
        { 
            
formatex(strcharsmax (str ), "^3[^4%s^3]^1:^4 %n^x01 (RADIO) (^4HP^1:^x03%d^x01):^x04 %s"g_eSettings[VarTagPrefixWithoutColor], sender sz_Health message )  
             
            
set_msg_arg_string(3str)  
        }  
        return 
PLUGIN_CONTINUE   

Mistrick is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 08-15-2019 , 09:38   Re: Correct parameter for using "TextMsg"
Reply With Quote #3

Quote:
Originally Posted by Mistrick View Post
Sender placed in first string param. NumAsString(entindex()) in ClientPrint.

https://github.com/s1lentq/ReGameDLL...hbang.cpp#L177
https://github.com/s1lentq/ReGameDLL...layer.cpp#L435
https://github.com/s1lentq/ReGameDLL.../util.cpp#L664

PHP Code:
public MessageHook_TextMsg(iMsgiMsgDestreciever)   
{   
        if(
get_msg_args() != || !g_eSettings[VarRadio]) return PLUGIN_CONTINUE   

        
static message200 
        static 
handleCvar 
        
new str100 ]  
     
        new const 
messageParam 

        
new sendertemp[8];
        
// first param is WRITE_BYTE(msg_dest);
        // second sender index as string
        
get_msg_arg_string(2tempcharsmax(temp));
        
sender str_to_num(temp);
        
        new 
sz_Health get_user_health sender 
        
        
get_msg_arg_string(messageParammessagecharsmax(message)) 
     
        if(
TrieGetCell(RadioDatasmessagehandleCvar) && get_pcvar_string(handleCvarmessagecharsmax(message))) 
        { 
            
formatex(strcharsmax (str ), "^3[^4%s^3]^1:^4 %n^x01 (RADIO) (^4HP^1:^x03%d^x01):^x04 %s"g_eSettings[VarTagPrefixWithoutColor], sender sz_Health message )  
             
            
set_msg_arg_string(3str)  
        }  
        return 
PLUGIN_CONTINUE   

Thanks for the links and the code I was looking for but I didn't know where to find it.
__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/
iceeedr is offline
Send a message via Skype™ to iceeedr
Reply


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 11:01.


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