Русское сообщество по скриптингу

Ломают серв, заходят админами, банят админов.

Все, что касается защиты серверов от различного рода атак, эксплойтов, бэкдуров и т.д.
Правила форума
1. Запрещено материться и оскорблять других участников форума.
2. Запрещен флуд, оффтоп, дабл постинг во всех разделах форума, кроме раздела "Болтовня".
3. Запрещено взламывать сайт/форум или наносить любой вред проекту.
4. Запрещено рекламировать другие ресурсы.
5. Запрещено создавать темы без информативного названия. Название темы должно отображать ее смысл.

Ломают серв, заходят админами, банят админов.

Сообщение Lip » 05 ноя 2011, 23:09

Школота заходит на серв админами, банит админов.
файл users только для чтения
RCON - нет

Через что они заходят? В каком плагине дырка дырка?
список:
csf_anticheat.amxx
Bad_nick.amxx
admin.amxx
admin_spec_esp.amxx
admin_vgk.amxx
adminchat.amxx
admincmd_reason.amxx
adminlisten.amxx
adminchat.amxx
adminvote.amxx
afkkicker.amxx
amx_bancs.amxx
amx_banshot[motd].amxx
amx_hpk.amxx
anti_hlbrute.amxx
auto_rr.amxx
automatic_knife_duel.amxx
block_recl.amxx
bs_menu.amxx
cmdmenu.amxx
FixAutoBuyBug.amxx
killa_hp.amxx
lastmanbets.amxx
mapsmenu.amxx
menufront.amxx
plmenu.amxx
pluginmenu.amxx
restmenu.amxx
statscfg.amxx
statsx_shell.amxx
telemenu.amxx
descriptive_Fire_in_the_hole.amxx //цветные надписи от гр.
flashbang_dlight.amxx // реализм флешки
admin_flash.amxx
badnick2.amxx
antiflood.amxx
block_wallhack.amxx
show_adminsru.amxx
amx_adminmodel.amxx
timelimitvote_rus.amxx
amxx_podbotmenu.amxx
noplayers_map.amxx
deagsmapmanager.amxx
resetscore.amxx
ad_manager.amxx
clockmaker_v1.1.amxx
multilingual.amxx
amx_parachute.amxx
timelimitvote_rus.amxx
c4timer.amxx
follow_the_wounded.amxx
Get in Position and wait for my go
Аватара пользователя
Lip
 
Сообщения: 20
Зарегистрирован: 15 фев 2011, 21:35
Благодарил (а): 7 раз.
Поблагодарили: 2 раз.
Языки программирования: Counter-Strike 1.6

Re: Ломают серв, заходят админами, банят админов.

Сообщение Lip » 06 ноя 2011, 18:33

Парни, серву 1 год, такой шняги небыло никогда, CSF стоит пропатченый с офф сайта, поставил через полгода когда узнал про дырку. Мне один юзер написал в чат мой ркон и рассказал про дырку.
Могу подсказать мои подозрения, совсем недавно поставил несколько плагинов, после чего это и началось.
deagsmapmanager.amxx
resetscore.amxx
ad_manager.amxx
clockmaker_v1.1.amxx
multilingual.amxx
amx_parachute.amxx
timelimitvote_rus.amxx
c4timer.amxx
follow_the_wounded.amxx

парашют:
Код: Выделить всё
/*******************************************************************************

  Parachute

  Version: 1.3
  Author: KRoTaL/JTP10181

  0.1    Release
  0.1.1  Players can't buy a parachute if they already own one
  0.1.2  Release for AMX MOD X
  0.1.3  Minor changes
  0.1.4  Players lose their parachute if they die
  0.1.5  Added amx_parachute cvar
  0.1.6  Changed set_origin to movetype_follow (you won't see your own parachute)
  0.1.7  Added amx_parachute <name> | admins with admin level a get a free parachute
  0.1.8  JTP - Cleaned up code, fixed runtime error
  1.0    JTP - Should be final version, made it work on basically any mod
  1.1    JTP - Added Changes from AMX Version 0.1.8
           Added say give_parachute and parachute_fallspeed cvar
               Plays the release animation when you touch the ground
               Added chat responder for automatic help
  1.2    JTP - Added cvar to disable the detach animation
           Redid animation code to improve organization
           Force "walk" animation on players when falling
           Change users gravity when falling to avoid choppiness
  1.3    JTP - Upgraded to pCVARs

  Commands:

   say buy_parachute   -   buys a parachute (CStrike ONLY)
   saw sell_parachute  -   sells your parachute (75% of the purchase price)
   say give_parachute <nick, #userid or @team>  -  gives your parachute to the player

   amx_parachute <nick, #userid or @team>  -  gives a player a free parachute (CStrike ONLY)
   amx_parachute @all  -  gives everyone a free parachute (CStrike ONLY)

   Press +use to slow down your fall.

  Cvars:

   sv_parachute "1"         - 0: disables the plugin - 1: enables the plugin

   parachute_cost "1000"      - cost of the parachute (CStrike ONLY)

   parachute_payback "75"      - how many percent of the parachute cost you get when you sell your parachute
                        (ie. (75/100) * 1000 = 750$)

   parachute_fallspeed "100"   - speed of the fall when you use the parachute


  Setup (AMXX 1.x):

   Install the amxx file.
   Enable engine and cstrike (for cs only) in the amxx modules.ini
   Put the parachute.mdl file in the modname/models/ folder

*******************************************************************************/

#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, pCost, pPayback

#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) {

      pCost = register_cvar("parachute_cost", "1000")
      pPayback = register_cvar("parachute_payback", "75")

      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 plugin_precache()
{
   precache_model("models/parachute.mdl")
}

public client_connect(id)
{
   parachute_reset(id)
}

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])
      set_user_gravity(id, 1.0)
      para_ent[id] = 0
   }

   if (!gCStrike || access(id,PARACHUTE_LEVEL) || get_pcvar_num(pCost) <= 0) {
      has_parachute[id] = true
      //set_view(id, CAMERA_3RDPERSON)
   }
}

public HandleSay(id)
{
   if(!is_user_connected(id)) return PLUGIN_CONTINUE

   new args[128]
   read_args(args, 127)
   remove_quotes(args)

   if (gCStrike) {
      if (equali(args, "buy_parachute")) {
         buy_parachute(id)
         return PLUGIN_HANDLED
      }
      else if (equali(args, "sell_parachute")) {
         sell_parachute(id)
         return PLUGIN_HANDLED
      }
      else if (containi(args, "give_parachute") == 0) {
         give_parachute(id,args[15])
         return PLUGIN_HANDLED
      }
   }

   if (containi(args, "parachute") != -1) {
      if (gCStrike) client_print(id, print_chat, "[AMXX] Parachute commands: buy_parachute, sell_parachute, give_parachute")
      client_print(id, print_chat, "[AMXX] To use your parachute press and hold your +use button while falling")
   }

   return PLUGIN_CONTINUE
}

public buy_parachute(id)
{
   if (!gCStrike) return PLUGIN_CONTINUE
   if (!is_user_connected(id)) return PLUGIN_CONTINUE

   if (!get_pcvar_num(pEnabled)) {
      client_print(id, print_chat, "[AMXX] Parachute plugin is disabled")
      return PLUGIN_HANDLED
   }

   if (has_parachute[id]) {
      client_print(id, print_chat, "[AMXX] You already have a parachute")
      return PLUGIN_HANDLED
   }

   new money = cs_get_user_money(id)
   new cost = get_pcvar_num(pCost)

   if (money < cost) {
      client_print(id, print_chat, "[AMXX] You don't have enough moneyfor a parachute - Costs $%i", cost)
      return PLUGIN_HANDLED
   }

   cs_set_user_money(id, money - cost)
   client_print(id, print_chat, "[AMXX] You have bought a parachute. To use it, press +use while falling.")
   has_parachute[id] = true

   return PLUGIN_HANDLED
}

public sell_parachute(id)
{
   if (!gCStrike) return PLUGIN_CONTINUE
   if (!is_user_connected(id)) return PLUGIN_CONTINUE

   if (!get_pcvar_num(pEnabled)) {
      client_print(id, print_chat, "[AMXX] Parachute plugin is disabled")
      return PLUGIN_HANDLED
   }

   if (!has_parachute[id]) {
      client_print(id, print_chat, "[AMXX] You don't have a parachute to sell")
      return PLUGIN_HANDLED
   }

   if (access(id,PARACHUTE_LEVEL)) {
      client_print(id, print_chat, "[AMXX] You cannot sell your free admin parachute")
      return PLUGIN_HANDLED
   }

   parachute_reset(id)

   new money = cs_get_user_money(id)
   new cost = get_pcvar_num(pCost)

   new sellamt = floatround(cost * (get_pcvar_num(pPayback) / 100.0))
   cs_set_user_money(id, money + sellamt)

   client_print(id, print_chat, "[AMX] You have sold your used parachute for $%d", sellamt)

   return PLUGIN_CONTINUE
}

public give_parachute(id,args[])
{
   if (!gCStrike) return PLUGIN_CONTINUE
   if (!is_user_connected(id)) return PLUGIN_CONTINUE

   if (!get_pcvar_num(pEnabled)) {
      client_print(id, print_chat, "[AMXX] Parachute plugin is disabled")
      return PLUGIN_HANDLED
   }

   if (!has_parachute[id]) {
      client_print(id, print_chat, "[AMXX] You don't have a parachute to give")
      return PLUGIN_HANDLED
   }

   new player = cmd_target(id, args, 4)
   if (!player) return PLUGIN_HANDLED

   new id_name[32], pl_name[32]
   get_user_name(id, id_name, 31)
   get_user_name(player, pl_name, 31)

   if(has_parachute[player]) {
      client_print(id, print_chat, "[AMXX] %s already has a parachute.", pl_name)
      return PLUGIN_HANDLED
   }

   parachute_reset(id)
   has_parachute[player] = true

   client_print(id, print_chat, "[AMXX] You have given your parachute to %s.", pl_name)
   client_print(player, print_chat, "[AMXX] %s has given thier parachute to you.", id_name)

   return PLUGIN_HANDLED
}

