Quote:
Originally Posted by ESTCOBS
(...) with login (...)
I wanna to be any change nick / connecting = check nick {
if in_list [
if your = return
else = ban with XX minutes
]
else continue .....
}
+ set_task(180.0,checknick)
// Very lame code 
// :]
Regards and thanks
|
well i made something but its not quite done
its as far as i could go with it :X
and its probably crap O_O
PHP Code:
#include <amxmodx>
#include <amxmisc>
#define MAX_NAMES 2000
new BanTime
new g_Count;
new g_NickNames[MAX_NAMES][35]
new bool:g_InFile[33]
public plugin_precache()
{
new filename[200];
get_configsdir(filename, sizeof(filename) - 1);
add(filename, sizeof(filename) - 1, "/nicks.ini");
if(file_exists(filename))
{
new file = fopen(filename, "rt");
if(file)
{
new data[128];
new rest[sizeof(data) - sizeof(g_NickNames[])];
while(!feof(file) && (g_Count < MAX_NAMES))
{
fgets(file, data, sizeof(data) - 1);
if(data[0] != ';')
{
parse(data, g_NickNames[g_Count++], sizeof(g_NickNames[]) - 1, rest, sizeof(rest) - 1);
}
}
fclose(file);
}
}
}
public plugin_init()
{
register_plugin("SteamID From File Test", "0.1", "dekken")
BanTime = register_cvar("amx_nickban_time", "1")
}
public client_authorized(id)
{
if(g_Count <= 0)
return;
g_InFile[id] = false;
new nickname[sizeof(g_NickNames[])]
get_user_name(id, nickname, sizeof(nickname))
for(new i = 0; i < g_Count; i++)
{
if(equali(nickname, g_NickNames[i]))
{
g_InFile[id] = true;
break;
}
else
{
g_InFile[id] = false
}
}
set_task(3.0, "task_kick", id)
}
public client_disconnect(id)
{
g_InFile[id] = false
}
public task_kick(id)
{
if(!g_InFile[id])
{
new UserID
UserID = get_user_userid(id)
server_cmd("kick #%d", UserID)
}
return PLUGIN_HANDLED
}
public client_infochanged(id)
{
new name[32], oldname[32]
get_user_info(id, "name", name, 31)
get_user_name(id, oldname, 31)
if(equal(name, oldname))
return PLUGIN_HANDLED
else
{
new UserID, authid[33], name2[33]
UserID = get_user_userid(id)
get_user_authid(id, authid, 32)
get_user_name(id, name2, 32)
server_cmd("banid %i #%i;writeid;kick #%i",get_pcvar_num(BanTime),UserID, UserID)
}
return PLUGIN_HANDLED
}
create nicks.ini in amx Configs folder..
and add the Desired nicks...(i dont know how to create a command that will add this automatically)
on change-nick it checks if the Nick is in the list...if not it will ban him for the Time you set..(amx_nickban_time)
actually this is garbage, but good training for me
__________________