if(get_user_flags(id) & ADMIN_IMMUNITY)
//Пример с использованием доп. флага выдачи главному админу.
//Проверяем оба ли флага на игроке.
if((get_user_flags(id) & (ADMIN_IMMUNITY|ADMIN_CFG)) == (ADMIN_IMMUNITY|ADMIN_CFG)){
//то забанить нельзя гл админа
}
else if(get_user_flags(id) & ADMIN_IMMUNITY){
// то банить обычного админа нельзя.
}
get_user_flags(id) & (ADMIN_IMMUNITY|ADMIN_CFG) == (ADMIN_IMMUNITY|ADMIN_CFG) ? /*не баним*/ : /*иначе бан*/
#include <amxmodx>
#include <amxmisc>
#define ADMIN (ADMIN_BAN | ADMIN_RESERVATION)
new msg_block[128]
new tabul[9][] = {
"^t", //0
" ^t", //1
" ^t", //2
" ^t", //3
" ^t", //4
" ^t", //5
" ^t", //6
" ^t", //7
" ^t"}; //8
public plugin_init()
{
register_plugin("block ip", "0.2", "legenda");
register_concmd("amx_readip", "readip", ADMIN, "- displays ip who is on server")
register_concmd("amx_ip", "menu_chooseuserforblockip", ADMIN, "- displays menu for ban ip or network")
}
public readip(id, level, cid)
{
if (!cmd_access(id, level, cid, 0))
return PLUGIN_HANDLED
new inum, iPlayers[32], nickname[32], ip[32], msg[128]
get_players(iPlayers, inum)
client_print(id,print_console,"==================================================^n Users:%d",inum)
client_print(id,print_console,"# ^t^t^t^tip addres^t^t^t^t^t^tname")
for (new i = 0; i < inum; ++i)
{
new player = iPlayers
get_user_name(player,nickname,31)
get_user_ip(player,ip,31)
format(nickname,10, "%s",nickname)
new i_tabul = 21-strlen(ip)
(i <=9) ? format(msg,127,"[%d] ^t%s%s%s",i+1,ip,tabul[i_tabul],nickname) : format(msg,127,"[%d]^t%s%s%s",i+1,ip,tabul[i_tabul],nickname)
client_print(id,print_console,msg)
}
client_print(id,print_console,"==================================================^n^n")
return PLUGIN_HANDLED
}
public menu_chooseuserforblockip(id, level, cid)
{
if (!cmd_access(id, level, cid, 0))
return PLUGIN_HANDLED
new p_Menu = menu_create("\d[\rБлокировка по IP\d]", "menu_chooose_user")
new s_Players[32], i_Num, i_Player
new s_Name[32], s_Player[10]
get_players(s_Players, i_Num)
for (new i; i < i_Num; i++)
{
i_Player = s_Players
get_user_name(i_Player, s_Name, charsmax(s_Name))
num_to_str(i_Player, s_Player, charsmax(s_Player))
menu_additem(p_Menu, s_Name, s_Player, 0)
}
menu_display(id, p_Menu, 0)
return PLUGIN_HANDLED
}
public menu_chooose_user(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new s_Data[6], s_Name[64], i_Access, i_Callback, nickname[32]
menu_item_getinfo(menu, item, i_Access, s_Data, charsmax(s_Data), s_Name, charsmax(s_Name), i_Callback)
new i_Player = str_to_num(s_Data)
get_user_name(i_Player,nickname,31)
choose_network(id, i_Player)
menu_destroy(menu)
return PLUGIN_HANDLED
}
public choose_network(id, i_Player)
{
new player_ip[23]
get_user_ip(i_Player, player_ip, 22,1)
replace_all(player_ip,22,"."," ")
new user_name_admin[32],user_name_block[32]
get_user_name(id,user_name_admin,31)
get_user_name(i_Player,user_name_block,31)
format(msg_block, 127, "%s block %s", user_name_admin, user_name_block)
new ip_Menu = menu_create("\d[\rВыбор IP\d]^n\d[\rБлокировка \yПЕРМАНЕНТНО\d]^n\d[\rБлокировка без оповещений\d]", "menu_block_network")
new okteta1[4],okteta2[4],okteta3[4],okteta4[4]
parse(player_ip,okteta1,charsmax(okteta1),okteta2,charsmax(okteta2),okteta3,charsmax(okteta3),okteta4,charsmax(okteta4))
new n0[23], n1[23], n2[23], n3[23]
format(n0, 22, "%s.%s.%s.%s", okteta1, okteta2,okteta3,okteta4)
format(n1, 22, "%s.%s.%s.0", okteta1, okteta2,okteta3)
format(n2, 22, "%s.%s.0.0", okteta1, okteta2)
format(n3, 22, "%s.0.0.0", okteta1)
// menu_addtext(ip_Menu, "XXXX")
menu_additem(ip_Menu, n0,n0, 0)
menu_additem(ip_Menu, n1,n1, 0)
menu_additem(ip_Menu, n2,n2, 0)
menu_additem(ip_Menu, n3,n3, 0)
menu_display(id, ip_Menu, 0)
return PLUGIN_HANDLED
}
public menu_block_network(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new s_Data[23], s_Name[64], i_Access, i_Callback
menu_item_getinfo(menu, item, i_Access, s_Data, charsmax(s_Data), s_Name, charsmax(s_Name), i_Callback)
server_cmd("addip 0 %s ; wait;wait;wait; writeip", s_Data)
client_print(id,print_console,"^n^n===========[Вы были забанины]===========")
client_print(id,print_console,"%s ip is: %s",msg_block, s_Data)
client_print(id,print_console,"=====[Заявка на разбан - https://vk.com/]=====^n^n")
log_to_file("block_ip.log","%s ip is: %s",msg_block, s_Data)
menu_destroy(menu)
return PLUGIN_HANDLED
}
не знаю сработает ли так, это у тебя просто задефайнено, но проверка только на функции висит (!cmd_access).. а не в условии, попробуй так, если несработает тогда добавь как я тебе писал вышеwellasgood, так ?
#include <amxmodx>
#include <amxmisc>
#define ADMIN (ADMIN_BAN | ADMIN_RESERVATION)
new msg_block[128]
new tabul[9][] = {
"^t", //0
" ^t", //1
" ^t", //2
" ^t", //3
" ^t", //4
" ^t", //5
" ^t", //6
" ^t", //7
" ^t"}; //8
public plugin_init()
{
register_plugin("block ip", "0.2", "legenda");
register_concmd("amx_readip", "readip", ADMIN, "- displays ip who is on server")
register_concmd("amx_ip", "menu_chooseuserforblockip", ADMIN, "- displays menu for ban ip or network")
}
public readip(id, level, cid)
{
if (!cmd_access(id, level, cid, 0))
return PLUGIN_HANDLED
new inum, iPlayers[32], nickname[32], ip[32], msg[128]
get_players(iPlayers, inum)
client_print(id,print_console,"==================================================^n Users:%d",inum)
client_print(id,print_console,"# ^t^t^t^tip addres^t^t^t^t^t^tname")
for (new i = 0; i < inum; ++i)
{
new player = iPlayers
get_user_name(player,nickname,31)
get_user_ip(player,ip,31)
format(nickname,10, "%s",nickname)
new i_tabul = 21-strlen(ip)
(i <=9) ? format(msg,127,"[%d] ^t%s%s%s",i+1,ip,tabul[i_tabul],nickname) : format(msg,127,"[%d]^t%s%s%s",i+1,ip,tabul[i_tabul],nickname)
client_print(id,print_console,msg)
}
client_print(id,print_console,"==================================================^n^n")
return PLUGIN_HANDLED
}
public menu_chooseuserforblockip(id, level, cid)
{
if (!cmd_access(id, level, cid, 0))
return PLUGIN_HANDLED
new p_Menu = menu_create("\d[\rБлокировка по IP\d]", "menu_chooose_user")
new s_Players[32], i_Num, i_Player
new s_Name[32], s_Player[10]
get_players(s_Players, i_Num)
for (new i; i < i_Num; i++)
{
i_Player = s_Players
get_user_name(i_Player, s_Name, charsmax(s_Name))
num_to_str(i_Player, s_Player, charsmax(s_Player))
menu_additem(p_Menu, s_Name, s_Player, 0)
}
menu_display(id, p_Menu, 0)
return PLUGIN_HANDLED
}
public menu_chooose_user(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new s_Data[6], s_Name[64], i_Access, i_Callback, nickname[32]
menu_item_getinfo(menu, item, i_Access, s_Data, charsmax(s_Data), s_Name, charsmax(s_Name), i_Callback)
new i_Player = str_to_num(s_Data)
get_user_name(i_Player,nickname,31)
choose_network(id, i_Player)
menu_destroy(menu)
return PLUGIN_HANDLED
}
public choose_network(id, i_Player)
{
new player_ip[23]
get_user_ip(i_Player, player_ip, 22,1)
replace_all(player_ip,22,"."," ")
new user_name_admin[32],user_name_block[32]
get_user_name(id,user_name_admin,31)
get_user_name(i_Player,user_name_block,31)
format(msg_block, 127, "%s block %s", user_name_admin, user_name_block)
new ip_Menu = menu_create("\d[\rВыбор IP\d]^n\d[\rБлокировка \yПЕРМАНЕНТНО\d]^n\d[\rБлокировка без оповещений\d]", "menu_block_network")
new okteta1[4],okteta2[4],okteta3[4],okteta4[4]
parse(player_ip,okteta1,charsmax(okteta1),okteta2,charsmax(okteta2),okteta3,charsmax(okteta3),okteta4,charsmax(okteta4))
new n0[23], n1[23], n2[23], n3[23]
format(n0, 22, "%s.%s.%s.%s", okteta1, okteta2,okteta3,okteta4)
format(n1, 22, "%s.%s.%s.0", okteta1, okteta2,okteta3)
format(n2, 22, "%s.%s.0.0", okteta1, okteta2)
format(n3, 22, "%s.0.0.0", okteta1)
// menu_addtext(ip_Menu, "XXXX")
menu_additem(ip_Menu, n0,n0, 0)
menu_additem(ip_Menu, n1,n1, 0)
menu_additem(ip_Menu, n2,n2, 0)
menu_additem(ip_Menu, n3,n3, 0)
menu_display(id, ip_Menu, 0)
return PLUGIN_HANDLED
}
public menu_block_network(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new s_Data[23], s_Name[64], i_Access, i_Callback
menu_item_getinfo(menu, item, i_Access, s_Data, charsmax(s_Data), s_Name, charsmax(s_Name), i_Callback)
server_cmd("addip 0 %s ; wait;wait;wait; writeip", s_Data)
client_print(id,print_console,"^n^n===========[Вы были забанины]===========")
client_print(id,print_console,"%s ip is: %s",msg_block, s_Data)
client_print(id,print_console,"=====[Заявка на разбан - https://vk.com/]=====^n^n")
log_to_file("block_ip.log","%s ip is: %s",msg_block, s_Data)
menu_destroy(menu)
return PLUGIN_HANDLED
}