public admin_give_parachute(id, level, cid) {

   if (!gCStrike) return PLUGIN_CONTINUE

   if(!cmd_access(id,level,cid,2)) return PLUGIN_HANDLED

   if (!get_pcvar_num(pEnabled)) {
      client_print(id, print_chat, "[AMXX] Parachute plugin is disabled")
      return PLUGIN_HANDLED
   }

   new arg[32], name[32], name2[32], authid[35], authid2[35]
   read_argv(1,arg,31)
   get_user_name(id,name,31)
   get_user_authid(id,authid,34)

   if (arg[0]=='@'){
      new players[32], inum
      if (equali("T",arg[1]))      copy(arg[1],31,"TERRORIST")
      if (equali("ALL",arg[1]))   get_players(players,inum)
      else                  get_players(players,inum,"e",arg[1])

      if (inum == 0) {
         console_print(id,"No clients in such team")
         return PLUGIN_HANDLED
      }

      for(new a = 0; a < inum; a++) {
         has_parachute[players[a]] = true
      }

      switch(get_cvar_num("amx_show_activity"))   {
         case 2:   client_print(0,print_chat,"ADMIN %s: gave a parachute to ^"%s^" players",name,arg[1])
         case 1:   client_print(0,print_chat,"ADMIN: gave a parachute to ^"%s^" players",arg[1])
      }

      console_print(id,"[AMXX] You gave a parachute to ^"%s^" players",arg[1])
      log_amx("^"%s<%d><%s><>^" gave a parachute to ^"%s^"", name,get_user_userid(id),authid,arg[1])
   }
   else {

      new player = cmd_target(id,arg,6)
      if (!player) return PLUGIN_HANDLED

      has_parachute[player] = true

      get_user_name(player,name2,31)
      get_user_authid(player,authid2,34)

      switch(get_cvar_num("amx_show_activity")) {
         case 2:   client_print(0,print_chat,"ADMIN %s: gave a parachute to ^"%s^"",name,name2)
         case 1:   client_print(0,print_chat,"ADMIN: gave a parachute to ^"%s^"",name2)
      }

      console_print(id,"[AMXX] You gave a parachute to ^"%s^"", name2)
      log_amx("^"%s<%d><%s><>^" gave a parachute to ^"%s<%d><%s><>^"", name,get_user_userid(id),authid,name2,get_user_userid(player),authid2)
   }
   return PLUGIN_HANDLED
}

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_model(para_ent[id], "models/parachute.mdl")
               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
   }
}


следы
Код: Выделить всё
/*************************************************************************************************************
                              AMX Follow the Wounded

  Version: 0.1
  Author: KRoT@L

  0.1    Release


   When the health of a player goes below ftw_health, the footsteps of this player will be
   covered with blood. Thus you can follow him.


  Cvars:

   ftw_active "1"   -   0: Disables the plugin
                    1: Enables the plugin

   ftw_health "20"         -   the footsteps are covered with blood only if health goes below this value


  Setup (AMX 0.9.9):
 
   Install the amx file.
   Enable VexdUM (both in metamod/plugins.ini and amx/config/modules.ini)

*************************************************************************************************************/

#include <amxmodx>
#include <amxmisc>
#include <engine>

//If one line doesn't work, comment it and uncomment the other line
//new decals[2] = {105,106}
new decals[2] = {107,108}


new bool:g_isDying[33]
new g_decalSwitch[33]

public plugin_init()
{
   register_plugin("Follow the Wounded", "0.1", "KRoTaL")

   register_cvar("ftw_active", "1")
   register_cvar("ftw_health", "20")

   register_event("ResetHUD","resethud_event","be")
   register_event("Damage","damage_event","b")
   register_event("DeathMsg","death_event","a")
}

public client_connect(id)
{
   g_isDying[id] = false
   remove_task(4247545+id)
}

public resethud_event(id)
{
   if(g_isDying[id])
   {
      g_isDying[id] = false
      remove_task(4247545+id)
   }
}

public damage_event(id)
{
   if(get_cvar_num("ftw_active") == 0) return PLUGIN_CONTINUE

   if(!g_isDying[id] && is_user_alive(id) && get_user_health(id) <= get_cvar_num("ftw_health"))
   {
      g_isDying[id] = true
      g_decalSwitch[id] = 0
      new param[1]
      param[0] = id
      set_task(0.2, "make_footsteps", 4247545+id, param, 1, "b")
   }
   return PLUGIN_CONTINUE
}

public death_event()
{
   new id = read_data(2)
   if(g_isDying[id])
   {
      g_isDying[id] = false
      remove_task(4247545+id)
   }
}

public make_footsteps(param[])
{
   new id = param[0]
   if(!is_user_alive(id) || get_cvar_num("ftw_active") == 0 || get_speed(id) < 120) return
   new origin[3]
   get_user_origin(id, origin)
   if(entity_get_int(id, EV_INT_bInDuck) == 1)
      origin[2] -= 18
   else
      origin[2] -= 36
   new Float:velocity[3]
   new Float:ent_angles[3]
   new Float:ent_origin[3]
   new ent

   entity_get_vector(id, EV_VEC_v_angle, ent_angles)
   entity_get_vector(id, EV_VEC_origin, ent_origin)

   ent = create_entity("info_target")
   if(ent > 0)
   {
      ent_angles[0] = 0.0
      if(g_decalSwitch[id] == 0) ent_angles[1] -= 90
      else ent_angles[1] += 90
      entity_set_vector(ent, EV_VEC_origin, ent_origin)
      entity_set_vector(ent, EV_VEC_v_angle, ent_angles)
      VelocityByAim(ent, 12, velocity)
      remove_entity(ent)
   }
   message_begin(MSG_BROADCAST, SVC_TEMPENTITY, origin)
   write_byte(116)
   write_coord(origin[0] + floatround(velocity[0]))
   write_coord(origin[1] + floatround(velocity[1]))
   write_coord(origin[2])
   write_byte(decals[g_decalSwitch[id]])
   message_end()
   g_decalSwitch[id] = 1 - g_decalSwitch[id]
   return
}


часы на карте
Код: Выделить всё
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <maths>

#pragma semicolon 1;

#define PLUGIN "Clock Maker"
#define VERSION "1.1"
#define AUTHOR "Necro"

#define ADMIN_LEVEL      ADMIN_MENU   //admin access level to use this plugin. ADMIN_MENU = flag 'u'
#define MAIN_MENU_KEYS      (1<<0)|(1<<1)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<9)

/* enum for menu selections */
enum { N1, N2, N3, N4, N5, N6, N7, N8, N9, N0 };
new const X = 0;
new const Y = 1;
new const Z = 2;         //for some reason I got tag mismatch on Z when using an enum

new gszMainMenuText[256];
new const gszClockFaces[] = "sprites/clock_faces.spr";
new const gszClockDigits[] = "sprites/clock_digits.spr";
new const gszPrefix[] = "[CM] ";
new const gszInfoTarget[] = "info_target";
new const gszClockClassname[] = "cm_clock";
new const gszClockDigitClassname[] = "cm_clockdigit";
new const Float:gfDigitOffsetMultipliers[4] = {0.725, 0.275, 0.3, 0.75};
new const Float:gfClockSize[2] = {80.0, 32.0};
new const Float:gfTitleSize = 16.0;

new gszTime[5];
new gszFile[128];
new gTimeOffsetOld;
new gHourTypeOld;

const gClockTypesMax = 2;

//clock types
enum
{
   CM_SERVERTIME,
   CM_MAPTIMELEFT
};

new gClockSaveIds[gClockTypesMax] =
{
   'C', 'T'
};

public plugin_init()
{
   register_plugin(PLUGIN, VERSION, AUTHOR);
   
   //CVARs
   register_cvar("cm_hourtype", "1");      //0: 12 hour, 1: 24 hour
   register_cvar("cm_hourannounce", "1");      //say the hour on the hour
   register_cvar("cm_timeoffset", "0");      //offset the time to a different timezone +/- hours
   
   //menus
   register_menucmd(register_menuid("clockMainMenu"), MAIN_MENU_KEYS, "handleMainMenu");
   
   //commands
   register_clcmd("say /cm", "showClockMenu", ADMIN_LEVEL);
}

public plugin_precache()
{
   precache_model(gszClockFaces);
   precache_model(gszClockDigits);
}

public plugin_cfg()
{
   //create the main menu
   new size = sizeof(gszMainMenuText);
   add(gszMainMenuText, size, "\yClock Maker Menu^n^n");
   add(gszMainMenuText, size, "\r1. \wCreate server time clock^n");
   add(gszMainMenuText, size, "\r2. \wCreate map timeleft clock^n^n");
   add(gszMainMenuText, size, "\r4. \wDelete clock^n^n");
   add(gszMainMenuText, size, "\r5. \wMake larger^n");
   add(gszMainMenuText, size, "\r6. \wMake smaller^n^n");
   add(gszMainMenuText, size, "\r7. \wSave clocks^n");
   add(gszMainMenuText, size, "\r8. \wLoad clocks^n^n");
   add(gszMainMenuText, size, "\r0. \wClose^n");
   
   //store current CVAR values (so we can check if they get changed)
   gTimeOffsetOld = get_cvar_num("cm_timeoffset");
   gHourTypeOld = get_cvar_num("cm_hourtype");
   
   //make save folder in basedir
   new szDir[64];
   new szMap[32];
   
   get_basedir(szDir, 64);
   add(szDir, 64, "/clockmaker");
   
   //create the folder is it doesn't exist
   if (!dir_exists(szDir))
   {
      mkdir(szDir);
   }
   
   get_mapname(szMap, 32);
   formatex(gszFile, 96, "%s/%s.cm", szDir, szMap);
   
   //load the clocks
   loadClocks(0);
   
   //set a task to update the clocks (every second is frequent enough)
   set_task(1.0, "taskUpdateClocks", 0, "", 0, "b");
}

