mirror of
https://github.com/EpicMorgVault/AMXx-Player-Renamer.git
synced 2025-03-26 20:29:09 +03:00
init
This commit is contained in:
parent
fa2613de8f
commit
58759155fd
10
README.md
10
README.md
@ -1,2 +1,12 @@
|
|||||||
AMXx Player Renamer
|
AMXx Player Renamer
|
||||||
===================
|
===================
|
||||||
|
|
||||||
|
имена запрещенных ников пользователей писать в:
|
||||||
|
./amxmodx/configs/renamer_banned.ini
|
||||||
|
|
||||||
|
имена на котороые менять запрещенные ники писать:
|
||||||
|
./amxmodx/configs/renamer_names.ini
|
||||||
|
|
||||||
|
cvrar:
|
||||||
|
|
||||||
|
renamer_permanent 0\1 - включить или отключить переименовние игрока навсегда. странно работает на лицензионных клиентах. по умолчанию - 0.
|
0
amxmodx/configs/renamer_banned.ini
Normal file
0
amxmodx/configs/renamer_banned.ini
Normal file
0
amxmodx/configs/renamer_names.ini
Normal file
0
amxmodx/configs/renamer_names.ini
Normal file
94
amxmodx/scripting/amxxrenamer.sma
Normal file
94
amxmodx/scripting/amxxrenamer.sma
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
Исправить (или отказаться) от перманентного переименования
|
||||||
|
Доделать вывод сообщений в чат, кто зашел и на кого переименовлся
|
||||||
|
Доделать запись в файл (при флаге амина) из чата нового имени по /addnewname %name%
|
||||||
|
Доделать показ имен, при написании /shownames в MOTD окно
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <amxmodx>
|
||||||
|
#include <amxmisc>
|
||||||
|
#define PLUGIN "Player Renamer"
|
||||||
|
#define VERSION "1.7.4"
|
||||||
|
#define AUTHOR "EpicMorg"
|
||||||
|
#define TASK_SHOWINFO_BASE 100
|
||||||
|
#define DELAY_BEFORE_INFO 5.0
|
||||||
|
#define MAX_PLAYERS 32
|
||||||
|
public plugin_init() {
|
||||||
|
register_plugin(PLUGIN, VERSION, AUTHOR)
|
||||||
|
register_cvar("renamer_permanent","0")
|
||||||
|
log_amx("[AMXx Renamer] Loaded!");
|
||||||
|
}
|
||||||
|
public client_authorized(id)
|
||||||
|
{
|
||||||
|
//работаем с именами из словаря
|
||||||
|
new name_file[256];
|
||||||
|
get_configsdir(name_file, 256);
|
||||||
|
add(name_file, 256, "/renamer_names.ini");
|
||||||
|
if (!file_exists(name_file))
|
||||||
|
{
|
||||||
|
log_amx("[AMXx Renamer] amxmodx/configs/renamer_names.ini is missing!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
new lines_in_name_file = file_size(name_file,1); //Получение количества строк из name-файла
|
||||||
|
new random = random_num(0,lines_in_name_file -1); //Получение случайной строки между 0 и последней
|
||||||
|
new txt_length_name; //Резерв
|
||||||
|
new NewName[256]; //Случайное имя
|
||||||
|
read_file(name_file,random,NewName,256,txt_length_name);
|
||||||
|
//работаем с забанеными именами и имнем клиента
|
||||||
|
new ban_file[256];
|
||||||
|
get_configsdir(ban_file, 256);
|
||||||
|
add(ban_file, 256, "/renamer_banned.ini");
|
||||||
|
new BannedName[256]; //Заблокированное имя
|
||||||
|
if (!file_exists(ban_file))
|
||||||
|
{
|
||||||
|
log_amx("[AMXx Renamer] amxmodx/configs/renamer_banned.ini is missing!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
new lines_in_ban_file = file_size(ban_file,1) //Получение количества строк из ban-файла
|
||||||
|
new i = 0;
|
||||||
|
for(i = 0; i <= lines_in_ban_file; i++)
|
||||||
|
{
|
||||||
|
new current_player_name[256];
|
||||||
|
get_user_name(id, current_player_name, 256);
|
||||||
|
//trim(current_player_name);
|
||||||
|
read_file(ban_file,i,BannedName,256,txt_length_name);
|
||||||
|
if(equali(current_player_name, BannedName)){
|
||||||
|
//Условие что наш квар больше нуля
|
||||||
|
if (get_cvar_num("renamer_permanent") != 0){
|
||||||
|
client_cmd(id, "name %s", NewName);
|
||||||
|
log_amx("[AMXx Renamer] Player %s renamed permanently to %s!", current_player_name, NewName);
|
||||||
|
client_cmd(id, "reconnect"); //Fix для steam client
|
||||||
|
//client_print(id,print_chat,"[AMXx Renamer] Player %s renamed permanently to %s!", current_player_name, NewName);
|
||||||
|
//client_print(id,print_console,"[AMXx Renamer] Player %s renamed permanently to %s!", current_player_name, NewName);
|
||||||
|
//client_print(id,print_notify,"[AMXx Renamer] Player %s renamed permanently to %s!", current_player_name, NewName);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//Если 0, то менять ник только на время игры на текущей карте
|
||||||
|
set_user_info(id, "name", NewName);
|
||||||
|
log_amx("[AMXx Renamer] Player %s renamed temporary to %s!", current_player_name, NewName);
|
||||||
|
//client_print(id,print_chat,"[AMXx Renamer] Player %s renamed temporary to %s!", current_player_name, NewName);
|
||||||
|
//client_print(id,print_console,"[AMXx Renamer] Player %s renamed temporary to %s!", current_player_name, NewName);
|
||||||
|
//client_print(id,print_notify,"[AMXx Renamer] Player %s renamed temporary to %s!", current_player_name, NewName);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ShowInfo(id)
|
||||||
|
{
|
||||||
|
id -= TASK_SHOWINFO_BASE;
|
||||||
|
if (id < 1 || id > MAX_PLAYERS) return;
|
||||||
|
|
||||||
|
//client_print(id,print_chat,"[AMXx Renamer] Test!");
|
||||||
|
//client_print(id,print_console,"[AMXx Renamer] Test!");
|
||||||
|
//client_print(id,print_notify,"[AMXx Renamer] Test!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public client_putinserver(id)
|
||||||
|
{
|
||||||
|
set_task(DELAY_BEFORE_INFO, "ShowInfo", TASK_SHOWINFO_BASE + id);
|
||||||
|
}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user