Как сейчас сделано FLAG_C стоит два флага pt не показывает ничего, только показывает что вип.
- Код: Выделить всё
#include <amxmodx>
#if AMXX_VERSION_NUM < 183
#include <colorchat> // AMXX 1.8.3-dev since hg185 has its own colorchat support
#define print_team_default DontChange
#define print_team_grey Grey
#define print_team_red Red
#define print_team_blue Blue
#endif
/*---------------EDIT ME------------------*/
#define FLAG_A ADMIN_BAN
#define FLAG_B ADMIN_LEVEL_H // flag 't' by default; comment to disable processing
#define FLAG_C ADMIN_LEVEL_D | ADMIN_LEVEL_H // flag 'n' by default; uncomment to enable processing
#define CHECK_CMD_A "/admin"
#define CHECK_CMD_B "/vip"
#define CHECK_CMD_C "/girl" // comment to disable
#define SHOW_CONTACT // comment to hide
/* has meaning only if you use '^3' colour tag in PL_CONTACT or 'PL_FLAG_X_PREFIX'
for 'print_team_default' which colour player see depends on the team he belongs,
set 'print_team_grey', 'print_team_red' or 'print_team_blue' to force particular team colour */
const CONTACT_TEAM_COLOUR = print_team_default
const A_PREFIX_TEAM_COLOUR = print_team_red
const B_PREFIX_TEAM_COLOUR = print_team_blue
const C_PREFIX_TEAM_COLOUR = print_team_grey
/*----------------------------------------*/
#define PLUGIN "Player Lists"
#define AUTHOR "Safety1st"
#define VERSION "2.1"
const MAX_CLIENTS = 32
const MAX_MSG_LENGTH = 96 // 128 (max readable msg length) - 32 (max nick length) = 96 bytes
const MAX_NAME_LENGTH = 32
const CHAT_COLOR_NORMAL = 1
const CHAT_COLOR_GREEN = 4
enum _:Lists {
LIST_A
#if defined FLAG_B
, LIST_B
#endif
#if defined FLAG_C
, LIST_C
#endif
}
new const gszLangKey[][] = {
"PL_FLAG_A_PREFIX",
"PL_FLAG_B_PREFIX",
"PL_FLAG_C_PREFIX"
}
new const giTeamColour[] = {
A_PREFIX_TEAM_COLOUR,
B_PREFIX_TEAM_COLOUR,
C_PREFIX_TEAM_COLOUR
}
public plugin_init() {
register_plugin( PLUGIN, VERSION, AUTHOR )
register_dictionary( "player_lists.txt" )
RegisterChatCmds()
}
RegisterChatCmds() {
new szTemp[32]
formatex( szTemp, charsmax(szTemp), "say %s", CHECK_CMD_A )
register_clcmd( szTemp, "HandleChatCmds" )
formatex( szTemp, charsmax(szTemp), "say_team %s", CHECK_CMD_A )
register_clcmd( szTemp, "HandleChatCmds" )
#if defined CHECK_CMD_B
formatex( szTemp, charsmax(szTemp), "say %s", CHECK_CMD_B )
register_clcmd( szTemp, "HandleChatCmds" )
formatex( szTemp, charsmax(szTemp), "say_team %s", CHECK_CMD_B )
register_clcmd( szTemp, "HandleChatCmds" )
#endif
#if defined CHECK_CMD_C
formatex( szTemp, charsmax(szTemp), "say %s", CHECK_CMD_C )
register_clcmd( szTemp, "HandleChatCmds" )
formatex( szTemp, charsmax(szTemp), "say_team %s", CHECK_CMD_C )
register_clcmd( szTemp, "HandleChatCmds" )
#endif
}
public HandleChatCmds(id) {
set_task( 0.1, "PrintInfo", id )
return PLUGIN_CONTINUE
}
public PrintInfo(player) {
if( !is_user_connected(player) )
// there was a delay therefore we must check whether player is on server now
return
new szNames[MAX_CLIENTS + 1][MAX_NAME_LENGTH], iPlayerTypes[MAX_CLIENTS + 1]
new iPlayers[32], iPlayerQty, iPlayer, iFlags, iList, iTotalQuantity, iQuantity[Lists]
get_players( iPlayers, iPlayerQty )
for( new i; i < iPlayerQty; i++ ) {
iPlayer = iPlayers[i]
iFlags = get_user_flags(iPlayer)
if( iFlags & FLAG_A )
iList = LIST_A
#if defined FLAG_B
else if( iFlags & FLAG_B )
iList = LIST_B
#endif
#if defined FLAG_C
else if( iFlags & FLAG_C )
iList = LIST_C
#endif
else
continue
get_user_name( iPlayer, szNames[iTotalQuantity], charsmax( szNames[] ) )
iPlayerTypes[iTotalQuantity++] = iList
iQuantity[iList]++
}
for( iList = 0; iList < Lists; iList++ )
PrintList( player, szNames, iPlayerTypes, iTotalQuantity, iList, iQuantity[iList], gszLangKey[iList], giTeamColour[iList] )
#if defined SHOW_CONTACT
client_print_color( player, CONTACT_TEAM_COLOUR, "%L", player, "PL_CONTACT" )
#endif
}
PrintList( id, names[][], types[], total_quantity, list, list_quantity, const prefix[], const team_colour ) {
static szMessage[191], szNextLineColour[2]
new iLen = formatex( szMessage, charsmax(szMessage), "%L ", id, prefix )
if( !list_quantity ) {
formatex( szMessage[iLen], charsmax(szMessage) - iLen, "%L", id, "PL_NONE_ONLINE" )
client_print_color( id, team_colour, szMessage )
return
}
new j
new iColour = szMessage[iLen - 2] // the last symbol in prefix must be colour tag for nicknames
if( CHAT_COLOR_GREEN < iColour < CHAT_COLOR_NORMAL )
iColour = CHAT_COLOR_NORMAL
szNextLineColour[0] = iColour // set leading colour tag
for( new i = 0 ; i < total_quantity; i++ ) {
if( types[i] != list )
continue
if( ++j == list_quantity /* last item */ ) {
iLen += formatex( szMessage[iLen], charsmax(szMessage) - iLen, "%s", names[i] )
break
}
iLen += formatex( szMessage[iLen], charsmax(szMessage) - iLen, "%s%s", names[i], ", " )
if( iLen > MAX_MSG_LENGTH ) {
client_print_color( id, team_colour, szMessage ) // print current buffer
iLen = formatex( szMessage, charsmax(szMessage), "%s", szNextLineColour ) // free buffer & create next line leading colout tag
}
}
client_print_color( id, team_colour, szMessage )
}