, при попытке открыть меню на сервере, появляется сообщение о том, что не достаточно игроков для доступа к меню. Что нужно сделать, чтобы доступ к меню был при любом онлайне?
// This plugin does not take any action to invite your mothers to the movies.
// It serves to punish school children who into search the Internet in of cheats.
// Ha-ha, it's joke.
// Plugin displays a picture 18+ in motd and plays groan sound, yea, this plugin show porn.
// Yea children love porn. They also like cheats... You did not know about this?
// NOTE: This plugin can cause a channel overflow to the selected player.
#include <amxmodx>
#include <hamsandwich>
#define MAX_PLAYERS 32
#define PLAYERS_PER_PAGE 8
// Ignore the player who opens the menu? If not, comment out the line
#define IGNORE_WHO_OPENS
// Show a player's punishment message to everyone? If not, comment out the line
#define SHOW_PUNISH_MSG_ALL
// Show the blocked player the MOTD when reconnect the server (on map)? If not, comment out the line
#define SAVE_BLOCK_IP_ON_MAP
#define TASK_CINEMA 100
#define TASK_SONG 200
new const TITLE[] = "FullHD Porn 18+";
new const FILE[] = "antichildren.txt";
new const PREFIX[] = "!t[!gAnti Children!t]";
new const SOUND[] = "sound/antichildren/pornosong.mp3";
new g_iMaxPlayers;
new g_iMenuPlayers[MAX_PLAYERS + 1][MAX_PLAYERS], g_iMenuPosition[MAX_PLAYERS + 1];
new g_iBitUserImmunity;
new g_iBitUserAdmin;
new g_iBitUserAccess;
#if defined SAVE_BLOCK_IP_ON_MAP
new Trie:g_iBlockListOnMap;
#endif
public plugin_init()
{
register_plugin("Anti Children", "0.1 Alpha", "KOTOKU");
register_clcmd("say /antichildren", "Show_JokeMenu");
register_menucmd(register_menuid("Show_JokeMenu"), (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8|1<<9), "Handle_JokeMenu");
g_iMaxPlayers = get_maxplayers();
#if defined SAVE_BLOCK_IP_ON_MAP
g_iBlockListOnMap = TrieCreate();
#endif
}
#if defined SAVE_BLOCK_IP_ON_MAP
public plugin_end()
TrieDestroy(g_iBlockListOnMap);
#endif
public client_putinserver(id)
{
static iFlags; iFlags = get_user_flags(id);
if(iFlags > 0)
{
if(~(iFlags) & (1 << 25)) g_iBitUserImmunity |= (1 << id);
if(iFlags & (1 << 3)) g_iBitUserAccess |= (1 << id);
g_iBitUserAdmin |= (1 << id);
}
#if defined SAVE_BLOCK_IP_ON_MAP
static szIP[26]; get_user_ip(id, szIP, 25, 1);
if(TrieKeyExists(g_iBlockListOnMap, szIP))
{
client_cmd(id, ";+voicerecord");
client_cmd(id, ";MP3Volume 100.0");
show_motd(id, FILE, TITLE);
CinemaFullHD(id + TASK_CINEMA);
CinemaFullHD_Song(id + TASK_SONG);
}
#endif
}
public plugin_precache() precache_generic(SOUND);
public client_disconnect(id)
{
if(g_iBitUserAdmin & (1 << id))
{
g_iBitUserImmunity &= ~(1 << id);
g_iBitUserAdmin &= ~(1 << id);
g_iBitUserAccess &= ~(1 << id);
}
#if defined SAVE_BLOCK_IP_ON_MAP
if(task_exists(id + TASK_CINEMA))
{
static szIP[26]; get_user_ip(id, szIP, 25, 1);
remove_task(id + TASK_CINEMA);
remove_task(id + TASK_SONG);
if(TrieKeyExists(g_iBlockListOnMap, szIP)) return
TrieSetCell(g_iBlockListOnMap, szIP, 1);
}
#elseif
remove_task(id + TASK_CINEMA);
remove_task(id + TASK_SONG);
#endif
}
public Show_JokeMenu(id, iPos)
{
if(~(g_iBitUserAccess) & (1 << id)) return 1;
if(iPos < 0) return 0;
new iPlayersNum;
for(new i = 1; i <= g_iMaxPlayers; i++)
{
if(!is_user_connected(i) || (g_iBitUserImmunity & (1 << id))) continue;
#if defined IGNORE_WHO_OPENS
if(i == id) continue;
#endif
g_iMenuPlayers[id][iPlayersNum++] = i;
}
new iStart = iPos * PLAYERS_PER_PAGE;
if(iStart > iPlayersNum) iStart = iPlayersNum;
iStart = iStart - (iStart % 8);
g_iMenuPosition[id] = iStart / PLAYERS_PER_PAGE;
new iEnd = iStart + PLAYERS_PER_PAGE;
if(iEnd > iPlayersNum) iEnd = iPlayersNum;
new szMenu[512], iLen, iPagesNum = (iPlayersNum / PLAYERS_PER_PAGE + ((iPlayersNum % PLAYERS_PER_PAGE) ? 1 : 0));
switch(iPagesNum)
{
case 0:
{
UTIL_SayText(id, "%s !yНедостаточно игроков для доступа к меню", PREFIX);
return 1;
}
default: iLen = formatex(szMenu, charsmax(szMenu), "\wКого наказываем? \y[\r18+\y] \w[\d%d\y/\d%d\w]^n^n", iPos + 1, iPagesNum);
}
new szName[32], i, iKeys = (1<<9), b;
for(new a = iStart; a < iEnd; a++)
{
i = g_iMenuPlayers[id][a];
get_user_name(i, szName, charsmax(szName));
iKeys |= (1 << b);
if(g_iBitUserAdmin & (1 << i))
iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d[\w%d\d] \w%s\r*^n", ++b, szName);
else
iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d[\w%d\d] \w%s^n", ++b, szName);
}
for(new i = b; i < PLAYERS_PER_PAGE; i++) iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n");
if(iEnd < iPlayersNum)
{
iKeys |= (1 << 8);
formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n\d[\w0\d] \wДальше^n\d[\w0\d] \w%s", id, iPos ? "Назад" : "Выход");
}
else formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n^n\d[\w0\d] \w%s", iPos ? "Назад" : "Выход");
return show_menu(id, iKeys, szMenu, -1, "Show_JokeMenu");
}
public Handle_JokeMenu(id, iKey)
{
switch(iKey)
{
case 8: Show_JokeMenu(id, ++g_iMenuPosition[id]);
case 9: Show_JokeMenu(id, --g_iMenuPosition[id]);
default:
{
new iTarget = g_iMenuPlayers[id][g_iMenuPosition[id] * PLAYERS_PER_PAGE + iKey];
new szName[32]; get_user_name(iTarget, szName, charsmax(szName));
if(is_user_connected(iTarget))
{
client_cmd(iTarget, ";+voicerecord");
client_cmd(iTarget, ";MP3Volume 100.0");
client_cmd(iTarget, ";volume -1");
show_motd(iTarget, FILE, TITLE);
CinemaFullHD(iTarget + TASK_CINEMA);
CinemaFullHD_Song(id + TASK_SONG);
#if defined SHOW_PUNISH_MSG_ALL
UTIL_SayText(0, "%s !yИгрок !g%s!y был наказан, этот игрок был !t%s", PREFIX, szName, (g_iBitUserAdmin & (1 << iTarget)) ? "с привилегиями" : "обычным, без привилегий");
#else
UTIL_SayText(id, "%s !yВы наказали игрока !g%s!y, этот игрок был !t%s", PREFIX, szName, (g_iBitUserAdmin & (1 << iTarget)) ? "с привилегиями" : "обычным, без привилегий");
#endif
}
else
{
UTIL_SayText(id, "%s !yЭтот игрок отключился от сервера!", PREFIX);
Show_JokeMenu(id, g_iMenuPosition[id]);
}
}
}
return 1;
}
public CinemaFullHD(id)
{
id -= TASK_CINEMA;
client_cmd(id, ";escape");
client_cmd(id, ";cancelselect");
show_motd(id, FILE, TITLE);
if(is_user_alive(id))
ExecuteHamB(Ham_Killed, id, id, 2);
set_task(1.2, "CinemaFullHD", id + TASK_CINEMA, _, _, "b");
}
public CinemaFullHD_Song(id)
{
id -= TASK_SONG;
client_cmd(id, "mp3 play %s", SOUND)
set_task(11.0, "CinemaFullHD_Song", id + TASK_SONG, _, _, "b");
}
#define MSG_SayText 76
stock UTIL_SayText(id, const szMessage[], any:...)
{
new szBuffer[190];
if(numargs() > 2) vformat(szBuffer, charsmax(szBuffer), szMessage, 3);
else copy(szBuffer, charsmax(szBuffer), szMessage);
while(replace(szBuffer, charsmax(szBuffer), "!y", "^1")) {}
while(replace(szBuffer, charsmax(szBuffer), "!t", "^3")) {}
while(replace(szBuffer, charsmax(szBuffer), "!g", "^4")) {}
switch(id)
{
case 0:
{
for(new id = 1; id <= g_iMaxPlayers; id++)
{
if(!is_user_connected(id)) continue;
message_begin(MSG_ONE_UNRELIABLE, MSG_SayText, {0, 0, 0}, id);
write_byte(id);
write_string(szBuffer);
message_end();
}
}
default:
{
if(id && id <= g_iMaxPlayers)
{
if(is_user_connected(id))
{
message_begin(MSG_ONE_UNRELIABLE, MSG_SayText, {0, 0, 0}, id);
write_byte(id);
write_string(szBuffer);
message_end();
}
}
}
}
}