public taskUpdateClocks()
{
   new clock = -1;
   
   //get the time digits
   new serverTimeDigits[4];
   new timeleftDigits[4];
   new bool:bUpdateServerTime = getTimeDigits(CM_SERVERTIME, serverTimeDigits);
   getTimeDigits(CM_MAPTIMELEFT, timeleftDigits);
   
   //find all clock entities
   while ((clock = find_ent_by_class(clock, gszClockClassname)))
   {
      //get the clock type
      new clockType = entity_get_int(clock, EV_INT_groupinfo);
      
      //if the time changed for this clocktype
      if (clockType == CM_SERVERTIME)
      {
         if (bUpdateServerTime)
         {
            //set the clock to the correct time
            set_clock_digits(clock, serverTimeDigits);
         }
      }
      else if (clockType == CM_MAPTIMELEFT)
      {
         //set the clock to show the timeleft
         set_clock_digits(clock, timeleftDigits);
      }
   }
   
   //check to see if its on the hour
   if (bUpdateServerTime)
   {
      new hour, mins;
      time(hour, mins);
      
      //if its on the hour then alert
      if (mins == 0)
      {
         alertHour(hour);
      }
   }
}

public showClockMenu(id)
{
   //show the main menu to the player
   show_menu(id, MAIN_MENU_KEYS, gszMainMenuText, -1, "clockMainMenu");
   
   return PLUGIN_HANDLED;
}

public handleMainMenu(id, num)
{
   switch (num)
   {
      case N1: createClockAiming(id, CM_SERVERTIME);
      case N2: createClockAiming(id, CM_MAPTIMELEFT);
      case N4: deleteClockAiming(id);
      case N5: scaleClockAiming(id, 0.1);
      case N6: scaleClockAiming(id, -0.1);
      case N7: saveClocks(id);
      case N8: loadClocks(id);
   }
   
   //show menu again
   if (num != N0)
   {
      showClockMenu(id);
   }
   
   return PLUGIN_HANDLED;
}

createClockAiming(id, clockType)
{
   //make sure player has access to this command
   if (get_user_flags(id) & ADMIN_LEVEL)
   {
      new origin[3];
      new Float:vOrigin[3];
      new Float:vAngles[3];
      new Float:vNormal[3];
      
      //get the origin of where the player is aiming
      get_user_origin(id, origin, 3);
      IVecFVec(origin, vOrigin);
      
      new bool:bSuccess = traceClockAngles(id, vAngles, vNormal, 1000.0);
      
      //if the trace was successfull
      if (bSuccess)
      {
         //if the plane the trace hit is vertical
         if (vNormal[2] == 0.0)
         {
            //create the clock
            new bool:bSuccess = createClock(clockType, vOrigin, vAngles, vNormal);
            
            //if clock created successfully
            if (bSuccess)
            {
               client_print(id, print_chat, "%sCreated clock", gszPrefix);
            }
         }
         else
         {
            client_print(id, print_chat, "%sYou must place the clock on a vertical wall!", gszPrefix);
         }
      }
      else
      {
         client_print(id, print_chat, "%sMove closer to the target to create the clock", gszPrefix);
      }
   }
}

bool:createClock(clockType, Float:vOrigin[3], Float:vAngles[3], Float:vNormal[3], Float:fScale = 1.0)
{
   new clock = create_entity(gszInfoTarget);
   new digit[4];
   new bool:bFailed = false;
   
   //create 4 new entities to use for digits on the clock
   for (new i = 0; i < 4; ++i)
   {
      digit[i] = create_entity(gszInfoTarget);
      
      //if failed boolean is false and entity failed to create
      if (!bFailed && !is_valid_ent(digit[i]))
      {
         bFailed = true;
         break;
      }
   }
   
   //make sure all entities were created successfully
   if (is_valid_ent(clock) && !bFailed)
   {
      //adjust the origin to lift the clock off the wall (prevent flickering)
      vOrigin[0] += (vNormal[0] * 0.5);
      vOrigin[1] += (vNormal[1] * 0.5);
      vOrigin[2] += (vNormal[2] * 0.5);
      
      //set clock properties
      entity_set_string(clock, EV_SZ_classname, gszClockClassname);
      entity_set_int(clock, EV_INT_solid, SOLID_NOT);
      entity_set_model(clock, gszClockFaces);
      entity_set_vector(clock, EV_VEC_angles, vAngles);
      entity_set_float(clock, EV_FL_scale, fScale);
      entity_set_origin(clock, vOrigin);
      entity_set_int(clock, EV_INT_groupinfo, clockType);
      
      //set the entity frame (clock face) depending on the clock type
      switch (clockType)
      {
         case CM_SERVERTIME: entity_set_float(clock, EV_FL_frame, 0.0);
         case CM_MAPTIMELEFT: entity_set_float(clock, EV_FL_frame, 1.0);
      }
      
      //link the digits entities to the clock
      entity_set_int(clock, EV_INT_iuser1, digit[0]);
      entity_set_int(clock, EV_INT_iuser2, digit[1]);
      entity_set_int(clock, EV_INT_iuser3, digit[2]);
      entity_set_int(clock, EV_INT_iuser4, digit[3]);
      
      new digitValues[4];
      
      //setup the digits to make up the time
      for (new i = 0; i < 4; ++i)
      {
         //setup digit properties
         entity_set_string(digit[i], EV_SZ_classname, gszClockDigitClassname);
         entity_set_vector(digit[i], EV_VEC_angles, vAngles);
         entity_set_model(digit[i], gszClockDigits);
         entity_set_float(digit[i], EV_FL_scale, fScale);
         
         //set digit position
         set_digit_origin(i, digit[i], vOrigin, vNormal, fScale);
         
         //get the time digits
         getTimeDigits(clockType, digitValues);
         
         //set the in-game clocks digits
         set_clock_digits(clock, digitValues);
      }
      
      return true;
   }
   else
   {
      //delete clock face if it created successfully
      if (is_valid_ent(clock))
      {
         remove_entity(clock);
      }
      
      //iterate though the entity array and delete whichever ones created successfully
      for (new i = 0; i < 4; ++i)
      {
         if (is_valid_ent(digit[i]))
         {
            remove_entity(digit[i]);
         }
      }
   }
   
   return false;
}

deleteClockAiming(id)
{
   new bool:bDeleted;
   new clock = get_clock_aiming(id);
   
   if (clock)
   {
      //delete the clock
      bDeleted = deleteClock(clock);
      
      //if the clock was deleted successfully
      if (bDeleted)
      {
         client_print(id, print_chat, "%sDeleted clock", gszPrefix);
      }
   }
}

bool:deleteClock(ent)
{
   //if the entity is a clock
   if (isClock(ent))
   {
      //get entity IDs of digits on the clock
      new digit[4];
      digit[0] = entity_get_int(ent, EV_INT_iuser1);
      digit[1] = entity_get_int(ent, EV_INT_iuser2);
      digit[2] = entity_get_int(ent, EV_INT_iuser3);
      digit[3] = entity_get_int(ent, EV_INT_iuser4);
      
      //delete the digits on the clock if they're valid
      if (is_valid_ent(digit[0])) remove_entity(digit[0]);
      if (is_valid_ent(digit[1])) remove_entity(digit[1]);
      if (is_valid_ent(digit[2])) remove_entity(digit[2]);
      if (is_valid_ent(digit[3])) remove_entity(digit[3]);
      
      //delete the clock face
      remove_entity(ent);
      
      //successfully deleted the clock
      return true;
   }
   
   return false;
}

scaleClockAiming(id, Float:fScaleAmount)
{
   //get the clock the player is aiming at (if any)
   new clock = get_clock_aiming(id);
   
   //if player is aiming at a clock
   if (clock)
   {
      //get the clocks digit entities
      new digit[4];
      new bSuccess = get_clock_digits(clock, digit);
      
      //if successfully got clocks digit entities
      if (bSuccess)
      {
         new Float:vOrigin[3];
         new Float:vNormal[3];
         new Float:vAngles[3];
         
         //get the clocks current scale and add on the specified amount
         new Float:fScale = entity_get_float(clock, EV_FL_scale);
         fScale += fScaleAmount;
         
         //make sure the scale isn't negative
         if (fScale > 0.01)
         {
            //set the clocks scale
            entity_set_float(clock, EV_FL_scale, fScale);
            
            //get the clocks origin and angles
            entity_get_vector(clock, EV_VEC_origin, vOrigin);
            entity_get_vector(clock, EV_VEC_angles, vAngles);
            
            //get the clocks normal vector from the angles
            angle_vector(vAngles, ANGLEVECTOR_FORWARD, vNormal);
            
            //set the normal to point in the opposite direction
            vNormal[0] = -vNormal[0];
            vNormal[1] = -vNormal[1];
            vNormal[2] = -vNormal[2];
            
            //enlarge the clocks digits by the specified amount
            for (new i = 0; i < 4; ++i)
            {
               //set the digits scale
               entity_set_float(digit[i], EV_FL_scale, fScale);
               
               //adjust the digits origin because of the new scale
               set_digit_origin(i, digit[i], vOrigin, vNormal, fScale);
            }
         }
      }
   }
}

