Raised This Month: $32 Target: $400
 8% 

Double message error


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
supertrio17
Senior Member
Join Date: May 2020
Location: Serbia
Old 05-24-2020 , 16:46   Double message error
Reply With Quote #1

Hi, this is plugin that gives you prefix when you have your setinfo "vip" set to 1.

Error is that when I try to type in chat, there is 2 messages

Something like this:
PHP Code:
#include < amxmodx >
#include < hamsandwich >

#define IsValidPlayer(%0)    ( 1 <= %0 <= g_iMaxPlayers )

new g_bConnected33 ] = false;
new 
g_bAlive33 ] = false;
new 
g_iTeam33 ];
new 
g_szName33 ][ 32 ];
new 
boolg_bHasPrefix33 ] = false;

new 
g_iMessageChat;
new 
g_iMaxPlayers;

public 
plugin_init( ) {
    
register_plugin"VIP: Chat Prefix for user info""3.0""Milutinke (ByM)" );
    
    
RegisterHamHam_Spawn"player""fw_HamPlayerSpawnPost", .Post true );
    
    
register_event"TeamInfo""fw_EventTeamInfo""a" );
    
    
register_clcmd"say""fw_ChatPrefix" );
    
register_clcmd"say_team""fw_ChatPrefixTeam" );
    
    
g_iMessageChat get_user_msgid"SayText" );
    
g_iMaxPlayers get_maxplayers( );
}

public 
fw_HamPlayerSpawnPostiPlayer ) {
    
g_bConnectediPlayer ] = boolis_user_connectediPlayer );
    
g_bAliveiPlayer ] = boolis_user_aliveiPlayer );
}

public 
client_connectiPlayer ) {
    
g_bHasPrefixiPlayer ] = false;
    
g_bConnectediPlayer ] = false;
    
g_bAliveiPlayer ] = false;
    
g_iTeamiPlayer ] = 0;
}

public 
client_putinserveriPlayer 
    
g_bConnectediPlayer ] = true;

public 
client_authorizediPlayer ) {
    
get_user_nameiPlayerg_szNameiPlayer ], charsmaxg_szName[ ] ) );
    
    new 
szInfo32 ];
    if( 
get_user_infoiPlayer"vip"szInfocharsmaxszInfo ) ) ) {
        
trimszInfo );
        
        if( 
szInfo] == EOS )
            return;
            
        
g_bHasPrefixiPlayer ] = boolequalszInfo"1" );
    }
}

public 
client_disconnectiPlayer ) {
    
g_szNameiPlayer ][ ] = EOS;
    
g_bHasPrefixiPlayer ] = false;
    
g_bConnectediPlayer ] = false;
    
g_bAliveiPlayer ] = false;
    
g_iTeamiPlayer ] = 0;
}

public 
client_infochangediPlayer ) {
    new 
szName32 ];
    
get_user_nameiPlayerszNamecharsmaxszName ) );
    
    if( !
equalg_szNameiPlayer ], szName ) )
        
copyg_szNameiPlayer ], charsmaxg_szName[ ] ), szName );
}

public 
fw_EventTeamInfo( ) {
    new 
iPlayer read_data);
    
    if( !
g_bConnectediPlayer ] )
        return 
PLUGIN_CONTINUE;
    
    new 
szTeam12 ];
    
read_data2szTeamcharsmaxszTeam ) );
    
    switch( 
szTeam] ) {
        case 
'T' :  g_iTeamiPlayer ] = 1;
        case 
'C' :  g_iTeamiPlayer ] = 2;
        case 
'S' :  g_iTeamiPlayer ] = 3;
        default: 
g_iTeamiPlayer ] = 4;
    }
    
    return 
PLUGIN_CONTINUE;
}

public 
fw_ChatPrefixiPlayer ) {
    if( !
g_bConnectediPlayer ] || !IsValidPlayeriPlayer ) )
        return 
2;
        
    static 
szSaid191 ];
    
read_argsszSaidcharsmaxszSaid ) );
    
remove_quotesszSaid );
    
    return 
ChatPrefixiPlayerszSaidcharsmaxszSaid ), false );
}

public 
fw_ChatPrefixTeamiPlayer ) {
    if( !
g_bConnectediPlayer ] || !IsValidPlayeriPlayer ) )
        return 
2;
        
    static 
szSaid191 ];
    
read_argsszSaidcharsmaxszSaid ) );
    
remove_quotesszSaid );
    
    return 
ChatPrefixiPlayerszSaidcharsmaxszSaid ), true );
}

public 
ChatPrefix( const iPlayerszSaid[ ], const iSaidLength, const bTeamChat ) {
    static 
szMessage191 ], iPlayers;

    if( !
szSaid] )
        return 
2;
    
    static 
szTeam20 ];
        
    switch( 
get_user_teamiPlayer ) ) {
        case 
1copyszTeamcharsmaxszTeam ), "(Terrorist) " );
        case 
2copyszTeamcharsmaxszTeam ), "(Counter-Terrorist) " );
        case 
3copyszTeamcharsmaxszTeam ), "(Spectator) " );
        default: 
copyszTeamcharsmaxszTeam ), "(Unassigned) " );
    }
    
    
formatexszMessagecharsmaxszMessage ), "!n%s%s%s!t%s: !n%s", !g_bAliveiPlayer ] ? "*Dead* " ""bTeamChat szTeam ""g_bHasPrefixiPlayer ] ? "!g[VIP] " ""g_szNameiPlayer ], szSaid );
    
replace_allszMessagecharsmaxszMessage ), "%""" );
    
replace_allszMessagecharsmaxszMessage ), "!n""^x01" );
    
replace_allszMessagecharsmaxszMessage ), "!r""^x02" );
    
replace_allszMessagecharsmaxszMessage ), "!g""^x04" );
    
replace_allszMessagecharsmaxszMessage ), "!t""^x03" );
    
trimszMessage );
    
    for( 
iPlayers 1iPlayers <= g_iMaxPlayersiPlayers ++ ) {
        if( !
g_bConnectediPlayers ] )
            continue;
        
        if( !
g_bAliveiPlayer ] && g_bAliveiPlayers ] )
            continue;
        
        if( 
bTeamChat ) {
            if( 
get_user_teamiPlayer ) != get_user_teamiPlayers ) )
                continue;
        }
        
        
message_beginMSG_ONEg_iMessageChat, { 00}, iPlayers );
        
write_byteiPlayer );
        
write_stringszMessage );
        
message_end( );
    }
    
    return 
2;

Can anyone help?

Last edited by supertrio17; 05-24-2020 at 16:49.
supertrio17 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 05-24-2020 , 17:09   Re: Double message error
Reply With Quote #2

You have 2 plugins that do the same.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
supertrio17
Senior Member
Join Date: May 2020
Location: Serbia
Old 05-24-2020 , 17:42   Re: Double message error
Reply With Quote #3

Quote:
Originally Posted by OciXCrom View Post
You have 2 plugins that do the same.
Yea, that was actually it, but I have different problem now. When i try to send message in admin chat: team_say:@123 it sends it in admin chat and in normal
supertrio17 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-24-2020 , 20:42   Re: Double message error
Reply With Quote #4

According to the adminchat plugin that implements the admin @ messages, it will block any plugins that come after it in plugins.ini from seeing that it was typed at all. So, put the problem plugin after adminchat.amxx in plugins.ini. Otherwise, you need to fix the plugin that is printing it to chat.
__________________
fysiks is offline
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 03:38.


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