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

Hide grenade msg. Trouble with Pb.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kailo
Senior Member
Join Date: Sep 2014
Location: Moscow, Russia
Old 02-03-2015 , 16:15   Hide grenade msg. Trouble with Pb.
Reply With Quote #1

I hooked msg, but get Native Error when try Read "msg_name" as String, as Int, as message and as repeted too. I need hide only Decoy's msg, not all. I use search in bins and find only this. Help me, pls.
Code:
CCSUsrMsg_RadioText
msg_dst (
client (
msg_name (	
params (	""
My code:
PHP Code:
public OnPluginStart()
{
    
HookUserMessage(GetUserMessageId("RadioText"), OnRadioTexttrue);
}

public 
Action:OnRadioText(UserMsg:msg_idHandle:hBf, const iaPlayers[], iPlayersNumbool:bReliablebool:bInit
{
    new 
String:sText[512];
    if (
GetUserMessageType() == UM_Protobuf) {
        
PrintToServer("msg_dst: %d, client: %d"PbReadInt(hBf"msg_dst"), PbReadInt(hBf"client"));
        
PbReadString(hBf"msg_name"sText5120);
        
PrintToServer("%s"sText);
        
PbReadString(hBf"params"sText5120);
        
PrintToServer("%s"sText);
    } else {
        
BfReadString(hBfsText64);
    }

    return 
Plugin_Continue;


Last edited by Kailo; 02-03-2015 at 16:31.
Kailo is offline
psychonic

BAFFLED
Join Date: May 2008
Old 02-05-2015 , 09:21   Re: Hide grenade msg. Trouble with Pb.
Reply With Quote #2

https://github.com/alliedmodders/hl2...ges.proto#L268
Code:
message CCSUsrMsg_RadioText
{
    optional int32 msg_dst = 1;
    optional int32 client = 2;
    optional string msg_name = 3;
    repeated string params = 4;
}
msg_name is not a repeated field, so instead of sending an index (0), leave the default of PB_FIELD_NOT_REPEATED.

Ex.
Code:
PbReadString(hBf, "msg_name", sText, 512, PB_FIELD_NOT_REPEATED);
or just
Code:
PbReadString(hBf, "msg_name", sText, 512);
psychonic is offline
Kailo
Senior Member
Join Date: Sep 2014
Location: Moscow, Russia
Old 02-05-2015 , 11:40   Re: Hide grenade msg. Trouble with Pb.
Reply With Quote #3

Thank you, psychonic. Solved.
Kailo 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 09:48.


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