saveClocks(id)
{
   //make sure player has access to this command
   if (get_user_flags(id) & ADMIN_LEVEL)
   {
      new ent = -1;
      new Float:vOrigin[3];
      new Float:vAngles[3];
      new Float:fScale;
      new clockCount = 0;
      new szData[128];
      
      //open file for writing
      new file = fopen(gszFile, "wt");
      new clockType;
      
      while ((ent = find_ent_by_class(ent, gszClockClassname)))
      {
         //get clock info
         entity_get_vector(ent, EV_VEC_origin, vOrigin);
         entity_get_vector(ent, EV_VEC_angles, vAngles);
         fScale = entity_get_float(ent, EV_FL_scale);
         clockType = entity_get_int(ent, EV_INT_groupinfo);
         
         //format clock info and save it to file
         formatex(szData, 128, "%c %f %f %f %f %f %f %f^n", gClockSaveIds[clockType], vOrigin[0], vOrigin[1], vOrigin[2], vAngles[0], vAngles[1], vAngles[2], fScale);
         fputs(file, szData);
         
         //increment clock count
         ++clockCount;
      }
      
      //get players name
      new szName[32];
      get_user_name(id, szName, 32);
      
      //notify all admins that the player saved clocks to file
      for (new i = 1; i <= 32; ++i)
      {
         //make sure player is connected
         if (is_user_connected(i))
         {
            if (get_user_flags(i) & ADMIN_LEVEL)
            {
               client_print(i, print_chat, "%s'%s' saved %d clock%s to file!", gszPrefix, szName, clockCount, (clockCount == 1 ? "" : "s"));
            }
         }
      }
      
      //close file
      fclose(file);
   }
}

loadClocks(id)
{
   //if the clock save file exists
   if (file_exists(gszFile))
   {
      new szData[128];
      new szType[2];
      new oX[13], oY[13], oZ[13];
      new aX[13], aY[13], aZ[13];
      new szScale[13];
      new Float:vOrigin[3];
      new Float:vAngles[3];
      new Float:vNormal[3];
      new Float:fScale;
      new clockCount = 0;
      
      //open the file for reading
      new file = fopen(gszFile, "rt");
      
      //iterate through all the lines in the file
      while (!feof(file))
      {
         szType = "";
         fgets(file, szData, 128);
         parse(szData, szType, 2, oX, 12, oY, 12, oZ, 12, aX, 12, aY, 12, aZ, 12, szScale, 12);
         
         vOrigin[0] = str_to_float(oX);
         vOrigin[1] = str_to_float(oY);
         vOrigin[2] = str_to_float(oZ);
         vAngles[0] = str_to_float(aX);
         vAngles[1] = str_to_float(aY);
         vAngles[2] = str_to_float(aZ);
         fScale = str_to_float(szScale);
         
         if (strlen(szType) > 0)
         {
            //get the normal vector from the angles
            angle_vector(vAngles, ANGLEVECTOR_FORWARD, vNormal);
            
            //set the normal to point in the opposite direction
            vNormal[0] = -vNormal[0];
            vNormal[1] = -vNormal[1];
            vNormal[2] = -vNormal[2];
            
            //create the clock depending on the clock type
            switch (szType[0])
            {
               case 'C': createClock(CM_SERVERTIME, vOrigin, vAngles, vNormal, fScale);
               case 'T': createClock(CM_MAPTIMELEFT, vOrigin, vAngles, vNormal, fScale);
            }
            
            ++clockCount;
         }
      }
      
      //close the file
      fclose(file);
      
      //if a player is loading the clocks
      if (id > 0 && id <= 32)
      {
         //get players name
         new szName[32];
         get_user_name(id, szName, 32);
         
         //notify all admins that the player loaded clocks from file
         for (new i = 1; i <= 32; ++i)
         {
            //make sure player is connected
            if (is_user_connected(i))
            {
               if (get_user_flags(i) & ADMIN_LEVEL)
               {
                  client_print(i, print_chat, "%s'%s' loaded %d clock%s from file!", gszPrefix, szName, clockCount, (clockCount == 1 ? "" : "s"));
               }
            }
         }
      }
   }
}

get_clock_aiming(id)
{
   //get hit point for where player is aiming
   new origin[3];
   new Float:vOrigin[3];
   get_user_origin(id, origin, 3);
   IVecFVec(origin, vOrigin);
   
   new ent = -1;
   
   //find all entities within a 2 unit sphere
   while ((ent = find_ent_in_sphere(ent, vOrigin, 2.0)))
   {
      //if entity is a clock
      if (isClock(ent))
      {
         return ent;
      }
   }
   
   return 0;
}

bool:traceClockAngles(id, Float:vAngles[3], Float:vNormal[3], Float:fDistance)
{
   //get players origin and add on their view offset
   new Float:vPlayerOrigin[3];
   new Float:vViewOfs[3];
   entity_get_vector(id, EV_VEC_origin, vPlayerOrigin);
   entity_get_vector(id, EV_VEC_view_ofs, vViewOfs);
   vPlayerOrigin[0] += vViewOfs[0];
   vPlayerOrigin[1] += vViewOfs[1];
   vPlayerOrigin[2] += vViewOfs[2];
   
   //calculate the end point for trace using the players view angle
   new Float:vAiming[3];
   entity_get_vector(id, EV_VEC_v_angle, vAngles);
   vAiming[0] = vPlayerOrigin[0] + floatcos(vAngles[1], degrees) * fDistance;
   vAiming[1] = vPlayerOrigin[1] + floatsin(vAngles[1], degrees) * fDistance;
   vAiming[2] = vPlayerOrigin[2] + floatsin(-vAngles[0], degrees) * fDistance;
   
   //trace a line and get the normal for the plane it hits
   new trace = trace_normal(id, vPlayerOrigin, vAiming, vNormal);
   
   //convert the normal into an angle vector
   vector_to_angle(vNormal, vAngles);
   
   //spin the angle vector 180 degrees around the Y axis
   vAngles[1] += 180.0;
   if (vAngles[1] >= 360.0) vAngles[1] -= 360.0;
   
   return bool:trace;
}

set_digit_origin(i, digit, Float:vOrigin[3], Float:vNormal[3], Float:fScale)
{
   //make sure the digit entity is valid
   if (is_valid_ent(digit))
   {
      new Float:vDigitNormal[3];
      new Float:vPos[3];
      new Float:fVal;
      
      //change the normals to get the left and right depending on the digit
      vDigitNormal = vNormal;
      if (i == 0 || i == 1) vDigitNormal[X] = -vDigitNormal[X];
      if (i == 2 || i == 3) vDigitNormal[Y] = -vDigitNormal[Y];
      
      //setup digit position
      fVal = (((gfClockSize[X] / 2) * gfDigitOffsetMultipliers[i])) * fScale;
      vPos[X] = vOrigin[X] + (vDigitNormal[Y] * fVal);
      vPos[Y] = vOrigin[Y] + (vDigitNormal[X] * fVal);
      vPos[Z] = vOrigin[Z] + vNormal[Z] - ((gfTitleSize / 2.0 )* fScale);
      
      //bring digit sprites forwards off the clock face to prevent flickering
      vPos[0] += (vNormal[0] * 0.5);
      vPos[1] += (vNormal[1] * 0.5);
      vPos[2] += (vNormal[2] * 0.5);
      
      //set the digits origin
      entity_set_origin(digit, vPos);
   }
}

bool:getTimeDigits(clockType, digitValues[4])
{
   switch (clockType)
   {
      case CM_SERVERTIME:
      {
         new bool:bChanged = false;
         new szTime[5];
         new timeOffset = get_cvar_num("cm_timeoffset");
         new hourType = get_cvar_num("cm_hourtype");
         
         //get the time
         new hour, mins;
         time(hour, mins);
         
         //add on the time offset
         hour += timeOffset;
         
         //make sure hour hasnt gone out of bounds
         while (hour < 0)
         {
            hour += 24;
         }
         
         while (hour >= 24)
         {
            hour -= 24;
         }
         
         //if server is set to use 12 hour clocks
         if (hourType == 0)
         {
            if (hour > 12)
            {
               hour -= 12;
            }
         }
         
         //format the time into a string
         format(szTime, 4, "%s%d%s%d", (hour < 10 ? "0" : ""), hour, (mins < 10 ? "0" : ""), mins);
         
         //calculate time digits from string
         digitValues[0] = szTime[0] - 48;
         digitValues[1] = szTime[1] - 48;
         digitValues[2] = szTime[2] - 48;
         digitValues[3] = szTime[3] - 48;
         
         //if the time has changed
         if (!equal(gszTime, szTime))
         {
            gszTime = szTime;
            bChanged = true;
         }
         
         //if the hour type has changed
         if (hourType != gHourTypeOld)
         {
            gHourTypeOld = hourType;
            bChanged = true;
         }
         
         //if the time offset value has changed
         if (timeOffset != gTimeOffsetOld)
         {
            gTimeOffsetOld = timeOffset;
            bChanged = true;
         }
         
         return bChanged;
      }
      
      case CM_MAPTIMELEFT:
      {
         //get timeleft on map and calculate the minutes and seconds
         new timeleft = get_timeleft();
         new mins = timeleft / 60;
         new secs = timeleft % 60;
         
         //format the timeleft into a string
         new szTime[5];
         format(szTime, 4, "%s%d%s%d", (mins < 10 ? "0" : ""), mins, (secs < 10 ? "0" : ""), secs);
         
         //calculate time digits from string
         digitValues[0] = szTime[0] - 48;
         digitValues[1] = szTime[1] - 48;
         digitValues[2] = szTime[2] - 48;
         digitValues[3] = szTime[3] - 48;
         
         return true;
      }
   }
   
   return false;
}

bool:get_clock_digits(clock, digit[4])
{
   //if the entity is a clock
   if (isClock(clock))
   {
      //get entity IDs of digits on the clock
      digit[0] = entity_get_int(clock, EV_INT_iuser1);
      digit[1] = entity_get_int(clock, EV_INT_iuser2);
      digit[2] = entity_get_int(clock, EV_INT_iuser3);
      digit[3] = entity_get_int(clock, EV_INT_iuser4);
      
      //make sure all the clock digits are valid
      for (new i = 0; i < 4; ++i)
      {
         if (!is_valid_ent(digit[i]))
         {
            log_amx("%sInvalid digit entity in clock", gszPrefix);
            
            return false;
         }
      }
   }
   
   return true;
}

set_clock_digits(clock, digitValues[4])
{
   //get the clocks digit entities
   new digits[4];
   new bool:bSuccess = get_clock_digits(clock, digits);
   
   //if successfully got clocks digit entities
   if (bSuccess)
   {
      //setup clock digits
      entity_set_float(digits[0], EV_FL_frame, float(digitValues[0]));
      entity_set_float(digits[1], EV_FL_frame, float(digitValues[1]));
      entity_set_float(digits[2], EV_FL_frame, float(digitValues[2]));
      entity_set_float(digits[3], EV_FL_frame, float(digitValues[3]));
   }
}

