Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Plugin generated by AMXX-Studio */
- #include < amxmodx >
- //You Can Find Colors At The Hudmessage Generator or here http://web.njit.edu/~kevin/rgb.txt.html//
- #define LOG
- #pragma tabsize 0
- enum _:Cchat
- {
- WriteString[20],
- Color1,
- Color2,
- Color3
- }
- new const Chatsz[][Cchat] =
- {
- {"@b",0, 0, 255},
- {"@r",255,0,0},
- {"@g",0, 255, 0}
- //Add More Colors Here
- }
- enum _:AGroups
- {
- Name[12],
- R,
- G,
- B,
- Effect,
- Flag
- }
- new const szGroups[ ][ AGroups ] = {
- { "Owner", 0, 0, 0, 1, ADMIN_IMMUNITY },
- { "Manager", 0, 127, 255, 1, ADMIN_RESERVATION },
- { "Admin", 0, 255, 127, 0, ADMIN_LEVEL_C },
- { "VIP", 255, 255, 255, 0, ADMIN_CHAT }
- }
- new Float: g_flPositions[ 2 ][ 4 ][ 2 ] = {
- {
- { 0.07, 0.57 },
- { 0.07, 0.60 },
- { 0.07, 0.63 },
- { 0.07, 0.66 }
- },
- {
- { -1.0, 0.10 },
- { -1.0, 0.13 },
- { -1.0, 0.16 },
- { -1.0, 0.19 }
- }
- }
- new g_iHudPosition, Float: g_flLastTsay[ 33 ]
- #if defined LOG
- new szLogFile[ 24 ];
- #endif
- public plugin_init() {
- register_plugin( "Admin Chat Colored + Select color", "v2.0", "+ColdWar,select colors added by xflane" );
- register_clcmd( "say", "ClCmd_SayHook" );
- #if defined LOG
- get_time( "AdminChat-%y%m%d.log", szLogFile, sizeof szLogFile - 1 );
- #endif
- }
- public ClCmd_SayHook( client )
- {
- new szMessage[ 192 ];
- read_argv( 1, szMessage, sizeof szMessage - 1 );
- remove_quotes( szMessage );
- trim( szMessage );
- if( !( get_user_flags( client ) & ADMIN_CHAT ) )
- return 0;
- else if( !StartWith( szMessage, "@" ) )
- return 0;
- else if( get_gametime( ) - g_flLastTsay[ client ] < 1.0 )
- {
- ColorChat( client, "^4[AMXX]^1 You need to wait more ^4%.1f^1 to use ^3admin chat^1.", 0.5 - ( get_gametime( ) - g_flLastTsay[ client ] ) )
- return 1;
- }
- else
- {
- new Color1s = 0
- new Color2s = 0
- new Color3s = 0
- for( new i; i < sizeof Chatsz; i++)
- {
- if(StartWith(szMessage,Chatsz[ i ][ WriteString ]))
- {
- Color1s = Chatsz[i][Color1]
- Color2s = Chatsz[i][Color2]
- Color3s = Chatsz[i][Color3]
- replace( szMessage, sizeof szMessage - 1, Chatsz[ i ][ WriteString ] , "" );
- }
- }
- if(Color1s == 0 && Color2s == 0 && Color3s == 0){
- Color1s = random(255)
- Color2s = random(255)
- Color3s = random(255)
- }
- new g_iPos = StartWith( szMessage, "@@" );
- replace( szMessage, sizeof szMessage - 1, g_iPos ? "@@" : "@", "" );
- if( !strlen( szMessage ) )
- return 1;
- new szName[ 32 ], groupid;
- get_user_name( client, szName, sizeof szName- 1 );
- groupid = GetGroupID( get_user_flags( client ) );
- set_hudmessage( Color1s, Color2s, Color3s, g_flPositions[ g_iPos ][ g_iHudPosition ][ 0 ], g_flPositions[ g_iPos ][ g_iHudPosition ][ 1 ], szGroups[ groupid ][ Effect ], 0.0, 12.0, 0.0, 0.0, g_iHudPosition );
- replace_all( szMessage, sizeof szMessage - 1, "%n", "^n" );
- show_hudmessage( 0, "[ %s ] %s : %s", szGroups[ groupid ][ Name ], szName, szMessage );
- replace_all( szMessage, sizeof szMessage - 1, "^n", " " );
- ColorChat( 0, "^4[ ^1%s ^4] ^3%s^1 : ^4%s", szGroups[ groupid ][ Name ], szName, szMessage );
- #if defined LOG
- new auth[ 35 ], ip[ 26 ];
- get_user_authid( client, auth, sizeof auth - 1 );
- get_user_ip( client, ip, sizeof ip - 1, 1 );
- log_to_file( szLogFile, "[%s] %s < %s >< %s > says: %s.", szGroups[ groupid ][ Name ], szName, auth, ip, szMessage );
- #endif
- g_iHudPosition ++;
- g_flLastTsay[ client ] = get_gametime( );
- if( g_iHudPosition > 3 )
- g_iHudPosition = 0;
- return 1;
- }
- return 0;
- }
- stock StartWith( Msg[ ], Msg2[ ] )
- {
- return( equal( Msg, Msg2, strlen( Msg2 ) ) );
- }
- stock GetGroupID( flags )
- {
- for( new i = 0 ; i < sizeof szGroups ; i ++ )
- {
- if( flags & szGroups[ i ][ Flag ] )
- return i;
- }
- return -1;
- }
- stock ColorChat( index, message[], any:... )
- {
- if( index && !is_user_connected( index ) || !index && !get_playersnum( ) )
- return 0;
- static szMessage[ 242 ];
- vformat( szMessage, charsmax( szMessage ), message, 3 );
- static st_msgid;
- if( !st_msgid )
- st_msgid = get_user_msgid( "SayText" );
- if( index )
- {
- message_begin( MSG_ONE_UNRELIABLE, st_msgid, _, index );
- write_byte( index );
- write_string( szMessage );
- message_end( );
- }
- else
- {
- static cc_glb_maxclients;
- if( !cc_glb_maxclients )
- cc_glb_maxclients = get_maxplayers( );
- for( index = 1 ; index <= cc_glb_maxclients ; index ++ )
- {
- if( !is_user_connected( index ) )
- continue;
- message_begin( MSG_ONE_UNRELIABLE, st_msgid, _, index );
- write_byte( index );
- write_string( szMessage );
- message_end( );
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement