Raised This Month: $ Target: $400
 0% 

CSGO SayText2


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TheKiwI
Member
Join Date: May 2011
Old 01-23-2013 , 16:27   CSGO SayText2
Reply With Quote #1

Hi, last csgo update broke SayText2.
If someone know how i can adapt this code please ?

PHP Code:
AddCommandListener(HookPlayerChat"say"); 
PHP Code:
    public Action:HookPlayerChat(client, const String:command[], args)
{    
    ...
    ...
                        
decl String:szText[256];
                        
szText[0] = '\0';
                        
GetCmdArg(1szTextsizeof(szText));

                        new 
String:name[50];
                        
GetClientName(clientnamesizeof(name));
                    
                        new 
Handle:hMessage StartMessageAll("SayText2");
                        if (
hMessage != INVALID_HANDLE)
                        {
                            
BfWriteByte(hMessageclient);
                            
BfWriteByte(hMessagetrue);
                            
BfWriteString(hMessage"\x01\x0B\x04[Admin] \x03%s1 : %s2");
                            
BfWriteString(hMessagename);
                            
BfWriteString(hMessageszText);
                            
EndMessage();
                            
                            return 
Plugin_Handled;
                        }
   ...
   ...

Thanks
__________________

Last edited by TheKiwI; 01-24-2013 at 12:42.
TheKiwI is offline
mcpan313
Senior Member
Join Date: Mar 2010
Old 01-23-2013 , 16:59   Re: CSGO SayText2
Reply With Quote #2

see https://forums.alliedmods.net/showth...90#post1878490
__________________
sorry, for my poor english.
mcpan313 is offline
Send a message via MSN to mcpan313
TheKiwI
Member
Join Date: May 2011
Old 01-24-2013 , 09:58   Re: CSGO SayText2
Reply With Quote #3

Yes, I already read the whole topic but it's not clear for me...
__________________
TheKiwI is offline
TheKiwI
Member
Join Date: May 2011
Old 01-29-2013 , 15:21   Re: CSGO SayText2
Reply With Quote #4

I tried this method but show nothing ...
If anyone know how to do please ?

PHP Code:
public OnPluginStart()
{
    
AddCommandListener(HookPlayerChat"say");

PHP Code:
public Action:HookPlayerChat(client, const String:command[], args)
{    
    if((
client != 0) && IsClientInGame(client))
    {
        if(
CheckCommandAccess(client"" ,ADMFLAG_SLAYtrue))
        {
            
decl String:szText[256];
            
szText[0] = '\0';
            
            
GetCmdArg(1szTextsizeof(szText));
            
            if (
szText[0] == '/' || szText[0] == '\0')
            {
                return 
Plugin_Continue;
            }
            
            else
            {    
                if(
GetClientTeam(client) == 1)
                {
                    
PrintToChatAll("\x01\x0B\x01*SPEC* \x04[Admin] \x01%N : %s",clientszText);
                    return 
Plugin_Handled;
                }
                    
                else
                {
                    new 
String:name[50];
                    
GetClientName(clientnamesizeof(name));
                
                    if(
IsPlayerAlive(client))
                    {    
                        
Format(szTextsizeof(szText), "\x01\x0B\x04[Admin] \x03%s : %s"nameszText);
                    }
                    else
                    {                        
                        
Format(szTextsizeof(szText), "\x01\x0B\x03*DEAD* \x04[Admin] \x03%s : %s"nameszText);
                    }
                    
                    for (new 
1iClients GetClientCount(); <= iClientsi++) 
                    {
                        if (
IsClientInGame(i) && !IsFakeClient(i)) 
                        {
                            
SayText2(iszText);
                        }
                    }
                    
                    return 
Plugin_Handled;
                }
            }
        }
    }
    
    return 
Plugin_Continue;
}

SayText2(to, const String:message[]) 
{
    new 
Handle:hMessage StartMessageOne("SayText2"to);
    if (
hMessage != INVALID_HANDLE)
    {
        if (
GetUserMessageType() == UM_Protobuf)
        {
            
PbSetBool(hMessage"chat"true);
            
PbSetInt(hMessage"ent_idx"to);
            
PbAddString(hMessage"params"message);
            
PbAddString(hMessage"params""");
            
PbAddString(hMessage"params""");
            
PbAddString(hMessage"params""");
            
PbAddString(hMessage"params""");
        }
        else
        {        
            
BfWriteByte(hMessageto);
            
BfWriteByte(hMessagetrue);
            
BfWriteString(hMessagemessage);
        }
        
        
EndMessage();
    }

__________________

Last edited by TheKiwI; 01-29-2013 at 15:24.
TheKiwI is offline
Sheepdude
SourceMod Donor
Join Date: Aug 2012
Location: Chicago
Old 01-29-2013 , 20:58   Re: CSGO SayText2
Reply With Quote #5

Change
Code:
PbAddString(hMessage, "params", message);
to
Code:
PbSetString(hMessage, "msg_name", message);
You forgot the msg_name field, which is the first line of the message. The params lines supply additional parameters, such as player names, i.e. if msg_name was "%s killed %s".
__________________
Sheepdude is offline
TheKiwI
Member
Join Date: May 2011
Old 01-30-2013 , 11:14   Re: CSGO SayText2
Reply With Quote #6

Thanks !
__________________
TheKiwI 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:58.


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