AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   CSGO SayText2 (https://forums.alliedmods.net/showthread.php?t=206539)

TheKiwI 01-23-2013 16:27

CSGO SayText2
 
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 :)

mcpan313 01-23-2013 16:59

Re: CSGO SayText2
 
see https://forums.alliedmods.net/showth...90#post1878490

TheKiwI 01-24-2013 09:58

Re: CSGO SayText2
 
Yes, I already read the whole topic but it's not clear for me...

TheKiwI 01-29-2013 15:21

Re: CSGO SayText2
 
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();
    }



Sheepdude 01-29-2013 20:58

Re: CSGO SayText2
 
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".

TheKiwI 01-30-2013 11:14

Re: CSGO SayText2
 
Thanks ! :)


All times are GMT -4. The time now is 11:04.

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