|
Стаж: 6 лет 6 месяцев
Сообщений: 4
Благодарностей: 1
Полезность: 0
|
Доброго времени суток всем! Сразу извиняюсь, если пишу не в ту тему или раздел. В cs 1.6 играю уже очень давно, а вот с настройками сервера столкнулся впервые. Очень много новой информации для меня, очень сложно все понять. Объясните пожалуйста, как работать с флагами, левелами итд. В users.ini есть подсказка по флагам, но все равно не могу разобраться как их использовать. Опишу ситуацию на примере, с которым я столкнулся. Есть плагин - парашют. Есть 2 файла - amxx и sma. Открываю .sma файл со следующим текстом: Код:
#include <amxmodx> #include <amxmisc> #include <engine> #include <cstrike> #include <fun>
new bool:has_parachute[33] new para_ent[33] new gCStrike = 0 new pDetach, pFallSpeed, pEnabled
#define PARACHUTE_LEVEL ADMIN_LEVEL_A
public plugin_init() { register_plugin("Parachute", "1.3", "KRoT@L/JTP10181") pEnabled = register_cvar("sv_parachute", "1" ) pFallSpeed = register_cvar("parachute_fallspeed", "100") pDetach = register_cvar("parachute_detach", "1")
if (cstrike_running()) gCStrike = true
if (gCStrike) {
register_concmd("amx_parachute", "admin_give_parachute", PARACHUTE_LEVEL, "<nick, #userid or @team>" ) }
register_clcmd("say", "HandleSay") register_clcmd("say_team", "HandleSay")
register_event("ResetHUD", "newSpawn", "be") register_event("DeathMsg", "death_event", "a")
//Setup jtp10181 CVAR new cvarString[256], shortName[16] copy(shortName,15,"chute")
register_cvar("jtp10181","",FCVAR_SERVER|FCVAR_SPONLY) get_cvar_string("jtp10181",cvarString,255)
if (strlen(cvarString) == 0) { formatex(cvarString,255,shortName) set_cvar_string("jtp10181",cvarString) } else if (contain(cvarString,shortName) == -1) { format(cvarString,255,"%s,%s",cvarString, shortName) set_cvar_string("jtp10181",cvarString) } }
public plugin_natives() { set_module_filter("module_filter") set_native_filter("native_filter") }
public module_filter(const module[]) { if (!cstrike_running() && equali(module, "cstrike")) { return PLUGIN_HANDLED }
return PLUGIN_CONTINUE }
public native_filter(const name[], index, trap) { if (!trap) return PLUGIN_HANDLED
return PLUGIN_CONTINUE }
public client_connect(id) { if(para_ent[id] > 0) { remove_entity(para_ent[id]) } has_parachute[id] = true para_ent[id] = 0 }
public client_disconnect(id) { parachute_reset(id) }
public death_event() { new id = read_data(2) parachute_reset(id) }
parachute_reset(id) { if(para_ent[id] > 0) { if (is_valid_ent(para_ent[id])) { remove_entity(para_ent[id]) } }
if (is_user_alive(id)) set_user_gravity(id, 1.0)
has_parachute[id] = false para_ent[id] = 0 }
public newSpawn(id) { if(para_ent[id] > 0) { remove_entity(para_ent[id]) } has_parachute[id] = true para_ent[id] = 0 }
public client_PreThink(id) { //parachute.mdl animation information //0 - deploy - 84 frames //1 - idle - 39 frames //2 - detach - 29 frames
if (!get_pcvar_num(pEnabled)) return if (!is_user_alive(id) || !has_parachute[id]) return
new Float:fallspeed = get_pcvar_float(pFallSpeed) * -1.0 new Float:frame
new button = get_user_button(id) new oldbutton = get_user_oldbutton(id) new flags = get_entity_flags(id)
if (para_ent[id] > 0 && (flags & FL_ONGROUND)) {
if (get_pcvar_num(pDetach)) {
if (get_user_gravity(id) == 0.1) set_user_gravity(id, 1.0)
if (entity_get_int(para_ent[id],EV_INT_sequence) != 2) { entity_set_int(para_ent[id], EV_INT_sequence, 2) entity_set_int(para_ent[id], EV_INT_gaitsequence, 1) entity_set_float(para_ent[id], EV_FL_frame, 0.0) entity_set_float(para_ent[id], EV_FL_fuser1, 0.0) entity_set_float(para_ent[id], EV_FL_animtime, 0.0) entity_set_float(para_ent[id], EV_FL_framerate, 0.0) return }
frame = entity_get_float(para_ent[id],EV_FL_fuser1) + 2.0 entity_set_float(para_ent[id],EV_FL_fuser1,frame) entity_set_float(para_ent[id],EV_FL_frame,frame)
if (frame > 254.0) { remove_entity(para_ent[id]) para_ent[id] = 0 } } else { remove_entity(para_ent[id]) set_user_gravity(id, 1.0) para_ent[id] = 0 }
return }
if (button & IN_USE) {
new Float:velocity[3] entity_get_vector(id, EV_VEC_velocity, velocity)
if (velocity[2] < 0.0) {
if(para_ent[id] <= 0) { para_ent[id] = create_entity("info_target") if(para_ent[id] > 0) { entity_set_string(para_ent[id],EV_SZ_classname,"parachute") entity_set_edict(para_ent[id], EV_ENT_aiment, id) entity_set_edict(para_ent[id], EV_ENT_owner, id) entity_set_int(para_ent[id], EV_INT_movetype, MOVETYPE_FOLLOW) entity_set_int(para_ent[id], EV_INT_sequence, 0) entity_set_int(para_ent[id], EV_INT_gaitsequence, 1) entity_set_float(para_ent[id], EV_FL_frame, 0.0) entity_set_float(para_ent[id], EV_FL_fuser1, 0.0) } }
if (para_ent[id] > 0) {
entity_set_int(id, EV_INT_sequence, 3) entity_set_int(id, EV_INT_gaitsequence, 1) entity_set_float(id, EV_FL_frame, 1.0) entity_set_float(id, EV_FL_framerate, 1.0) set_user_gravity(id, 0.1)
velocity[2] = (velocity[2] + 40.0 < fallspeed) ? velocity[2] + 40.0 : fallspeed entity_set_vector(id, EV_VEC_velocity, velocity)
if (entity_get_int(para_ent[id],EV_INT_sequence) == 0) {
frame = entity_get_float(para_ent[id],EV_FL_fuser1) + 1.0 entity_set_float(para_ent[id],EV_FL_fuser1,frame) entity_set_float(para_ent[id],EV_FL_frame,frame)
if (frame > 100.0) { entity_set_float(para_ent[id], EV_FL_animtime, 0.0) entity_set_float(para_ent[id], EV_FL_framerate, 0.4) entity_set_int(para_ent[id], EV_INT_sequence, 1) entity_set_int(para_ent[id], EV_INT_gaitsequence, 1) entity_set_float(para_ent[id], EV_FL_frame, 0.0) entity_set_float(para_ent[id], EV_FL_fuser1, 0.0) } } } } else if (para_ent[id] > 0) { remove_entity(para_ent[id]) set_user_gravity(id, 1.0) para_ent[id] = 0 } } else if ((oldbutton & IN_USE) && para_ent[id] > 0 ) { remove_entity(para_ent[id]) set_user_gravity(id, 1.0) para_ent[id] = 0 } } На данный момент данный плагин работает у любого игрока. Моя задача сделать так, что бы работал он только у VIP игроков и у админа. В users.ini VIP игрок у меня записан так - "name" "password" "t" "a" В подсказке (в том же users.ini) есть такая надпись - ; t - левел H Что нужно в данном случае изменить в sma файле, что бы убрать данную функцию у простых игроков? Я банально поменял ADMIN_LEVEL_A на ADMIN_LEVEL_H. И естественно ничего не получилось. И такой момент. Скачал плагин voteban. Тоже 2 файла - amxx и sma Код:
#include <amxmodx> #include <amxmisc>
#define MAX_players 32 #define MAX_menudata 1024
new ga_PlayerName[MAX_players][32] new ga_PlayerAuthID[MAX_players][35] new ga_PlayerID[MAX_players] new ga_PlayerIP[MAX_players][16] new ga_MenuData[MAX_menudata] new ga_Choice[2] new gi_VoteStarter new gi_MenuPosition new gi_Sellection new gi_TotalPlayers new gi_SysTimeOffset = 0 new i //pcvars new gi_LastTime new gi_DelayTime new gf_Ratio new gf_MinVoters new gf_BF_Ratio new gi_BanTime new gi_Disable new gi_BanType
public plugin_init() { register_plugin("voteban menu","1.2","hjvl") register_clcmd("say /voteban","SayIt" ) register_menucmd(register_menuid("ChoosePlayer"), 1023, "ChooseMenu") register_menucmd(register_menuid("VoteMenu"), 1023, "CountVotes")
gi_LastTime=register_cvar("amx_voteban_lasttime","0") gi_DelayTime=register_cvar("amxx_voteban_delaytime","60") gf_Ratio=register_cvar("amxx_voteban_ratio","0.65") gf_MinVoters=register_cvar("amxx_voteban_minvoters","0.0") gf_BF_Ratio=register_cvar("amxx_voteban_bf_ratio","0.0") gi_BanTime=register_cvar("amxx_voteban_bantime","20") gi_Disable=register_cvar("amxx_voteban_disable","0") gi_BanType=register_cvar("amxx_voteban_type","1") }
public SayIt(id) { if(get_pcvar_num(gi_Disable)) { client_print(id,print_chat,"amx_voteban выключен") return 0 }
new Elapsed=get_systime(gi_SysTimeOffset) - get_pcvar_num(gi_LastTime) new Delay=get_pcvar_num(gi_DelayTime)
if( (Delay > Elapsed) && !is_user_admin(id) ) { new seconds = Delay - Elapsed client_print(id,print_chat,"Подождите %d секунд(ы) до нового голосования за Бан", seconds) return 0 }
get_players( ga_PlayerID, gi_TotalPlayers ) for(i=0; i<gi_TotalPlayers; i++) { new TempID = ga_PlayerID[i] if( is_user_admin(TempID)) { if(!is_user_admin(id)) { client_print(id,print_chat,"Админ на сервере. Voteban выключен!") return 0 } }
if(TempID == id) gi_VoteStarter=i
get_user_name( TempID, ga_PlayerName[i], 31 ) get_user_authid( TempID, ga_PlayerAuthID[i], 34 ) get_user_ip( TempID, ga_PlayerIP[i], 15, 1 ) }
gi_MenuPosition = 0 ShowPlayerMenu(id) return 0 }
public ShowPlayerMenu(id) { new arrayloc = 0 new keys = (1<<9)
arrayloc = format(ga_MenuData,(MAX_menudata-1),"VoteBAN меню ^n") for(i=0; i<8; i++) if( gi_TotalPlayers>(gi_MenuPosition+i) ) { arrayloc += format(ga_MenuData[arrayloc],(MAX_menudata-1-arrayloc),"%d. %s^n", i+1, ga_PlayerName[gi_MenuPosition+i]) keys |= (1<<i) } if( gi_TotalPlayers>(gi_MenuPosition+8) ) { arrayloc += format(ga_MenuData[arrayloc],(MAX_menudata-1-arrayloc),"^n9. Больше") keys |= (1<<8) } arrayloc += format(ga_MenuData[arrayloc],(MAX_menudata-1-arrayloc),"^n0. НазадВыход")
show_menu(id, keys, ga_MenuData, 20, "ChoosePlayer") return PLUGIN_HANDLED }
public ChooseMenu(id, key) { switch(key) { case 8: { gi_MenuPosition=gi_MenuPosition+8 ShowPlayerMenu(id) } case 9: { if(gi_MenuPosition>=8) { gi_MenuPosition=gi_MenuPosition-8 ShowPlayerMenu(id) } else return 0 } default: { gi_Sellection=gi_MenuPosition+key new Now=get_systime(gi_SysTimeOffset) set_pcvar_num(gi_LastTime, Now)
run_vote() return 0 } } return PLUGIN_HANDLED }
public run_vote() { log_amx("%s начал голосование за Бан %s %s", ga_PlayerName[gi_VoteStarter], ga_PlayerName[gi_Sellection], ga_PlayerAuthID[gi_Sellection]) format(ga_MenuData,(MAX_menudata-1),"Забанить %s на %d минут(ы)?^n1. Да^n2. Нет",ga_PlayerName[gi_Sellection], get_pcvar_num(gi_BanTime)) ga_Choice[0] = 0 ga_Choice[1] = 0 show_menu( 0, (1<<0)|(1<<1), ga_MenuData, 15, "VoteMenu" ) set_task(15.0,"outcom") return 0 }
public CountVotes(id, key) { ++ga_Choice[key] return PLUGIN_HANDLED }
public outcom() { new TotalVotes = ga_Choice[0] + ga_Choice[1] new Float:result = (float(ga_Choice[0]) / float(TotalVotes))
if( get_pcvar_float(gf_MinVoters) >= ( float(TotalVotes) / float(gi_TotalPlayers) ) ) { client_print(0,print_chat,"Недостаточно проголосовавших чтобы забанить %s!", ga_PlayerName[gi_Sellection]) return 0 } else { if( result < get_pcvar_float(gf_BF_Ratio) ) { client_print(0,print_chat,"Голосование за бан %s закончилось, он забанен на %d минут(ы)", ga_PlayerName[gi_VoteStarter], get_pcvar_num(gi_BanTime)) ActualBan(gi_VoteStarter) log_amx("[AMXX] The vote back fired at %s, he is banned for %d minutes", ga_PlayerName[gi_VoteStarter], get_pcvar_num(gi_BanTime)) }
if( result >= get_pcvar_float(gf_Ratio) ) { client_print(0,print_chat,"Голосование успешно!!!, %s забанен на %d минут(ы)", ga_PlayerName[gi_Sellection], get_pcvar_num(gi_BanTime)) log_amx("[AMXX] The vote succeeded: %s is banned for %d minutes", ga_PlayerAuthID[gi_Sellection], get_pcvar_num(gi_BanTime)) ActualBan(gi_Sellection) } else { client_print(0,print_chat,"Голосование безуспешно.") log_amx("The voteban dit not sucseed.") } } client_print(0,print_chat,"Всего проголосовали %d игрок(ов), %d за.", gi_TotalPlayers, ga_Choice[0])
return 0 }
public ActualBan(Selected) { new Type = get_pcvar_num(gi_BanType) switch(Type) { case 1: server_cmd("addip %d %s", get_pcvar_num(gi_BanTime), ga_PlayerIP[Selected]) case 2: server_cmd("amx_ban %d %s Voteban", get_pcvar_num(gi_BanTime), ga_PlayerAuthID[Selected]) default: server_cmd("banid %d %s kick", get_pcvar_num(gi_BanTime), ga_PlayerAuthID[Selected]) } return 0 } Захожу на сервер с правами главного админа ("name" "pass" "abcdefghijklmnopqrstu" "a"). На сервере я один. Ввожу /voteban и голосую за себя. После этого меня банит и кикает. Такое происходит, потому что забанил главный админ (т.е я) или что-то с настройками привелегий? В данном случае против меня могут проголосовать любые игроки и сервер меня забанит? Или я путаю? Ну и что бы подитожить - в каждом .sma файле есть строка, где прописан уровень доступа к данному плагину? И его можно настроить на любую категорию игроков? Т.е условно говоря скачать плагин, скажем - "mute на игрока". Который по умолчанию работает для всех. Зайти в .sma, найти строчку #define и что-нибудь типа ACCESS и вписать туда нужный флаг?! Или не все так просто? Заранее спасибо и извиняюсь за глупые вопросы. Просто действительно для меня это темный лес, но очень хочется понять.
|