Скриптер
Проверенный
Пользователь
- Сообщения
- 3,582
- Реакции
- 1,570
- Помог
- 137 раз(а)
- Ошибка
-
Пропал пункт "Своя причина"
- ОС
- Linux
- Amx Mod X
-
AMX Mod X 1.10.0.5250 (http://www.amxmodx.org)
- Билд
-
ReHLDS version: 3.4.0.668-dev
- ReGamedll
-
ReGameDLL version: 5.7.0.322-dev
- Версия Metamod
-
Metamod-r v1.3.0.128, API (5:13)
- Список метамодулей
-
Currently loaded plugins:
description stat pend file vers src load unload
[ 1] Reunion RUN - reunion_mm_i386.so v0.1.0.133 ini Start Never
[ 2] AMX Mod X RUN - amxmodx_mm_i386.so v1.10.0.5250 ini Start ANY
[ 3] ReAuthCheck RUN - reauthcheck_mm_i386.so v0.1.6 ini Start Never
[ 4] Rechecker RUN - rechecker_mm_i386.so v2.5 ini Chlvl ANY
[ 5] Revoice RUN - revoice_mm_i386.so v0.1.0.32 ini Start Never
[ 6] MySQL RUN - mysql_amxx_i386.so v1.10.0.5250 pl2 ANY ANY
[ 7] SQLite RUN - sqlite_amxx_i386.so v1.10.0.5250 pl2 ANY ANY
[ 8] Fun RUN - fun_amxx_i386.so v1.10.0.5250 pl2 ANY ANY
[ 9] Engine RUN - engine_amxx_i386.so v1.10.0.5250 pl2 ANY ANY
[10] FakeMeta RUN - fakemeta_amxx_i386.so v1.10.0.5250 pl2 ANY ANY
[11] CStrike RUN - cstrike_amxx_i386.so v1.10.0.5250 pl2 ANY ANY
[12] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.10.0.5250 pl2 ANY ANY
[13] hackdetector RUN - hackdetector_amxx_i386.so v0.15.328.lite pl2 ANY ANY
[14] ReAPI RUN - reapi_amxx_i386.so v5.8.0.165-dev pl2 ANY Never
[15] GeoIP RUN - geoip_amxx_i386.so v1.10.0.5250 pl2 ANY ANY
[16] whois RUN - whois_amxx_i386.so v0.2.270 pl2 ANY ANY
[17] CURL AMXX RUN - curl_amxx_i386.so v1.0.4 pl2 ANY ANY
17 plugins, 17 running
- Список плагинов
-
Currently loaded plugins:
name version author file status
[ 1] fb_forwards 0.1.4 Kanagava & Realu fb_forwards.amx running
[ 2] WebHS 0.1 kanagava fb_web_online.a running
[ 3] FreshBans 1.4.0b kanagava fresh_bans_140_ running
[ 4] SF Warn Menu 0.1.4g_edi serfreeman1337/N sf_admin_warns. running
[ 5] CSStatsX SQL 0.7.4+1 serfreeman1337 csstatsx_sql.am running
[ 6] Rank Menu 1.1 h1k3 rankmenu.amxx running
[ 7] AES: StatsX 0.5 Vega serfreeman1337 statsx_cstrike. running
[ 8] Admin Load 3.10.0 F@nt0M adminload.amxx running
[ 9] Admin Commands 1.10.0.525 AMXX Dev Team admincmd.amxx running
[ 10] Admin Help 1.10.0.525 AMXX Dev Team adminhelp.amxx running
[ 11] Menus Front-End 1.10.0.525 AMXX Dev Team menufront.amxx running
[ 12] Commands Menu 1.10.0.525 AMXX Dev Team cmdmenu.amxx running
[ 13] Players Menu 1.10.0.525 AMXX Dev Team plmenu.amxx running
[ 14] Teleport Menu 1.10.0.525 AMXX Dev Team telemenu.amxx running
[ 15] Maps Menu 1.10.0.525 AMXX Dev Team mapsmenu.amxx running
[ 16] Admin Chat 1.10.0.525 AMXX Dev Team adminchat.amxx running
[ 17] Anti Flood 1.10.0.525 AMXX Dev Team antiflood.amxx running
[ 18] Admin Votes 1.10.0.525 AMXX Dev Team adminvote.amxx running
[ 19] Pause Plugins 1.10.0.525 AMXX Dev Team pausecfg.amxx running
[ 20] Stats Configuration 1.10.0.525 AMXX Dev Team statscfg.amxx running
[ 21] AdminMenu 1.1 Nordic Warrior adminmenu.amxx running
[ 22] Admin menu central 0.1 Nordic Warrior adminmenu_centr running
[ 23] Advanced Lottery 0.5.1 Nordic Warrior advanced_lotter running
[ 24] [ReAPI] Advanced Team 0.1.0 Vaqtincha AdvancedTeamCho running
[ 25] Advert Messages 1.22 neygomon adverts.amxx running
[ 26] AFK Protection 2.3.2 rapara13/Nordic afk.amxx running
[ 27] AimInfo 2.1 xPaw/Nordic Warr aim_info.amxx running
[ 28] Ball 1.2.1 xPaw/Nordic Warr ball.amxx running
[ 29] BhopHack Detector 0.1 Mistrick bhophack_detect running
[ 30] [Reapi] Block Advert 1.4 neygomon block_advert.am debug
[ 31] Bypass Guard 24.02.2019 mx?! bypass_guard_ip running
[ 32] CameraChanger Lite 0.1 Nordic Warrior camera_changer. running
[ 33] Advanced Client Checke 0.3.7 Mistrick cmdchecker.amxx running
[ 34] Connect Exec 1.1 AleX/Nordic Warr connect_exec.am running
[ 35] Chat Manager 4.3.1 OciXCrom crx_chatmanager running
[ 36] CM: Toggle Chat 4.1 OciXCrom crx_chatmanager running
[ 37] OciXCrom's Rank System 3.2 OciXCrom crx_ranksystem. running
[ 38] Knife Models 2.5.7 OciXCrom crx_knife_model running
[ 39] [ReAPI] Custom Models 1.6.1 neugomon custom_models.a running
[ 40] Demo Recorder 2.4.0 F@nt0M demo_recorder.a running
[ 41] Fix for sky 0.3 NordicWarrior fix_maps.amxx running
[ 42] Gag System 1.1 TheRedShoko @ AM gag_system.amxx running
[ 43] GameName Changer 1.0 neugomon gamename.amxx running
[ 44] High Ping Kicker 1.0 OLO/shadow/Nordi high_ping_kicke running
[ 45] iHOOK 1.0 arttty7 iHOOK.amxx running
[ 46] Invisible Spectator 1.0 ReHLDS Team invisible_spect running
[ 47] key listener 0.7 cheap_suit keylistener.amx running
[ 48] Kill Distance 0.4 Nightscream/Nord kill_distance.a running
[ 49] Knife Duel Arena 1.32 bionext knife_duel_aren running
[ 50] unknown unknown unknown knife_duel_aren running
[ 51] Language Menu 1.0 F@nt0M langmenu.amxx running
[ 52] Light Menu 0.2 Nordic Warrior light_menu.amxx running
[ 53] Mind Games 1.1 fifayer/Nordic W MindGames.amxx running
[ 54] Money System Best t3rkecorejz MoneySystem.amx debug
[ 55] Mute Menu 12.02.2019 w0w/Nordic Warri mute_menu.amxx running
[ 56] Grab 2.1 Nordic Warrior/N new_grab.amxx running
[ 57] KillStreakAnnouncer 0.3 Nordic Warrior nkillstreak.amx running
[ 58] Knife Menu 1.2 Nordic Warrior nknifemenu.amxx running
[ 59] Knife shop 0.2.1 Nordic Warrior nknifeshop.amxx running
[ 60] Online Helper 1.0.1 Nordic Warrior online_helper.a running
[ 61] Paint Marker 1.1 w0w paint_marker.am running
[ 62] [ReAPI] Parachute 1.1 ReHLDS Team parachute.amxx running
[ 63] Pingwinowa bombka 0.1 diablix pingwin.amxx running
[ 64] Random Skies 1.1 rmk by N.W. randomskies.amx running
[ 65] ReChecker Logging 1.0 custom rc_logging.amxx running
[ 66] Reset Score 1.0 Nordic Warrior reset_score.amx running
[ 67] Spectator Bots 2.1 SISA spectator_bots. running
[ 68] SteamID Limiter 0.4 Mistrick steamid_limiter running
[ 69] Money Transfer 1.2 x3/Nordic Warrio tm.amxx debug
[ 70] Train Killer 1.1 Pastout!/Nordic trainkiller.amx running
[ 71] VipMenu 1.0 Nordic Warrior vipmenu.amxx running
[ 72] Yet Another Voteban 1.8 AndrewZ/voed yet_another_vot running
[ 73] Map Manager: Core 3.0.1 Mistrick map_manager_cor running
[ 74] Map Manager: Scheduler 0.1.0 Mistrick map_manager_sch running
[ 75] Map Manager: Rtv 0.0.4 Mistrick map_manager_rtv running
[ 76] Map Manager: Nominatio 0.0.8 Mistrick map_manager_nom running
[ 77] Map Manager: Effects 0.0.8 Mistrick map_manager_eff running
[ 78] Map Manager: Informer 0.0.5 Mistrick map_manager_inf running
[ 79] Map Manager: Advanced 0.0.4 Mistrick map_manager_adv running
79 plugins, 79 running
- Автор плагина
- serfreeman1337
- Версия плагина
- 0.1.4g с моими правками
- Исходный код
-
/*
* SF Warn Menu v. 0.1.4g
* by serfreeman1337 http://1337.uz/
*/
/*
* Credits:
* neugomon - подсказки по оптимизации
*/
#include <amxmodx>
#include <amxmisc>
#include <reapi>
new const VERSION[] = "0.1.4g_edit"
// * -- КОНСТАНТЫ -- * //
enum _:reasons_struct
{
REASON_NAME[64],
REASON_HUD[256]
}
enum _:plugin_cvars
{
CVAR_DEF_ACT,
CVAR_DEF_WARNS,
// 0.1.4
CVAR_DEF_ACT2
}
enum _:player_data_struct
{
PLAYER_TARGET,
PLAYER_TARGET_REASON[64]
}
// * -- ПЕРЕМЕННЫЕ -- * //
new cvar[plugin_cvars]
new players_data[MAX_PLAYERS + 1][player_data_struct]
new Array:reasons_array
new Trie:warns_trie
new hud_warn
public plugin_init()
{
register_plugin("SF Warn Menu", VERSION, "serfreeman1337/Nordic Warrior")
register_dictionary("sf_warn_menu.txt")
register_dictionary("common.txt")
register_srvcmd("sf_warn_add","CmdHook_WarnAdd",-1,"<name for menu>;<name for hud>")
register_clcmd("sf_warn_reason","CmdHook_Reason",ADMIN_KICK,"")
register_clcmd("sf_warn_player","CmdHook_WarnMenu",ADMIN_KICK,"[name or #userid] [reason or #reasonid] - open warn menu or warn player")
register_clcmd("amx_kickmenu","Menu_PlayersList",ADMIN_KICK,"Open warn menu or warn player")
register_clcmd("say /warn","Menu_PlayersList",ADMIN_KICK,"Open warn menu or warn player")
register_clcmd("say /kick","Menu_PlayersList",ADMIN_KICK,"Open warn menu or warn player")
hud_warn = CreateHudSyncObj()
//
// Команда, которую выполнит сервер по достижению лимита предупреждений
//
cvar[CVAR_DEF_ACT] = register_cvar("sf_warn_defact","kick [userid] [reason]")
//
// Макс. кол-во предупреждений
//
cvar[CVAR_DEF_WARNS] = register_cvar("sf_warn_max","3")
//
// Команда, которую выполнит сервер по нажатию в меню
//
cvar[CVAR_DEF_ACT2] = register_cvar("sf_warn_defact2","kick [userid] [reason]")
// huyak huyak and production
server_cmd("sf_warn_add WARN_SELF")
server_exec()
warns_trie = TrieCreate()
}
public plugin_precache()
{
precache_sound("events/friend_died.wav")
}
//
// Меню со списком игроков
//
public Menu_PlayersList(id)
{
new fmt[96]
formatex(fmt,charsmax(fmt),"%L",id,"WARN_MENU1")
new menu = menu_create(fmt,"MenuHandler_Global")
new players[32],pnum,info[2],plr_name[MAX_NAME_LENGTH * 2]
get_players(players,pnum)
info[0] = 'p' // запоминаем что это меню игроков
for(new i,player,paccess = 0 ; i < pnum ; i++)
{
player = players[i]
get_user_name(player,plr_name,charsmax(plr_name))
info[1] = player
paccess = 0
// помечаем что игрок имеет флаги на иммунтиет
if(get_user_flags(player) & ADMIN_IMMUNITY)
{
add(plr_name,charsmax(plr_name)," \r*\w")
paccess = ADMIN_RCON // игроков с иммунитетом могут кикать только игроки с флагом l
}
// помечаем что это hltv
else if(is_user_hltv(player))
{
add(plr_name,charsmax(plr_name)," \r(HLTV)\w")
}
// помечаем что это бот
else if(is_user_bot(player))
{
add(plr_name,charsmax(plr_name)," \r(BOT)\w")
}
menu_additem(menu,plr_name,info,paccess)
}
Menu_PostFormat(id,menu)
menu_display(id,menu)
return PLUGIN_HANDLED
}
//
// Меню с выбором причины
//
public Menu_ReasonsList(id,target)
{
// причины предупреждений не заданы, сразу выполняем действие
if(!reasons_array)
return PLUGIN_HANDLED
new fmt[96]
formatex(fmt,charsmax(fmt),"%L",id,"WARN_MENU2")
new menu = menu_create(fmt,"MenuHandler_Global")
new size = ArraySize(reasons_array)
new info[2]
info[0] = 'r'
info[1] = target
for(new i,reason_info[reasons_struct] ; i < size ; i++)
{
ArrayGetArray(reasons_array,i,reason_info)
if(strfind(reason_info[REASON_NAME],"WARN_") != -1)
{
formatex(fmt,charsmax(fmt),"%L",id,reason_info[REASON_NAME])
}
else
{
copy(fmt,charsmax(fmt),reason_info[REASON_NAME])
}
menu_additem(menu,fmt,info)
}
Menu_PostFormat(id,menu)
menu_display(id,menu)
return PLUGIN_HANDLED
}
//
// Меню подтверждения действия
//
public Menu_ReasonConfirm(id,target,reason_id)
{
// всякие проверки
if(!is_user_connected(target))
{
client_print_color(id,print_team_default,"%L",id,"CL_NOT_FOUND")
return Menu_PlayersList(id)
}
new fmt[96]
formatex(fmt,charsmax(fmt),"%L",id,"WARN_MENU3")
new menu = menu_create(fmt,"MenuHandler_Global")
new target_name[MAX_NAME_LENGTH]
get_user_name(target,target_name,charsmax(target_name))
new info[6]
info[0] = 'c'
info[1] = target
info[3] = reason_id
// 1. Игрок
info[2] = 1
formatex(fmt,charsmax(fmt),"%L \y%s\w",id,"WARN_TARGET",target_name)
menu_additem(menu,fmt,info)
// 2. Причина
info[2] = 2
if(reason_id == 0)
{
formatex(fmt,charsmax(fmt),"%L \y%s\w^n",id,"WARN_TXT1",players_data[id][PLAYER_TARGET_REASON])
}
else
{
new reason_info[reasons_struct]
ArrayGetArray(reasons_array,reason_id,reason_info)
// ML
if(strfind(reason_info[REASON_NAME],"WARN_") == 0)
{
formatex(fmt,charsmax(fmt),"%L \y%L\w^n",id,"WARN_TXT1",id,reason_info[REASON_NAME])
}
else
{
formatex(fmt,charsmax(fmt),"%L \y%s\w^n",id,"WARN_TXT1",reason_info[REASON_NAME])
}
}
menu_additem(menu,fmt,info)
// 3. Действие
info[2] = 3
formatex(fmt,charsmax(fmt),"%L",id,"WARN_TXT2")
menu_additem(menu,fmt,info,ADMIN_RCON)
// 4. Предупреждение
info[2] = 4
formatex(fmt,charsmax(fmt),"%L",id,"WARN_TXT3")
menu_additem(menu,fmt,info)
Menu_PostFormat(id,menu)
menu_display(id,menu)
return PLUGIN_HANDLED
}
//
// Действия меню
//
public MenuHandler_Global(id,menu,item)
{
if(item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new paccess,info[6],dummy
menu_item_getinfo(menu,item,paccess,info,charsmax(info),.callback = dummy)
#if AMXX_VERSION_NUM < 183
if(info[0] == 'e')
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
#endif
new player = info[1]
// всякие проверки
if(!is_user_connected(player))
{
client_print_color(id,print_team_default,"%L",id,"CL_NOT_FOUND")
menu_destroy(menu)
return Menu_PlayersList(id)
}
else if((get_user_flags(player) & ADMIN_IMMUNITY) && !(get_user_flags(id) & ADMIN_RCON))
{
new name[MAX_NAME_LENGTH]
get_user_name(player,name,charsmax(name))
client_print_color(id,print_team_default,"%L",id,"CLIENT_IMM",name)
menu_destroy(menu)
return Menu_PlayersList(id)
}
switch(info[0])
{
case 'p': // меню игроков
{
if(!is_user_bot(player) && !is_user_hltv(player))
{
Menu_ReasonsList(id,player)
}
// выполняем действия для ботов и hltv сразу
else
{
copy(players_data[id][PLAYER_TARGET_REASON],
charsmax(players_data[][PLAYER_TARGET_REASON]),
"?"
)
Warn_PerformAction(id,player,0,true)
}
}
case 'r':
{
// своя причина
if(item == 0)
{
players_data[id][PLAYER_TARGET] = player
client_cmd(id,"messagemode sf_warn_reason")
}
// предустановленная причина
else
{
Menu_ReasonConfirm(id,player,item)
}
}
case 'c':
{
switch(info[2])
{
// возвращаем в меню выбора игрока
case 1:
{
Menu_PlayersList(id)
}
// возвращаем в меню выбора причины
case 2:
{
Menu_ReasonsList(id,player)
}
// выполняем действие сразу
case 3:
{
Warn_PerformAction(id,player,info[3],true)
}
case 4:
{
Warn_PerformAction(id,player,info[3],false)
}
}
}
}
menu_destroy(menu)
return PLUGIN_HANDLED
}
//
// Пост обработка меню
//
Menu_PostFormat(id,menu)
{
new fmt[96]
new items = menu_items(menu)
// не используем пагинацию если меньше 10 игроков
if(items < 10)
{
menu_setprop(menu,MPROP_PERPAGE,false)
for(new i,null_items = (9 - items) ; i < null_items ; i++)
{
menu_addblank(menu)
}
#if AMXX_VERSION_NUM >= 183
menu_setprop(menu,MPROP_EXIT,MEXIT_FORCE)
#else
formatex(fmt,charsmax(fmt),"%L",id,"EXIT")
menu_additem(menu,fmt,"e")
return
#endif
}
// текст кнопок ДАЛЕЕ и НАЗАД
else
{
formatex(fmt,charsmax(fmt),"%L",id,"BACK")
menu_setprop(menu,MPROP_BACKNAME,fmt)
formatex(fmt,charsmax(fmt),"%L",id,"MORE")
menu_setprop(menu,MPROP_NEXTNAME,fmt)
}
// текст кнопки ВЫХОД
formatex(fmt,charsmax(fmt),"%L",id,"EXIT")
menu_setprop(menu,MPROP_EXITNAME,fmt)
}
//
// Предупреждаем или кикаем
//
public Warn_PerformAction(id,target,reason_id,is_action)
{
// всякие проверки
if(!is_user_connected(target))
{
client_print_color(id,print_team_default,"%L",id,"CL_NOT_FOUND")
return Menu_PlayersList(id)
}
else if((get_user_flags(target) & ADMIN_IMMUNITY) && !(get_user_flags(id) & ADMIN_RCON))
{
new name[MAX_NAME_LENGTH]
get_user_name(target,name,charsmax(name))
client_print_color(id,print_team_default,"%L",id,"CLIENT_IMM",name)
return Menu_PlayersList(id)
}
new reason_info[reasons_struct],max_warns = get_pcvar_num(cvar[CVAR_DEF_WARNS])
new admin_name[MAX_NAME_LENGTH],target_name[MAX_NAME_LENGTH],target_warns
new admin_steamid[36],target_steamid[36]
get_user_name(id,admin_name,charsmax(admin_name))
get_user_name(target,target_name,charsmax(target_name))
get_user_name(id,admin_steamid,charsmax(admin_steamid))
get_user_name(target,target_steamid,charsmax(target_steamid))
ArrayGetArray(reasons_array,reason_id,reason_info)
// устанавливаем название своей причины
if(reason_id == 0)
{
copy(reason_info[REASON_NAME],
charsmax(reason_info[REASON_NAME]),
players_data[id][PLAYER_TARGET_REASON]
)
copy(reason_info[REASON_HUD],
charsmax(reason_info[REASON_HUD]),
players_data[id][PLAYER_TARGET_REASON]
)
}
// увеличиваем уровень предупреждений и выполняем действие, если достигнут максимум
if(!is_action)
{
new target_ip[16]
get_user_ip(target,target_ip,charsmax(target_ip),true)
TrieGetCell(warns_trie,target_ip,target_warns)
TrieSetCell(warns_trie,target_ip,++ target_warns)
if(target_warns >= max_warns)
{
is_action = 2
TrieDeleteKey(warns_trie,target_ip) // сбрасываем счетчик предупреждений
}
log_amx("Warn: ^"%s<%d><%s><>^" warn ^"%s<%d><%s><>^" for ^"%s^" [%d/%d]",
admin_name,get_user_userid(id),admin_steamid,
target_name,get_user_userid(target),target_steamid,
reason_info[REASON_NAME],
target_warns,max_warns
)
}
new wkey1[12],wkey2[12],wkey3[12]
// huyak huyak and production
switch(is_action)
{
case 1:
{
copy(wkey1,charsmax(wkey1),"WARN_TXT6")
copy(wkey2,charsmax(wkey2),"WARN_TXT7")
}
case 2:
{
copy(wkey1,charsmax(wkey1),"WARN_TXT10")
copy(wkey2,charsmax(wkey2),"WARN_TXT11")
}
default:
{
copy(wkey1,charsmax(wkey1),"WARN_TXT4")
copy(wkey2,charsmax(wkey2),"WARN_TXT5")
copy(wkey3,charsmax(wkey3),"WARN_TXT8")
}
}
// с поддержкой ML
if(reason_id == 0 || strfind(reason_info[REASON_NAME],"WARN_") == -1)
{
show_activity_key_colored(wkey1,wkey2,admin_name,
target_name,
LANG_PLAYER,
"WARN_NULL",
reason_info[REASON_NAME],
target_warns,
max_warns
)
}
// без поддержки ML
else
{
show_activity_key_colored(wkey1,wkey2,admin_name,
target_name,
LANG_PLAYER,
reason_info[REASON_NAME],
target_warns,
max_warns
)
}
// предупреждение
if(!is_action)
{
ClearSyncHud(target,hud_warn)
set_hudmessage(255,75,75)
rg_send_audio(target, "events/friend_died.wav")
// с именем администратора
if(get_cvar_num("amx_show_activity") == 2)
{
// поддержкой ML
if(strfind(reason_info[REASON_HUD],"WARN_") == 0)
{
ShowSyncHudMsg(target,hud_warn,"%L",
target,"WARN_TXT9",
target_warns,
max_warns,
admin_name,
target,reason_info[REASON_HUD]
)
}
// без поддержки ML
else
{
ShowSyncHudMsg(target,hud_warn,"%L",
target,"WARN_TXT9",
target_warns,
max_warns,
admin_name,
target,"WARN_NULL",reason_info[REASON_HUD]
)
}
}
// без имени администратора
else
{
// поддержкой ML
if(strfind(reason_info[REASON_HUD],"WARN_") == 0)
{
ShowSyncHudMsg(target,hud_warn,"%L",
target,"WARN_TXT8",
target_warns,
max_warns,
target,reason_info[REASON_HUD]
)
}
// без поддержки ML
else
{
ShowSyncHudMsg(target,hud_warn,"%L",
target,"WARN_TXT8",
target_warns,
max_warns,
target,"WARN_NULL",reason_info[REASON_HUD]
)
}
}
}
// выполняем действие
else
{
new action_string[256],reason_for_target[128]
if(strfind(reason_info[REASON_NAME],"WARN_") == 0)
{
formatex(reason_for_target,charsmax(reason_for_target),"%L",target,reason_info[REASON_NAME])
}
else
{
formatex(reason_for_target,charsmax(reason_for_target),reason_info[REASON_NAME])
}
get_pcvar_string(cvar[(is_action == 2? CVAR_DEF_ACT2 : CVAR_DEF_ACT)],action_string,charsmax(action_string))
new target_authid[36],target_userid[10]
get_user_authid(target,target_authid,charsmax(target_authid))
formatex(target_userid,charsmax(target_userid),"#%d",get_user_userid(target))
replace(action_string,charsmax(action_string),"[userid]",target_userid)
replace(action_string,charsmax(action_string),"[authid]",target_authid)
replace(action_string,charsmax(action_string),"[reason]",reason_for_target)
server_cmd(action_string)
server_exec()
log_amx("Action: ^"%s<%d><%s><>^" on ^"%s<%d><%s><>^" for ^"%s^" [%s]",
admin_name,get_user_userid(id),admin_steamid,
target_name,get_user_userid(target),target_steamid,
reason_info[REASON_NAME],
action_string
)
}
return PLUGIN_HANDLED
}
public CmdHook_WarnMenu(id,level,cid)
{
if(!cmd_access(id,level,cid,0))
{
return PLUGIN_HANDLED
}
if(read_argc() >= 2)
{
new name_or_userid[MAX_NAME_LENGTH]
read_argv(1,name_or_userid,charsmax(name_or_userid))
players_data[id][PLAYER_TARGET] = cmd_target(id,name_or_userid,0)
if(!players_data[id][PLAYER_TARGET])
return PLUGIN_HANDLED
if(read_argc() == 2)
return Menu_ReasonsList(id,players_data[id][PLAYER_TARGET])
}
if(read_argc() == 3)
{
read_argv(2,players_data[id][PLAYER_TARGET_REASON],charsmax(players_data[][PLAYER_TARGET_REASON]))
return Warn_PerformAction(id,players_data[id][PLAYER_TARGET],0,false)
}
return Menu_PlayersList(id)
}
//
// Ввод своей причины
//
public CmdHook_Reason(id,level,cid)
{
if(!cmd_access(id,level,cid,1))
{
return PLUGIN_HANDLED
}
if(!players_data[id][PLAYER_TARGET])
{
return PLUGIN_HANDLED
}
read_argv(1,players_data[id][PLAYER_TARGET_REASON],charsmax(players_data[][PLAYER_TARGET_REASON]))
if(!players_data[id][PLAYER_TARGET_REASON][0])
{
return Menu_ReasonsList(id,players_data[id][PLAYER_TARGET])
}
return Menu_ReasonConfirm(id,players_data[id][PLAYER_TARGET],0)
}
//
// Регистрация причины предупреждения
//
public CmdHook_WarnAdd()
{
new cmd_str[512],l,reason_info[reasons_struct]
read_args(cmd_str,charsmax(cmd_str))
remove_quotes(cmd_str)
// парсим команду
for(;;)
{
switch(l)
{
// название причины в меню
case 0:
{
strtok(cmd_str,reason_info[REASON_NAME],charsmax(reason_info[REASON_NAME]),cmd_str,charsmax(cmd_str),';')
copy(reason_info[REASON_HUD],charsmax(reason_info[REASON_HUD]),reason_info[REASON_NAME])
// huyak huyak and production fix
if(strcmp(reason_info[REASON_NAME],"WARN_SELF") == 0 && reasons_array && ArraySize(reasons_array))
{
return
}
}
// название причины в HUD
case 1:
{
strtok(cmd_str,reason_info[REASON_HUD],charsmax(reason_info[REASON_HUD]),cmd_str,charsmax(cmd_str),';')
}
// narkoman wole suka
default:
{
break
}
}
if(!cmd_str[0])
break
l ++
}
// в массив
if(!reasons_array)
{
reasons_array = ArrayCreate(reasons_struct)
}
ArrayPushArray(reasons_array,reason_info)
}
//
// КЛАЛ Я НА ВАШИ ЗАМЕЧАНИЯ К МОЕМУ КОДУ
//
stock show_activity_key_colored(const KeyWithoutName[], const KeyWithName[], const ___AdminName[], any:...)
{
// The variable gets used via vformat, but the compiler doesn't know that, so it still cries.
#pragma unused ___AdminName
static __amx_show_activity;
if (__amx_show_activity == 0)
{
__amx_show_activity = get_cvar_pointer("amx_show_activity");
// if still not found, then register the cvar as a dummy
if (__amx_show_activity == 0)
{
__amx_show_activity = register_cvar("amx_show_activity", "2");
}
}
new buffer[512];
new keyfmt[256];
new i;
new __maxclients=get_maxplayers();
switch( get_pcvar_num(__amx_show_activity) )
{
case 5: // hide name to admins, display nothing to normal players
while (i++ < __maxclients)
{
if ( is_user_connected(i) )
{
if ( is_user_admin(i) )
{
LookupLangKey(keyfmt, charsmax(keyfmt), KeyWithoutName, i);
// skip the "adminname" argument if not showing name
vformat(buffer, charsmax(buffer), keyfmt, 4);
client_print_color(i, print_team_default, "%s", buffer);
}
}
}
case 4: // show name only to admins, display nothing to normal players
while (i++ < __maxclients)
{
if ( is_user_connected(i) )
{
if ( is_user_admin(i) )
{
LookupLangKey(keyfmt, charsmax(keyfmt), KeyWithName, i);
vformat(buffer, charsmax(buffer), keyfmt, 3);
client_print_color(i, print_team_default, "%s", buffer);
}
}
}
case 3: // show name only to admins, hide name from normal users
while (i++ < __maxclients)
{
if ( is_user_connected(i) )
{
if ( is_user_admin(i) )
{
LookupLangKey(keyfmt, charsmax(keyfmt), KeyWithName, i);
vformat(buffer, charsmax(buffer), keyfmt, 3);
}
else
{
LookupLangKey(keyfmt, charsmax(keyfmt), KeyWithoutName, i);
// skip the "adminname" argument if not showing name
vformat(buffer, charsmax(buffer), keyfmt, 4);
}
client_print_color(i, print_team_default, "%s", buffer);
}
}
case 2: // show name to all users
while (i++ < __maxclients)
{
if ( is_user_connected(i) )
{
LookupLangKey(keyfmt, charsmax(keyfmt), KeyWithName, i);
vformat(buffer, charsmax(buffer), keyfmt, 3);
client_print_color(i, print_team_default, "%s", buffer);
}
}
case 1: // hide name from all users
while (i++ < __maxclients)
{
if ( is_user_connected(i) )
{
LookupLangKey(keyfmt, charsmax(keyfmt), KeyWithoutName, i);
// skip the "adminname" argument if not showing name
vformat(buffer, charsmax(buffer), keyfmt, 4);
client_print_color(i, print_team_default, "%s", buffer);
}
}
}
}
На локальном сервере с AmxModX 1.8.3 плагин работает идеально. Ставлю его на свой основной сервер, с AmxModX 1.10.0 - в меню выбора причины пропадает пункт "Своя причина", при этом добавленные причины начинаются с 1 пункта, а не с 2, как всегда. НО: так же при этом, если нажать на 1, откроется ввод своей причины, а не выберется заданная причина.
В этой теме было размещено решение! Перейти к решению.