AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Colorchat Message_begin error (https://forums.alliedmods.net/showthread.php?t=236973)

proffs 03-15-2014 10:21

Colorchat Message_begin error
 
L 03/15/2014 - 14:16:09: [AMXX] Run time error 10: native error (native "message_begin")
L 03/15/2014 - 14:16:09: [AMXX] [0] LRV1.0.sma::ColorChat (line 2061)
L 03/15/2014 - 14:16:09: [AMXX] [1] LRV1.0.sma::Cmd_LastRequest (line 970)

PHP Code:

ColorChatidcolour, const text[], any:... )
{
    if( !
get_playersnum() )
    {
        return;
    }
    
    static 
message[192];
    
    
message[0] = 0x01;
    
vformat(message[1], sizeof(message) - 1text4);
    
    
replace_all(messagesizeof(message) - 1"!g""^x04");
    
replace_all(messagesizeof(message) - 1"!n""^x01");
    
replace_all(messagesizeof(message) - 1"!t""^x03");
    
    static 
indexMSG_Type;
    
    if( !
id )
    {
        static 
i;
        for(
1<= g_iMaxPlayersi++)
        {
            if( 
g_bConnected[i] )
            {
                
index i;
                break;
            }
        }
        
        
MSG_Type MSG_ALL;
    }
    else
    {
        
MSG_Type MSG_ONE;
        
index id;
    }
    
    static 
bool:bChanged;
    if( 
colour == GREY || colour == RED || colour == BLUE )
    {
        
message_begin(MSG_Typeg_msgTeamInfo_index);
        
write_byte(index);
        
write_string(g_szTeamName[colour]);
        
message_end();
        
        
bChanged true;
    }
    
    
message_begin(MSG_Typeg_msgSayText_index);
    
write_byte(index);
    
write_string(message);
    
message_end();
    
    if( 
bChanged )
    {
        
message_begin(MSG_Typeg_msgTeamInfo_index);
        
write_byte(index);
        
write_string(g_szTeamName[_:cs_get_user_team(index)]);
        
message_end();
    }



Baws 03-15-2014 12:01

Re: Colorchat Message_begin error
 
Use this.

PHP Code:

ColorChatidColor:type, const msg[ ], { FloatSqlResult}:... )
{
        static 
SayText;

        if( !
SayText )
        
SayText get_user_msgid"SayText" );
    
        static 
message256 ];
    
        switch( 
type )
        {
                case 
GREEN// Green
                
{
                        
message] = 0x04;
                }
                case 
TEAM_COLOR// Team Color. Ie. Red (Terrorist) or blue (Counter-Terrorist).
                
{
                        
message] = 0x03;
                }
                default: 
// Yellow.
                
{
                        
message] = 0x01;
                }
        }

        
vformatmessage], 251msg);

        
message192 ] = '^0';

        if( 
id )
        {
                if( 
is_user_connectedid ) )
                {
                        
message_beginMSG_ONESayText, { 00}, id );
                        
write_byteid );
                        
write_stringmessage );
                        
message_end( );
                }
        } 
    
        else 
        {
                static 
Players32 ]; new CountIndex;
                
get_playersPlayersCount );
        
                for( new 
Count i++ )
                {
                        
Index Players];
            
                        
message_beginMSG_ONESayText, { 00}, Index );
                        
write_byteIndex );
                        
write_stringmessage );
                        
message_end( );
            
                }
        }



proffs 03-15-2014 12:12

Re: Colorchat Message_begin error
 
I want to use mine, Can you help me to fix it?

ironskillz1 03-15-2014 12:13

Re: Colorchat Message_begin error
 
Why not use colorchat/chatcolor.inc?

proffs 03-15-2014 12:15

Re: Colorchat Message_begin error
 
Quote:

Originally Posted by ironskillz1 (Post 2111823)
Why not use colorchat/chatcolor.inc?

Because this is a really huge plugin I dont got time to change every part.

Baws 03-15-2014 12:20

Re: Colorchat Message_begin error
 
With the code i gave you, you can fix it by looking at my code and your code. Then you will see that there's something wrong :3


All times are GMT -4. The time now is 06:00.

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