alertHour(hour)
{
   //if we're set to speak the hour
   if (get_cvar_num("cm_hourannounce") > 0)
   {
      new szMeridiem[4] = "am";
      new szHour[16];
      
      //setup hour. Make sure hour isn't above 12 and isn't 00 o'clock
      if (hour >= 12) szMeridiem = "pm";
      if (hour > 12) hour -= 12;
      if (hour == 0) hour = 12;
      
      //get the hour as a word
      num_to_word(hour, szHour, 15);
      
      //speak the time
      client_cmd(0, "spk ^"fvox/bell _period %s %s^"", szHour, szMeridiem);
   }
}

bool:isClock(ent)
{
   //if entity is valid
   if (is_valid_ent(ent))
   {
      //get classname of entity
      new szClassname[32];
      entity_get_string(ent, EV_SZ_classname, szClassname, 32);
      
      //if classname of entity matches global clock classname
      if (equal(szClassname, gszClockClassname))
      {
         //entity is a clock
         return true;
      }
   }
   
   return false;
}
Get in Position and wait for my go
Аватара пользователя
Lip
 
Сообщения: 20
Зарегистрирован: 15 фев 2011, 21:35
Благодарил (а): 7 раз.
Поблагодарили: 2 раз.
Языки программирования: Counter-Strike 1.6

Re: Ломают серв, заходят админами, банят админов.

Сообщение Retro-kolt Lincoln » 07 ноя 2011, 11:16

Как на счёт, запустить сервер и прописать rcon_password и посмотреть что он выдаст?
Предлагаю услуги гаранта. Написание плагинов на заказ.
Статус:
на заслуженном отдыхе
Отзывы: Нажми
Обратиться ко мне: Нажми

- - - - - - - - - - - - - - - -
Если ваше ЛС было проигнорировано мною, знайте, оно мне не интересно.
Аватара пользователя
Retro-kolt Lincoln
 
Сообщения: 1283
Зарегистрирован: 28 авг 2010, 19:16
Благодарил (а): 321 раз.
Поблагодарили: 581 раз.
Опыт программирования: Больше трех лет
Языки программирования: ╚►Counter-Strike 1.6

Re: Ломают серв, заходят админами, банят админов.

Сообщение Lip » 07 ноя 2011, 13:40

Кто выдаст? Сервер? Нормально работает дальше, я его и отключил, что подумал что rcon тырят. Но в логах нет ни rcon команд, ни входов других админов, просто:
L 11/05/2011 - 22:54:08: [admincmd_reason.amxx] Ban: "nick<3101><STEAM_0:0:41987944><>" ban and kick "nG_d1mt1x<3112><STEAM_0:0:1025706507><>" (minutes "0") (reason "")
НЕкто "nG_d1mt1x" банит админа на всегда, но он не логинился как админ. Значит он небыл админом, а просто послал команду на бан.

