Jump to content
TheGames.PL More than games

amx ban nick


Ynex
 Share

Recommended Posts

/*
--------------------------------------------------------------
----------------------  Made by Deviance ---------------------
--------------------- www.the-place.co.nr --------------------
--------------------------------------------------------------
*/

#include <amxmodx>
#include <amxmisc>

#define Plugin "Name Ban"
#define Version "1.0"
#define Author "Doombringer"

new cvar, check_time, ban_time, log
new names[200][64], num

public plugin_init()
{
   register_plugin(Plugin, Version, Author)

   cvar = register_cvar("NB_enabled", "1")
   check_time = register_cvar("NB_checktime", "100")
   ban_time = register_cvar("NB_bantime", "120")
   log = register_cvar("NB_log", "1")

   new configsdir[64], path[166]
   get_configsdir(configsdir, 63)

   format(path, 165, "%s/name_ban.ini", configsdir)
   read_nameban_file(path)
}

public read_nameban_file(path[])
{
   new file = fopen(path, "rt")

   if(!file)
   {
       server_print("Could not find: %s", path)
       return PLUGIN_HANDLED
   }

   new Rtext[64]

   while(!feof(file))
   {
       fgets(file, Rtext, 63)

       if(equal(Rtext,""))
       continue;

       names[num] = Rtext        
       num++
   }

   server_print("Successfully loaded %d names", num)
   set_check_names()

   return PLUGIN_CONTINUE
}

stock has_notallowed_name(name[])
{
   for(new i = 0; i < num; i++)
   {
       if(contain(name, names[i]) != -1)
       return 1
   }

   return 0
}

public set_check_names()
{
   if(get_pcvar_num(check_time) < 1 || get_pcvar_num(cvar) < 1)
   {
       set_task(50.0, "set_check_names")
       return PLUGIN_CONTINUE
   }

   set_task(float(get_pcvar_num(check_time)), "check_names")
   return PLUGIN_CONTINUE
}

public check_names()
{
   new players[32], number, player
   get_players(players, number)

   new name[32]
   for(new i = 0; i < number; i++)
   {
       player = players[i]
       get_user_name(player, name, 31)

       if(has_notallowed_name(name))
       {
           new steamid[32]
           get_user_authid(player, steamid, 31)

           server_cmd("amx_ban ^"%s^" %d ^"Not allowed name^"", name, get_pcvar_num(ban_time))

           if(get_pcvar_num(log) == 1)
               log_to_file("ban_names_log.log", "%s {%s} got banned for using a not allowed name", name, steamid)

           break;
       }
   }

   set_check_names()
} 

Zamieszczam tutaj kod który odpowiada za plugin do banowania na nick (mam nadzieję, że działa).

Link to comment
Share on other sites

W źródle nie znalazłem komendy, przeszukałem cały net (albo 90%) i też nikt o komendach nie pisał, ale jak się głębiej przyjrzałem pluginowi to podejrzewam, że on nadpisuje normalne banowanie do banowania nicku czyli banujesz Agate podszywke i normalna też nie wejdzie ;>. Więc nie wyszło to tak jak sądziłem, liczyłem, że to będzie oddzielny plugin do banowania osobna komenda itp. Jest jeszcze plugin do zakazanych nicków (kickuje ale trzeba dopisywać i compilować za każdym razem gdy się nick doda.) zbyt czasochłonne jednak... Może jak znajdę jeszcze trochę czasu to poszukam głębiej coś na ten temat.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...