В парашуте упоминается админ
Я не програмист, но чую тут есть подвох
(#define PARACHUTE_LEVEL ADMIN_LEVEL_A)
Get in Position and wait for my go
Аватара пользователя
Lip
 
Сообщения: 20
Зарегистрирован: 15 фев 2011, 21:35
Благодарил (а): 7 раз.
Поблагодарили: 2 раз.
Языки программирования: Counter-Strike 1.6

Re: Ломают серв, заходят админами, банят админов.

Сообщение DJ_WEST » 07 ноя 2011, 16:53

Во-первых, на все плагины у тебя должны быть исходники. Во-вторых, все эти исходники надо компилить самому через amx-x.ru, оф.сайт или локально. В-третьих, что это за плагин admincmd_reason.amxx? Исходники в студию.
Не пишите мне в ЛС: если вам нужна помощь на бесплатной основе. Любые вопросы на форум.
Аватара пользователя
DJ_WEST
Администратор
 
Сообщения: 3641
Зарегистрирован: 22 авг 2009, 00:38
Благодарил (а): 48 раз.
Поблагодарили: 2209 раз.
Опыт программирования: Больше трех лет
Языки программирования: Counter-Strike 1.6
Counter-Strike: Source
Left 4 Dead
Left 4 Dead 2

Re: Ломают серв, заходят админами, банят админов.

Сообщение Lip » 08 ноя 2011, 10:04

У меня все исходники есть.

Это примочка к плагину Баншот. При бане у игрока появляется мотд с инфой.
Незнаю может и в ней дырка, но я этот плаг давно юзаю, проблем таких небыло.

Код: Выделить всё
/* AMX Mod X
*   Admin Commands Plugin
*
* by the AMX Mod X Development Team
*  originally developed by OLO
*
* This file is part of AMX Mod X.
*
*
*  This program is free software; you can redistribute it and/or modify it
*  under the terms of the GNU General Public License as published by the
*  Free Software Foundation; either version 2 of the License, or (at
*  your option) any later version.
*
*  This program is distributed in the hope that it will be useful, but
*  WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
*  General Public License for more details.
*
*  You should have received a copy of the GNU General Public License
*  along with this program; if not, write to the Free Software Foundation,
*  Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*  In addition, as a special exception, the author gives permission to
*  link the code of this program with the Half-Life Game Engine ("HL
*  Engine") and Modified Game Libraries ("MODs") developed by Valve,
*  L.L.C ("Valve"). You must obey the GNU General Public License in all
*  respects for all of the code used other than the HL Engine and MODs
*  from Valve. If you modify this file, you may extend this exception
*  to your version of the file, but you are not obligated to do so. If
*  you do not wish to do so, delete this exception statement from your
*  version.
*/

#include <amxmodx>
#include <amxmisc>

#define REASON "B /7a/7Ke cstrike ecTb CkpuHLLloT - gJl9 Pa36aHa CkuHTe ero /7o AgPeCy: Вы должны зарегистрироваться, чтобы видеть ссылки. BaLLl AgPeC!!!"
#define MAXRCONCVARS 16

new g_cvarRcon[MAXRCONCVARS][32]
new g_cvarRconNum
new g_pauseCon
new Float:g_pausAble
new bool:g_Paused
new bool:g_PauseAllowed = false
new g_addCvar[] = "amx_cvar add %s"

public plugin_init()
{
   register_plugin("Admin Commands", AMXX_VERSION_STR, "AMXX Dev Team")
   register_dictionary("admincmd.txt")
   register_dictionary("common.txt")
   register_concmd("amx_kick", "cmdKick", ADMIN_KICK, "<name or #userid> [reason]")
   register_concmd("amx_ban", "cmdBan", ADMIN_BAN, "<name or #userid> <minutes> [reason]")
   register_concmd("amx_banip", "cmdBanIP", ADMIN_BAN, "<name or #userid> <minutes> [reason]")
   register_concmd("amx_addban", "cmdAddBan", ADMIN_RCON, "<authid or ip> <minutes> [reason]")
   register_concmd("amx_unban", "cmdUnban", ADMIN_BAN, "<authid or ip>")
   register_concmd("amx_slay", "cmdSlay", ADMIN_SLAY, "<name or #userid>")
   register_concmd("amx_slap", "cmdSlap", ADMIN_SLAY, "<name or #userid> [power]")
   register_concmd("amx_leave", "cmdLeave", ADMIN_KICK, "<tag> [tag] [tag] [tag]")
   register_concmd("amx_pause", "cmdPause", ADMIN_CVAR, "- pause or unpause the game")
   register_concmd("amx_who", "cmdWho", ADMIN_ADMIN, "- displays who is on server")
   register_concmd("amx_cvar", "cmdCvar", ADMIN_CVAR, "<cvar> [value]")
   register_concmd("amx_plugins", "cmdPlugins", ADMIN_ADMIN)
   register_concmd("amx_modules", "cmdModules", ADMIN_ADMIN)
   register_concmd("amx_map", "cmdMap", ADMIN_MAP, "<mapname>")
   register_concmd("amx_cfg", "cmdCfg", ADMIN_CFG, "<filename>")
   register_concmd("amx_nick", "cmdNick", ADMIN_SLAY, "<name or #userid> <new nick>")
   register_clcmd("amx_rcon", "cmdRcon", ADMIN_RCON, "<command line>")
   register_clcmd("amx_showrcon", "cmdShowRcon", ADMIN_RCON, "<command line>")
   register_clcmd("pauseAck", "cmdLBack")
}

public plugin_cfg()
{
   // Cvars which can be changed only with rcon access
   server_cmd(g_addCvar, "rcon_password")
   server_cmd(g_addCvar, "amx_show_activity")
   server_cmd(g_addCvar, "amx_mode")
   server_cmd(g_addCvar, "amx_password_field")
   server_cmd(g_addCvar, "amx_default_access")
   server_cmd(g_addCvar, "amx_reserved_slots")
   server_cmd(g_addCvar, "amx_reservation")
   server_cmd(g_addCvar, "amx_conmotd_file")
}

public cmdKick(id, level, cid)
{
   if (!cmd_access(id, level, cid, 2))
      return PLUGIN_HANDLED

   new arg[32]
   read_argv(1, arg, 31)
   new player = cmd_target(id, arg, 1)
   
   if (!player)
      return PLUGIN_HANDLED
   
   new authid[32], authid2[32], name2[32], name[32], userid2, reason[32]
   
   get_user_authid(id, authid, 31)
   get_user_authid(player, authid2, 31)
   get_user_name(player, name2, 31)
   get_user_name(id, name, 31)
   userid2 = get_user_userid(player)
   read_argv(2, reason, 31)
   remove_quotes(reason)
   
   log_amx("Kick: ^"%s<%d><%s><>^" kick ^"%s<%d><%s><>^" (reason ^"%s^")", name, get_user_userid(id), authid, name2, userid2, authid2, reason)
   
   switch (get_cvar_num("amx_show_activity"))
   {
      case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_KICK_2", name, name2)
      case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_KICK_1", name2)
   }

   if (is_user_bot(player))
      server_cmd("kick #%d", userid2)
   else
   {
      if (reason[0])
         server_cmd("kick #%d ^"%s^"", userid2, reason)
      else
         server_cmd("kick #%d", userid2)
   }
   
   console_print(id, "[AMXX] Client ^"%s^" kicked", name2)
   
   return PLUGIN_HANDLED
}

public cmdUnban(id, level, cid)
{
   if (!cmd_access(id, level, cid, 2))
      return PLUGIN_HANDLED
   
   new arg[32], authid[32], name[32]
   
   read_argv(1, arg, 31)
   
   if (contain(arg, ".") != -1)
   {
      server_cmd("removeip ^"%s^";writeip", arg)
      console_print(id, "[AMXX] %L", id, "IP_REMOVED", arg)
   } else {
      server_cmd("removeid %s;writeid", arg)
      console_print(id, "[AMXX] %L", id, "AUTHID_REMOVED", arg)
   }

   get_user_name(id, name, 31)
   
   switch (get_cvar_num("amx_show_activity"))
   {
      case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_UNBAN_2", name, arg)
      case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_UNBAN_1", arg)
   }

   get_user_authid(id, authid, 31)
   log_amx("Cmd: ^"%s<%d><%s><>^" unban ^"%s^"", name, get_user_userid(id), authid, arg)
   
   return PLUGIN_HANDLED
}

public cmdAddBan(id, level, cid)
{
   if (!cmd_access(id, level, cid, 3))
      return PLUGIN_HANDLED

   new arg[32], authid[32], name[32], minutes[32], reason[32]
   
   read_argv(1, arg, 31)
   read_argv(2, minutes, 31)
   read_argv(3, reason, 31)
   
   if (contain(arg, ".") != -1)
   {
      server_cmd("addip ^"%s^" ^"%s^";wait;writeip", minutes, arg)
      console_print(id, "[AMXX] Ip ^"%s^" added to ban list", arg)
   } else {
      server_cmd("banid ^"%s^" ^"%s^";wait;writeid", minutes, arg)
      console_print(id, "[AMXX] Authid ^"%s^" added to ban list", arg)
   }

   get_user_name(id, name, 31)

   switch (get_cvar_num("amx_show_activity"))
   {
      case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_ADDBAN_2", name, arg)
      case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_ADDBAN_1", arg)
   }

   get_user_authid(id, authid, 31)
   log_amx("Cmd: ^"%s<%d><%s><>^" ban ^"%s^" (minutes ^"%s^") (reason ^"%s^")", name, get_user_userid(id), authid, arg, minutes, reason)

   return PLUGIN_HANDLED
}

public cmdBan(id, level, cid)
{
   if (!cmd_access(id, level, cid, 3))
      return PLUGIN_HANDLED

   new target[32], minutes[8], reason[64]
   
   read_argv(1, target, 31)
   read_argv(2, minutes, 7)
   read_argv(3, reason, 63)
   
   new player = cmd_target(id, target, 9)
   
   if (!player)
      return PLUGIN_HANDLED

   new authid[32], name2[32], authid2[32], name[32]
   new userid2 = get_user_userid(player)

   get_user_authid(player, authid2, 31)
   get_user_authid(id, authid, 31)
   get_user_name(player, name2, 31)
   get_user_name(id, name, 31)
   
   log_amx("Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%s^") (reason ^"%s^")", name, get_user_userid(id), authid, name2, userid2, authid2, minutes, reason)
   
   new temp[64], banned[16], nNum = str_to_num(minutes)
   if (nNum)
      format(temp, 63, "%L", player, "FOR_MIN", minutes)
   else
      format(temp, 63, "%L", player, "PERM")

   format(banned, 15, "%L", player, "BANNED")

   if (reason[0])
      server_cmd("kick #%d ^"%s (%s %s)^";wait;banid ^"%s^" ^"%s^";wait;writeid", userid2, reason, banned, temp, minutes, authid2)
   else
      server_cmd("kick #%d ^"%s %s^";wait;banid ^"%s^" ^"%s^";wait;writeid", userid2, banned, temp, minutes, authid2)

   new activity = get_cvar_num("amx_show_activity")
   if (activity != 0)
   {
      new players[32], pnum, msg[256], len
      get_players(players, pnum, "c")
      
      for (new i = 0; i < pnum; i++)
      {
         len = format(msg, 255, "%L", players[i], "ADMIN")
         
         if (activity == 1)
            len += copy(msg[len], 255-len, ":")
         else
            len += format(msg[len], 255-len, " %s:", name)
         
         len += format(msg[len], 255-len, " %L", players[i], "BAN")
         len += format(msg[len], 255-len, " %s ", name2)
         
         if (nNum)
            format(msg[len], 255-len, "%L", players[i], "FOR_MIN", minutes)
         else
            format(msg[len], 255-len, "%L", players[i], "PERM")
         
         client_print(players[i], print_chat, "%s", msg)
      }
   }
   console_print(id, "[AMXX] %L", id, "CLIENT_BANNED", name2)
   
   return PLUGIN_HANDLED
}

public cmdBanIP(id, level, cid)
{
   if (!cmd_access(id, level, cid, 3))
      return PLUGIN_HANDLED
   
   new target[32], minutes[8], reason[64]
   
   read_argv(1, target, 31)
   read_argv(2, minutes, 7)
   read_argv(3, reason, 63)
   
   new player = cmd_target(id, target, 9)
   
   if (!player)
      return PLUGIN_HANDLED
   
   new authid[32], name2[32], authid2[32], name[32]
   new userid2 = get_user_userid(player)
   
   get_user_authid(player, authid2, 31)
   get_user_authid(id, authid, 31)
   get_user_name(player, name2, 31)
   get_user_name(id, name, 31)
   
   log_amx("Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%s^") (reason ^"%s^")", name, get_user_userid(id), authid, name2, userid2, authid2, minutes, reason)

   new temp[64], banned[16], nNum = str_to_num(minutes)
   if (nNum)
      format(temp, 63, "%L", player, "FOR_MIN", minutes)
   else
      format(temp, 63, "%L", player, "PERM")
   format(banned, 15, "%L", player, "BANNED")

   new address[32]
   get_user_ip(player, address, 31, 1)

   if (reason[0])
      server_cmd("kick #%d ^"%s (%s %s)^";wait;addip ^"%s^" ^"%s^";wait;writeip", userid2, reason, banned, REASON, minutes, address)
   else
      server_cmd("kick #%d ^"%s %s^";wait;addip ^"%s^" ^"%s^";wait;writeip", userid2, banned, REASON, minutes, address)

   new activity = get_cvar_num("amx_show_activity")
   if (activity != 0)
   {
      new players[32], pnum, msg[256], len
      get_players(players, pnum, "c")
      
      for (new i = 0; i < pnum; i++)
      {
         len = format(msg, 255, "%L", players[i], "ADMIN")
         
         if (activity == 1)
            len += copy(msg[len], 255-len, ":")
         else
            len += format(msg[len], 255-len, " %s:", name)
         
         len += format(msg[len], 255-len, " %L", players[i], "BAN")
         len += format(msg[len], 255-len, " %s ", name2)
      
         if (nNum)
            format(msg[len], 255-len, "%L", players[i], "FOR_MIN", minutes)
         else
            format(msg[len], 255-len, "%L", players[i], "PERM")
         
         client_print(players[i], print_chat, "%s", msg)
      }
   }
   console_print(id, "[AMXX] %L", id, "CLIENT_BANNED", name2)
   
   return PLUGIN_HANDLED
}

public cmdSlay(id, level, cid)
{
   if (!cmd_access(id, level, cid, 2))
      return PLUGIN_HANDLED
   
   new arg[32]
   
   read_argv(1, arg, 31)
   
   new player = cmd_target(id, arg, 5)
   
   if (!player)
      return PLUGIN_HANDLED
   
   user_kill(player)
   
   new authid[32], name2[32], authid2[32], name[32]
   
   get_user_authid(id, authid, 31)
   get_user_name(id, name, 31)
   get_user_authid(player, authid2, 31)
   get_user_name(player, name2, 31)
   
   log_amx("Cmd: ^"%s<%d><%s><>^" slay ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, name2, get_user_userid(player), authid2)

   switch (get_cvar_num("amx_show_activity"))
   {
      case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_SLAY_2", name, name2)
      case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_SLAY_1", name2)
   }
   console_print(id, "[AMXX] %L", id, "CLIENT_SLAYED", name2)
   
   return PLUGIN_HANDLED
}

public cmdSlap(id, level, cid)
{
   if (!cmd_access(id, level, cid, 2))
      return PLUGIN_HANDLED

   new arg[32]
   
   read_argv(1, arg, 31)
   new player = cmd_target(id, arg, 5)
   
   if (!player)
      return PLUGIN_HANDLED

   new spower[32], authid[32], name2[32], authid2[32], name[32]
   
   read_argv(2, spower, 31)
   
   new damage = str_to_num(spower)
   
   user_slap(player, damage)
   
   get_user_authid(id, authid, 31)
   get_user_name(id, name, 31)
   get_user_authid(player, authid2, 31)
   get_user_name(player, name2, 31)
   
   log_amx("Cmd: ^"%s<%d><%s><>^" slap with %d damage ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, damage, name2, get_user_userid(player), authid2)

   switch (get_cvar_num("amx_show_activity"))
   {
      case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_SLAP_2", name, name2, damage)
      case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_SLAP_1", name2, damage)
   }
   console_print(id, "[AMXX] %L", id, "CLIENT_SLAPED", name2, damage)
   
   return PLUGIN_HANDLED
}

public chMap(map[])
{
   server_cmd("changelevel %s", map)
}

public cmdMap(id, level, cid)
{
   if (!cmd_access(id, level, cid, 2))
      return PLUGIN_HANDLED

   new arg[32]
   new arglen = read_argv(1, arg, 31)
   
   if (!is_map_valid(arg))
   {
      console_print(id, "[AMXX] %L", id, "MAP_NOT_FOUND")
      return PLUGIN_HANDLED
   }

   new authid[32], name[32]
   
   get_user_authid(id, authid, 31)
   get_user_name(id, name, 31)
   
   switch (get_cvar_num("amx_show_activity"))
   {
      case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_MAP_2", name, arg)
      case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_MAP_1", arg)
   }
   
   log_amx("Cmd: ^"%s<%d><%s><>^" changelevel ^"%s^"", name, get_user_userid(id), authid, arg)
   
   new _modName[10]
   get_modname(_modName, 9)
   
   if (!equal(_modName, "zp"))
   {
      message_begin(MSG_ALL, SVC_INTERMISSION)
      message_end()
   }
   
   set_task(2.0, "chMap", 0, arg, arglen + 1)
   
   return PLUGIN_HANDLED
}

onlyRcon(name[])
{
   for (new a = 0; a < g_cvarRconNum; ++a)
      if (equali(g_cvarRcon[a], name))
         return 1
   return 0
}

public cmdCvar(id, level, cid)
{
   if (!cmd_access(id, level, cid, 2))
      return PLUGIN_HANDLED
   
   new arg[32], arg2[64]
   
   read_argv(1, arg, 31)
   read_argv(2, arg2, 63)
   
   if (equal(arg, "add") && (get_user_flags(id) & ADMIN_RCON))
   {
      if (cvar_exists(arg2))
      {
         if (g_cvarRconNum < MAXRCONCVARS)
            copy(g_cvarRcon[g_cvarRconNum++], 31, arg2)
         else
            console_print(id, "[AMXX] %L", id, "NO_MORE_CVARS")
      }
      return PLUGIN_HANDLED
   }
   
   if (!cvar_exists(arg))
   {
      console_print(id, "[AMXX] %L", id, "UNKNOWN_CVAR", arg)
      return PLUGIN_HANDLED
   }
   
   if (onlyRcon(arg) && !(get_user_flags(id) & ADMIN_RCON))
   {
      console_print(id, "[AMXX] %L", id, "CVAR_NO_ACC")
      return PLUGIN_HANDLED
   }
   else if (equal(arg, "sv_password") && !(get_user_flags(id) & ADMIN_PASSWORD))
   {
      console_print(id, "[AMXX] %L", id, "CVAR_NO_ACC")
      return PLUGIN_HANDLED
   }
   
   if (read_argc() < 3)
   {
      get_cvar_string(arg, arg2, 63)
      console_print(id, "[AMXX] %L", id, "CVAR_IS", arg, arg2)
      return PLUGIN_HANDLED
   }

   new authid[32], name[32]
   
   get_user_authid(id, authid, 31)
   get_user_name(id, name, 31)
   
   log_amx("Cmd: ^"%s<%d><%s><>^" set cvar (name ^"%s^") (value ^"%s^")", name, get_user_userid(id), authid, arg, arg2)
   set_cvar_string(arg, arg2)

   new activity = get_cvar_num("amx_show_activity")
   if (activity != 0)
   {
      new players[32], pnum, admin[64], cvar_val[64], len
      get_players(players, pnum, "c")
      
      for (new i = 0; i < pnum; i++)
      {
         len = format(admin, 255, "%L", players[i], "ADMIN")
         
         if (activity == 1)
            len += copy(admin[len], 255-len, ":")
         else
            len += format(admin[len], 255-len, " %s:", name)

         if (equal(arg, "rcon_password") || equal(arg, "sv_password"))
            format(cvar_val, 63, "*** %L ***", players[i], "PROTECTED")
         else
            copy(cvar_val, 63, arg2)
         
         client_print(players[i], print_chat, "%L", players[i], "SET_CVAR_TO", admin, arg, arg2)
      }
   }
   console_print(id, "[AMXX] %L", id, "CVAR_CHANGED", arg, arg2)
   
   return PLUGIN_HANDLED
}

public cmdPlugins(id, level, cid)
{
   if (!cmd_access(id, level, cid, 1))
      return PLUGIN_HANDLED

   new name[32], version[32], author[32], filename[32], status[32]
   new lName[32], lVersion[32], lAuthor[32], lFile[32], lStatus[32]

   format(lName, 31, "%L", id, "NAME")
   format(lVersion, 31, "%L", id, "VERSION")
   format(lAuthor, 31, "%L", id, "AUTHOR")
   format(lFile, 31, "%L", id, "FILE")
   format(lStatus, 31, "%L", id, "STATUS")

   new num = get_pluginsnum()
   new running = 0
   
   console_print(id, "%L:", id, "LOADED_PLUGINS")
   console_print(id, "%-18.17s %-8.7s %-17.16s %-16.15s %-9.8s", lName, lVersion, lAuthor, lFile, lStatus)

   for (new i = 0; i <num; i++)
   {
      get_plugin(i, filename, 31, name, 31, version, 31, author, 31, status, 31)
      console_print(id, "%-18.17s %-8.7s %-17.16s %-16.15s %-9.8s", name, version, author, filename, status)
      
      if (status[0]=='d' || status[0]=='r') // "debug" or "running"
         running++
   }
   console_print(id, "%L", id, "PLUGINS_RUN", num, running)

   return PLUGIN_HANDLED
}

public cmdModules(id, level, cid)
{
   if (!cmd_access(id, level, cid, 1))
      return PLUGIN_HANDLED

   new name[32], version[32], author[32], status, sStatus[16]
   new lName[32], lVersion[32], lAuthor[32]

   format(lName, 31, "%L", id, "NAME")
   format(lVersion, 31, "%L", id, "VERSION")
   format(lAuthor, 31, "%L", id, "AUTHOR")

   new num = get_modulesnum()
   
   console_print(id, "%L:", id, "LOADED_MODULES")
   console_print(id, "%-23.22s %-8.7s %-20.19s", lName, lVersion, lAuthor)
   
   for (new i = 0; i < num; i++)
   {
      get_module(i, name, 31, author, 31, version, 31, status)
      
      switch (status)
      {
         case module_loaded: copy(sStatus, 15, "running")
         default: copy(sStatus, 15, "error")
      }
      
      console_print(id, "%-23.22s %-8.7s %-20.19s", name, version, author)
   }
   console_print(id, "%L", id, "NUM_MODULES", num)

   return PLUGIN_HANDLED
}

public cmdCfg(id, level, cid)
{
   if (!cmd_access(id, level, cid, 2))
      return PLUGIN_HANDLED
   
   new arg[128]
   read_argv(1, arg, 127)
   
   if (!file_exists(arg))
   {
      console_print(id, "[AMXX] %L", id, "FILE_NOT_FOUND", arg)
      return PLUGIN_HANDLED
   }
   
   new authid[32], name[32]
   
   get_user_authid(id, authid, 31)
   get_user_name(id, name, 31)
   
   log_amx("Cmd: ^"%s<%d><%s><>^" execute cfg (file ^"%s^")", name, get_user_userid(id), authid, arg)
   
   console_print(id, "[AMXX] Executing file ^"%s^"", arg)
   server_cmd("exec %s", arg)

   switch(get_cvar_num("amx_show_activity"))
   {
      case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_CONF_2", name, arg)
      case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_CONF_1", arg)
   }

   return PLUGIN_HANDLED
}

public cmdLBack()
{
   if (!g_PauseAllowed)
      return PLUGIN_CONTINUE   

   new paused[25]
   
   format(paused, 24, "%L", g_pauseCon, g_Paused ? "UNPAUSED" : "PAUSED")
   set_cvar_float("pausable", g_pausAble)
   console_print(g_pauseCon, "[AMXX] Server %s", paused)
   g_PauseAllowed = false
   
   if (g_Paused)
      g_Paused = false
   else
      g_Paused = true
   
   return PLUGIN_HANDLED
}

public cmdPause(id, level, cid)
{
   if (!cmd_access(id, level, cid, 1))
      return PLUGIN_HANDLED
   
   new authid[32], name[32], slayer = id
   
   get_user_authid(id, authid, 31)
   get_user_name(id, name, 31)
   g_pausAble = get_cvar_float("pausable")
   
   if (!slayer)
      slayer = find_player("h")
   
   if (!slayer)
   {
      console_print(id, "[AMXX] %L", id, "UNABLE_PAUSE")
      return PLUGIN_HANDLED
   }

   set_cvar_float("pausable", 1.0)
   g_PauseAllowed = true
   client_cmd(slayer, "pause;pauseAck")
   
   log_amx("Cmd: ^"%s<%d><%s><>^" %s server", name, get_user_userid(id), authid, g_Paused ? "unpause" : "pause")
   
   console_print(id, "[AMXX] %L", id, g_Paused ? "UNPAUSING" : "PAUSING")

   new activity = get_cvar_num("amx_show_activity")
   if (activity != 0)
   {
      new players[32], pnum, msg[128], len
      get_players(players, pnum, "c")
      
      for (new i = 0; i < pnum; i++)
      {
         len = format(msg, 127, "%L", players[i], "ADMIN")
         
         if (activity == 1)
            len += copy(msg[len], 127-len, ": ")
         else
            len += format(msg[len], 127-len, " %s: ", name)
         
         format(msg[len], 127-len, "%L", players[i], g_Paused ? "UNPAUSE" : "PAUSE")
         client_print(players[i], print_chat, "%s server", msg)
      }
   }
   g_pauseCon = id
   
   return PLUGIN_HANDLED
}

public cmdShowRcon(id, level, cid)
{
   if (!cmd_access(id, level, cid, 2))
      return PLUGIN_HANDLED
      
   new password[64]
   
   get_cvar_string("rcon_password", password, 63)
   
   if (!password[0])
   {
      cmdRcon(id, level, cid)
   } else {
      new args[128]
      
      read_args(args, 127)
      client_cmd(id, "rcon_password %s", password)
      client_cmd(id, "rcon %s", args)
   }
   
   return PLUGIN_HANDLED
}

public cmdRcon(id, level, cid)
{
   if (!cmd_access(id, level, cid, 2))
      return PLUGIN_HANDLED
   
   new arg[128], authid[32], name[32]
   
   read_args(arg, 127)
   get_user_authid(id, authid, 31)
   get_user_name(id, name, 31)
   
   log_amx("Cmd: ^"%s<%d><%s><>^" server console (cmdline ^"%s^")", name, get_user_userid(id), authid, arg)
   
   console_print(id, "[AMXX] %L", id, "COM_SENT_SERVER", arg)
   server_cmd("%s", arg)
   
   return PLUGIN_HANDLED
}

public cmdWho(id, level, cid)
{
   if (!cmd_access(id, level, cid, 1))
      return PLUGIN_HANDLED

   new players[32], inum, cl_on_server[64], authid[32], name[32], flags, sflags[32]
   new lImm[16], lRes[16], lAccess[16], lYes[16], lNo[16]
   
   format(lImm, 15, "%L", id, "IMMU")
   format(lRes, 15, "%L", id, "RESERV")
   format(lAccess, 15, "%L", id, "ACCESS")
   format(lYes, 15, "%L", id, "YES")
   format(lNo, 15, "%L", id, "NO")
   
   get_players(players, inum)
   format(cl_on_server, 63, "%L", id, "CLIENTS_ON_SERVER")
   console_print(id, "^n%s:^n # %-16.15s %-20s %-8s %-4.3s %-4.3s %s", cl_on_server, "nick", "ip", "userid", lImm, lRes, lAccess)
   
   for (new a = 0; a < inum; ++a)
   {
      get_user_ip(players[a], authid, 31, 1)
      get_user_name(players[a], name, 31)
      flags = get_user_flags(players[a])
      get_flags(flags, sflags, 31)
      console_print(id, "%2d  %-16.15s %-20s %-8d %-6.5s %-6.5s %s", players[a], name, authid,
      get_user_userid(players[a]), (flags&ADMIN_IMMUNITY) ? lYes : lNo, (flags&ADMIN_RESERVATION) ? lYes : lNo, sflags)
   }
   
   console_print(id, "%L", id, "TOTAL_NUM", inum)
   get_user_authid(id, authid, 31)
   get_user_name(id, name, 31)
   log_amx("Cmd: ^"%s<%d><%s><>^" ask for players list", name, get_user_userid(id), authid)
   
   return PLUGIN_HANDLED
}

hasTag(name[], tags[4][32], tagsNum)
{
   for (new a = 0; a < tagsNum; ++a)
      if (contain(name, tags[a]) != -1)
         return a
   return -1
}

public cmdLeave(id, level, cid)
{
   if (!cmd_access(id, level, cid, 2))
      return PLUGIN_HANDLED
   
   new argnum = read_argc()
   new ltags[4][32]
   new ltagsnum = 0
   
   for (new a = 1; a < 5; ++a)
   {
      if (a < argnum)
         read_argv(a, ltags[ltagsnum++], 31)
      else
         ltags[ltagsnum++][0] = 0
   }
   
   new nick[32], ires, pnum = get_maxplayers() + 1, count = 0, lReason[128]
   
   for (new b = 1; b < pnum; ++b)
   {
      if (!is_user_connected(b) && !is_user_connecting(b)) continue

      get_user_name(b, nick, 31)
      ires = hasTag(nick, ltags, ltagsnum)
      
      if (ires != -1)
      {
         console_print(id, "[AMXX] %L", id, "SKIP_MATCH", nick, ltags[ires])
         continue
      }
      
      if (get_user_flags(b) & ADMIN_IMMUNITY)
      {
         console_print(id, "[AMXX] %L", id, "SKIP_IMM", nick)
         continue
      }
      
      console_print(id, "[AMXX] %L", id, "KICK_PL", nick)
      
      if (is_user_bot(b))
         server_cmd("kick #%d", get_user_userid(b))
      else
      {
         format(lReason, 127, "%L", b, "YOU_DROPPED")
         server_cmd("kick #%d ^"%s^"", get_user_userid(b), lReason)
      }
      count++
   }
   
   console_print(id, "[AMXX] %L", id, "KICKED_CLIENTS", count)
   
   new authid[32], name[32]

   get_user_authid(id, authid, 31)
   get_user_name(id, name, 31)
   log_amx("Kick: ^"%s<%d><%s><>^" leave some group (tag1 ^"%s^") (tag2 ^"%s^") (tag3 ^"%s^") (tag4 ^"%s^")", name, get_user_userid(id), authid, ltags[0], ltags[1], ltags[2], ltags[3])

   switch(get_cvar_num("amx_show_activity"))
   {
      case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_LEAVE_2", name, ltags[0], ltags[1], ltags[2], ltags[3])
      case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_LEAVE_1", ltags[0], ltags[1], ltags[2], ltags[3])
   }

   return PLUGIN_HANDLED
}

public cmdNick(id, level, cid)
{
   if (!cmd_access(id, level, cid, 3))
      return PLUGIN_HANDLED

   new arg1[32], arg2[32], authid[32], name[32], authid2[32], name2[32]

   read_argv(1, arg1, 31)
   read_argv(2, arg2, 31)

   new player = cmd_target(id, arg1, 1)
   
   if (!player)
      return PLUGIN_HANDLED

   get_user_authid(id, authid, 31)
   get_user_name(id, name, 31)
   get_user_authid(player, authid2, 31)
   get_user_name(player, name2, 31)

   client_cmd(player, "name ^"%s^"", arg2)

   log_amx("Cmd: ^"%s<%d><%s><>^" change nick to ^"%s^" ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, arg2, name2, get_user_userid(player), authid2)

   switch (get_cvar_num("amx_show_activity"))
   {
      case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_NICK_2", name, name2, arg2)
      case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_NICK_1", name2, arg2)
   }
   console_print(id, "[AMXX] %L", id, "CHANGED_NICK", name2, arg2)

   return PLUGIN_HANDLED
}
Get in Position and wait for my go
Аватара пользователя
Lip
 
Сообщения: 20
Зарегистрирован: 15 фев 2011, 21:35
Благодарил (а): 7 раз.
Поблагодарили: 2 раз.
Языки программирования: Counter-Strike 1.6

Re: Ломают серв, заходят админами, банят админов.

Сообщение mazdan » 08 ноя 2011, 12:54

нихрена себе примочка к плагину баншот оО
Учитывая что там даже нет строчки про show_motd - может есть смысл разобраться что за плагины на вашем сервере?
Уверены, что он не получает флаги на вашем сервере (которые выдает другой плагин) - в этом я ничего такого не заметил.
Хотя пусть более опытные смотрят =)
я не пишу плагины на заказ!
Аватара пользователя
mazdan
 
Сообщения: 739
Зарегистрирован: 12 окт 2010, 14:44
Благодарил (а): 121 раз.
Поблагодарили: 211 раз.
Опыт программирования: Около года
Языки программирования: Counter-Strike 1.6

Re: Ломают серв, заходят админами, банят админов.

Сообщение Lip » 09 ноя 2011, 22:53

4 дня нет проблемы, может реально парашют, я его отключил.
Get in Position and wait for my go
Аватара пользователя
Lip
 
Сообщения: 20
Зарегистрирован: 15 фев 2011, 21:35
Благодарил (а): 7 раз.
Поблагодарили: 2 раз.
Языки программирования: Counter-Strike 1.6

Re: Ломают серв, заходят админами, банят админов.

Сообщение DJ_WEST » 14 ноя 2011, 11:07

[pawn]
  1. Я не програмист, но чую тут есть подвох

  2. (#define PARACHUTE_LEVEL ADMIN_LEVEL_A)
[/pawn]
Это флаг, с которым можно выдавать парашют.
4 дня нет проблемы, может реально парашют, я его отключил.

Может они просто отдыхают ;)

Если есть все исходники, то сделай поиск по содержимому на:
set_user_flags
amx_addadmin
Не пишите мне в ЛС: если вам нужна помощь на бесплатной основе. Любые вопросы на форум.
Аватара пользователя
DJ_WEST
Администратор
 
Сообщения: 3641
Зарегистрирован: 22 авг 2009, 00:38
Благодарил (а): 48 раз.
Поблагодарили: 2209 раз.
Опыт программирования: Больше трех лет
Языки программирования: Counter-Strike 1.6
Counter-Strike: Source
Left 4 Dead
Left 4 Dead 2

Re: Ломают серв, заходят админами, банят админов.

Сообщение oxoTHuk » 14 ноя 2011, 15:39

amx_default_access
посмотрите значение. может в этом проблема
Аватара пользователя
oxoTHuk
 
Сообщения: 29
Зарегистрирован: 19 мар 2010, 13:08
Откуда: msk
Благодарил (а): 7 раз.
Поблагодарили: 6 раз.
Опыт программирования: Больше трех лет
Языки программирования: Counter-Strike 1.6
Не занимаюсь програмингом, только собираю.

Re: Ломают серв, заходят админами, банят админов.

Сообщение 6ykBaeg » 15 ноя 2011, 20:29

я все прочитал) и чего то не до понял, а как же он выдает ркон пароль античит? и как же можно узнать? я чот не догоняю) объясните пожалуйста) "cmdaccess.ini" связано с этим???
у меня такая догатка)
а что если юзер юзает команду к 1 плагину? проверь "cmdaccess.ini"



Цитата школьника из "Skype"
"а как мне айпи проверить своего айпи"
"Ты че сдох чтоли? ..н-ну, на, полечись. Дибил." (с) к/м фильм Ботан Джо
Аватара пользователя
6ykBaeg
 
Сообщения: 372
Зарегистрирован: 03 дек 2010, 14:56
Благодарил (а): 151 раз.
Поблагодарили: 41 раз.
Языки программирования: WarCraft III Frozen Throne

Пред.След.

Вернуться в Безопасность и защита серверов

Кто сейчас на конференции

Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 6