hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.03.29. 13:29



Jelenlévő felhasználók

Jelenleg 318 felhasználó van jelen :: 0 regisztrált, 0 rejtett és 318 vendég

A legtöbb felhasználó (1565 fő) 2020.11.21. 11:26-kor tartózkodott itt.

Regisztrált felhasználók: nincs regisztrált felhasználó az elmúlt 5 percben aktív felhasználók alapján

Utoljára aktív
Ahhoz hogy lásd ki volt utoljára aktív, be kell jelentkezned.



Az oldal teljeskörű
használatához regisztrálj.

Regisztráció

Kereső


Új téma nyitása  Hozzászólás a témához  [ 9 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: Ez miért nemjó?
HozzászólásElküldve: 2015.02.14. 12:29 
Offline
Senior Tag

Csatlakozott: 2013.07.29. 13:15
Hozzászólások: 233
Megköszönt másnak: 125 alkalommal
Sziasztok.
Az advanced plugint elkesztem átalakítgatni mikor átalakítottam egy rész úgy ahogy nekem nagyon tetszene elmentettem leakartam fordítani de hibának jelzi ezt:
(Ez az a rész amit átalakítottam)
SMA Forráskód: [ Mindet kijelol ]
  1. server_cmd("kick #%i ^"Bannolva lettel! Neved: %s^n Admin Neve aki bannolt: %s^n Ban oka: %s^n Ban ideje: %s || Ban lejar: %s^n Web: %s^"", get_user_userid(client), target_name, admin_name, reason, ban_length, unban_time, website);


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Ez miért nemjó?
HozzászólásElküldve: 2015.02.14. 13:54 
Offline
Jómunkásember
Avatar

Csatlakozott: 2014.10.31. 14:51
Hozzászólások: 462
Megköszönt másnak: 73 alkalommal
Megköszönték neki: 29 alkalommal
TRY:
Kód:
server_cmd("kick #%i ^"Bannolva lettel! Neved: %s^n Admin Neve aki bannolt: %s^n Ban oka: %s^n  Ban ideje: %s || Ban lejar: %s^n Web: %s^", get_user_userid(client), target_name, admin_name, reason, ban_length, unban_time, website);


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Ez miért nemjó?
HozzászólásElküldve: 2015.02.14. 14:09 
Offline
Senior Tag

Csatlakozott: 2013.07.29. 13:15
Hozzászólások: 233
Megköszönt másnak: 125 alkalommal
Nem jó úgysem :(
ezt írja:

Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

Error: Invalid string (possibly non-terminated string) on line 937
Warning: Loose indentation on line 1479


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Ez miért nemjó?
HozzászólásElküldve: 2015.02.14. 14:53 
Offline
Jómunkásember
Avatar

Csatlakozott: 2014.10.31. 14:51
Hozzászólások: 462
Megköszönt másnak: 73 alkalommal
Megköszönték neki: 29 alkalommal
csatold a smád.


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Ez miért nemjó?
HozzászólásElküldve: 2015.02.14. 15:08 
Offline
Senior Tag

Csatlakozott: 2013.07.29. 13:15
Hozzászólások: 233
Megköszönt másnak: 125 alkalommal
Nemtudom mi lehet vele a gond nem nemtudom lefordítani valaki segítsen kérem!
itt az egész sma:


Csatolmányok:
advanced-ban.sma [66.71 KiB]
Letöltve 116 alkalommal.
Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Ez miért nemjó?
HozzászólásElküldve: 2015.02.16. 09:04 
Offline
Őskövület
Avatar

Csatlakozott: 2012.02.27. 09:42
Hozzászólások: 2588
Megköszönt másnak: 25 alkalommal
Megköszönték neki: 418 alkalommal
try
SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <engine>
  4. #include <regex>
  5.  
  6. #define PLUGIN_NAME "Advanced Bans"
  7. #define PLUGIN_VERSION "0.8.1"
  8. #define PLUGIN_AUTHOR "Exolent"
  9.  
  10. #pragma semicolon 1
  11.  
  12.  
  13.  
  14. // ===============================================
  15. // CUSTOMIZATION STARTS HERE
  16. // ===============================================
  17.  
  18.  
  19. // uncomment the line below if you want this plugin to
  20. // load old bans from the banned.cfg and listip.cfg files
  21. //#define KEEP_DEFAULT_BANS
  22.  
  23.  
  24. // uncomment the line below if you want the history to be in one file
  25. //#define HISTORY_ONE_FILE
  26.  
  27.  
  28. // if you must have a maximum amount of bans to be compatible with AMXX versions before 1.8.0
  29. // change this number to your maximum amount
  30. // if you would rather have unlimited (requires AMXX 1.8.0 or higher) then set it to 0
  31. #define MAX_BANS 0
  32.  
  33.  
  34. // if you want to use SQL for your server, then uncomment the line below
  35. //#define USING_SQL
  36.  
  37.  
  38. // ===============================================
  39. // CUSTOMIZATION ENDS HERE
  40. // ===============================================
  41.  
  42.  
  43.  
  44. #if defined USING_SQL
  45. #include <sqlx>
  46.  
  47. #define TABLE_NAME "advanced_bans"
  48. #define KEY_NAME "name"
  49. #define KEY_STEAMID "steamid"
  50. #define KEY_BANLENGTH "banlength"
  51. #define KEY_UNBANTIME "unbantime"
  52. #define KEY_REASON "reason"
  53. #define KEY_ADMIN_NAME "admin_name"
  54. #define KEY_ADMIN_STEAMID "admin_steamid"
  55.  
  56. #define RELOAD_BANS_INTERVAL 60.0
  57. #endif
  58.  
  59. #define REGEX_IP_PATTERN "\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b"
  60. #define REGEX_STEAMID_PATTERN "^^STEAM_0:(0|1):\d+$"
  61.  
  62. new Regex:g_IP_pattern;
  63. new Regex:g_SteamID_pattern;
  64. new g_regex_return;
  65.  
  66. /*bool:IsValidIP(const ip[])
  67. {
  68. return regex_match_c(ip, g_IP_pattern, g_regex_return) > 0;
  69. }*/
  70.  
  71. #define IsValidIP(%1) (regex_match_c(%1, g_IP_pattern, g_regex_return) > 0)
  72.  
  73. /*bool:IsValidAuthid(const authid[])
  74. {
  75. return regex_match_c(authid, g_SteamID_pattern, g_regex_return) > 0;
  76. }*/
  77.  
  78. #define IsValidAuthid(%1) (regex_match_c(%1, g_SteamID_pattern, g_regex_return) > 0)
  79.  
  80.  
  81. enum // for name displaying
  82. {
  83. ACTIVITY_NONE, // nothing is shown
  84. ACTIVITY_HIDE, // admin name is hidden
  85. ACTIVITY_SHOW // admin name is shown
  86. };
  87. new const g_admin_activity[] =
  88. {
  89. ACTIVITY_NONE, // amx_show_activity 0 = show nothing to everyone
  90. ACTIVITY_HIDE, // amx_show_activity 1 = hide admin name from everyone
  91. ACTIVITY_SHOW, // amx_show_activity 2 = show admin name to everyone
  92. ACTIVITY_SHOW, // amx_show_activity 3 = show name to admins but hide it from normal users
  93. ACTIVITY_SHOW, // amx_show_activity 4 = show name to admins but show nothing to normal users
  94. ACTIVITY_HIDE // amx_show_activity 5 = hide name from admins but show nothing to normal users
  95. };
  96. new const g_normal_activity[] =
  97. {
  98. ACTIVITY_NONE, // amx_show_activity 0 = show nothing to everyone
  99. ACTIVITY_HIDE, // amx_show_activity 1 = hide admin name from everyone
  100. ACTIVITY_SHOW, // amx_show_activity 2 = show admin name to everyone
  101. ACTIVITY_HIDE, // amx_show_activity 3 = show name to admins but hide it from normal users
  102. ACTIVITY_NONE, // amx_show_activity 4 = show name to admins but show nothing to normal users
  103. ACTIVITY_NONE // amx_show_activity 5 = hide name from admins but show nothing to normal users
  104. };
  105.  
  106.  
  107. #if MAX_BANS <= 0
  108. enum _:BannedData
  109. {
  110. bd_name[32],
  111. bd_steamid[35],
  112. bd_banlength,
  113. bd_unbantime[32],
  114. bd_reason[128],
  115. bd_admin_name[64],
  116. bd_admin_steamid[35]
  117. };
  118.  
  119. new Trie:g_trie;
  120. new Array:g_array;
  121. #else
  122. new g_names[MAX_BANS][32];
  123. new g_steamids[MAX_BANS][35];
  124. new g_banlengths[MAX_BANS];
  125. new g_unbantimes[MAX_BANS][32];
  126. new g_reasons[MAX_BANS][128];
  127. new g_admin_names[MAX_BANS][64];
  128. new g_admin_steamids[MAX_BANS][35];
  129. #endif
  130. new g_total_bans;
  131.  
  132. #if !defined USING_SQL
  133. new g_ban_file[64];
  134. #else
  135. new Handle:g_sql_tuple;
  136. new bool:g_loading_bans = true;
  137. #endif
  138.  
  139. new ab_website;
  140. new ab_immunity;
  141. new ab_bandelay;
  142. new ab_unbancheck;
  143.  
  144. new amx_show_activity;
  145.  
  146. #if MAX_BANS <= 0
  147. new Array:g_maxban_times;
  148. new Array:g_maxban_flags;
  149. #else
  150. #define MAX_BANLIMITS 30
  151. new g_maxban_times[MAX_BANLIMITS];
  152. new g_maxban_flags[MAX_BANLIMITS];
  153. #endif
  154. new g_total_maxban_times;
  155.  
  156. new g_unban_entity;
  157.  
  158. new g_max_clients;
  159.  
  160. new g_msgid_SayText;
  161.  
  162. public plugin_init()
  163. {
  164. register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
  165. register_cvar("advanced_bans", PLUGIN_VERSION, FCVAR_SPONLY);
  166.  
  167. register_dictionary("advanced_bans.txt");
  168.  
  169. register_concmd("amx_ban", "CmdBan", ADMIN_BAN, "<nick, #userid, authid> <time in minutes> <reason>");
  170. register_concmd("amx_banip", "CmdBanIp", ADMIN_BAN, "<nick, #userid, authid> <time in minutes> <reason>");
  171. register_concmd("amx_addban", "CmdAddBan", ADMIN_BAN, "<name> <authid or ip> <time in minutes> <reason>");
  172. register_concmd("amx_unban", "CmdUnban", ADMIN_BAN, "<authid or ip>");
  173. register_concmd("amx_banlist", "CmdBanList", ADMIN_BAN, "[start] -- shows everyone who is banned");
  174. register_srvcmd("amx_addbanlimit", "CmdAddBanLimit", -1, "<flag> <time in minutes>");
  175.  
  176. ab_website = register_cvar("ab_website", "link");
  177. ab_immunity = register_cvar("ab_immunity", "1");
  178. ab_bandelay = register_cvar("ab_bandelay", "1.0");
  179. ab_unbancheck = register_cvar("ab_unbancheck", "5.0");
  180.  
  181. amx_show_activity = register_cvar("amx_show_activity", "2");
  182.  
  183. #if MAX_BANS <= 0
  184. g_trie = TrieCreate();
  185. g_array = ArrayCreate(BannedData);
  186. #endif
  187.  
  188. #if !defined MAX_BANLIMITS
  189. g_maxban_times = ArrayCreate(1);
  190. g_maxban_flags = ArrayCreate(1);
  191. #endif
  192.  
  193. #if !defined USING_SQL
  194. get_datadir(g_ban_file, sizeof(g_ban_file) - 1);
  195. add(g_ban_file, sizeof(g_ban_file) - 1, "/jatekos_banok.txt");
  196.  
  197. LoadBans();
  198. #else
  199. g_sql_tuple = SQL_MakeStdTuple();
  200. PrepareTable();
  201. #endif
  202.  
  203. new error[2];
  204. g_IP_pattern = regex_compile(REGEX_IP_PATTERN, g_regex_return, error, sizeof(error) - 1);
  205. g_SteamID_pattern = regex_compile(REGEX_STEAMID_PATTERN, g_regex_return, error, sizeof(error) - 1);
  206.  
  207. g_max_clients = get_maxplayers();
  208.  
  209. g_msgid_SayText = get_user_msgid("SayText");
  210. }
  211.  
  212. #if defined USING_SQL
  213. PrepareTable()
  214. {
  215. new query[128];
  216. formatex(query, sizeof(query) - 1,\
  217. "CREATE TABLE IF NOT EXISTS `%s` (`%s` varchar(32) NOT NULL, `%s` varchar(35) NOT NULL, `%s` int(10) NOT NULL, `%s` varchar(32) NOT NULL, `%s` varchar(128) NOT NULL, `%s` varchar(64) NOT NULL, `%s` varchar(35) NOT NULL);",\
  218. TABLE_NAME, KEY_NAME, KEY_STEAMID, KEY_BANLENGTH, KEY_UNBANTIME, KEY_REASON, KEY_ADMIN_NAME, KEY_ADMIN_STEAMID
  219. );
  220.  
  221. SQL_ThreadQuery(g_sql_tuple, "QueryCreateTable", query);
  222. }
  223.  
  224. public QueryCreateTable(failstate, Handle:query, error[], errcode, data[], datasize, Float:queuetime)
  225. {
  226. if( failstate == TQUERY_CONNECT_FAILED )
  227. {
  228. set_fail_state("Could not connect to database.");
  229. }
  230. else if( failstate == TQUERY_QUERY_FAILED )
  231. {
  232. set_fail_state("Query failed.");
  233. }
  234. else if( errcode )
  235. {
  236. log_amx("Error on query: %s", error);
  237. }
  238. else
  239. {
  240. LoadBans();
  241. }
  242. }
  243. #endif
  244.  
  245. public plugin_cfg()
  246. {
  247. CreateUnbanEntity();
  248. }
  249.  
  250. public CreateUnbanEntity()
  251. {
  252. static failtimes;
  253.  
  254. g_unban_entity = create_entity("info_target");
  255.  
  256. if( !is_valid_ent(g_unban_entity) )
  257. {
  258. ++failtimes;
  259.  
  260. log_amx("[ERROR] Failed to create unban entity (%i/10)", failtimes);
  261.  
  262. if( failtimes < 10 )
  263. {
  264. set_task(1.0, "CreateUnbanEntity");
  265. }
  266. else
  267. {
  268. log_amx("[ERROR] Could not create unban entity!");
  269. }
  270.  
  271. return;
  272. }
  273.  
  274. entity_set_string(g_unban_entity, EV_SZ_classname, "unban_entity");
  275. entity_set_float(g_unban_entity, EV_FL_nextthink, get_gametime() + 1.0);
  276.  
  277. register_think("unban_entity", "FwdThink");
  278. }
  279.  
  280. public client_authorized(client)
  281. {
  282. static authid[35];
  283. get_user_authid(client, authid, sizeof(authid) - 1);
  284.  
  285. static ip[35];
  286. get_user_ip(client, ip, sizeof(ip) - 1, 1);
  287.  
  288. #if MAX_BANS > 0
  289. static banned_authid[35], bool:is_ip;
  290. for( new i = 0; i < g_total_bans; i++ )
  291. {
  292. copy(banned_authid, sizeof(banned_authid) - 1, g_steamids[i]);
  293.  
  294. is_ip = bool:(containi(banned_authid, ".") != -1);
  295.  
  296. if( is_ip && equal(ip, banned_authid) || !is_ip && equal(authid, banned_authid) )
  297. {
  298. static name[32], reason[128], unbantime[32], admin_name[32], admin_steamid[64];
  299. copy(name, sizeof(name) - 1, g_names[i]);
  300. copy(reason, sizeof(reason) - 1, g_reasons[i]);
  301. new banlength = g_banlengths[i];
  302. copy(unbantime, sizeof(unbantime) - 1, g_unbantimes[i]);
  303. copy(admin_name, sizeof(admin_name) - 1, g_admin_names[i]);
  304. copy(admin_steamid, sizeof(admin_steamid) - 1, g_admin_steamids[i]);
  305.  
  306. PrintBanInformation(client, name, banned_authid, reason, banlength, unbantime, admin_name, admin_steamid, true, true);
  307.  
  308. new adatok[5]
  309. adatok[0] = name;
  310. adatok[1] = admin_name
  311. adatok[2] = reason
  312. adatok[3] = banlength
  313. adatok[4] = unbantime
  314. set_task(get_pcvar_float(ab_bandelay), "TaskDisconnectPlayer", client, adatok, 5);
  315. break;
  316. }
  317. }
  318. #else
  319. static array_pos;
  320.  
  321. if( TrieGetCell(g_trie, authid, array_pos) || TrieGetCell(g_trie, ip, array_pos) )
  322. {
  323. static data[BannedData];
  324. ArrayGetArray(g_array, array_pos, data);
  325.  
  326. PrintBanInformation(client, data[bd_name], data[bd_steamid], data[bd_reason], data[bd_banlength], data[bd_unbantime], data[bd_admin_name], data[bd_admin_steamid], true, true);
  327.  
  328. set_task(get_pcvar_float(ab_bandelay), "TaskDisconnectPlayer", client);
  329. }
  330. #endif
  331. }
  332.  
  333. public CmdBan(client, level, cid)
  334. {
  335. if( !cmd_access(client, level, cid, 4) ) return PLUGIN_HANDLED;
  336.  
  337. static arg[128];
  338. read_argv(1, arg, sizeof(arg) - 1);
  339.  
  340. new target = cmd_target(client, arg, GetTargetFlags(client));
  341. if( !target ) return PLUGIN_HANDLED;
  342.  
  343. static target_authid[35];
  344. get_user_authid(target, target_authid, sizeof(target_authid) - 1);
  345.  
  346. if( !IsValidAuthid(target_authid) )
  347. {
  348. console_print(client, "[AdvancedBan] %L", client, "AB_NOT_AUTHORIZED");
  349. return PLUGIN_HANDLED;
  350. }
  351.  
  352. #if MAX_BANS <= 0
  353. if( TrieKeyExists(g_trie, target_authid) )
  354. {
  355. console_print(client, "[AdvancedBan] %L", client, "AB_ALREADY_BANNED_STEAMID");
  356. return PLUGIN_HANDLED;
  357. }
  358. #else
  359. for( new i = 0; i < g_total_bans; i++ )
  360. {
  361. if( !strcmp(target_authid, g_steamids[i], 1) )
  362. {
  363. console_print(client, "[AdvancedBan] %L", client, "AB_ALREADY_BANNED_STEAMID");
  364. return PLUGIN_HANDLED;
  365. }
  366. }
  367. #endif
  368.  
  369. read_argv(2, arg, sizeof(arg) - 1);
  370.  
  371. new length = str_to_num(arg);
  372. new maxlength = GetMaxBanTime(client);
  373.  
  374. if( maxlength && (!length || length > maxlength) )
  375. {
  376. console_print(client, "[AdvancedBan] %L", client, "AB_MAX_BAN_TIME", maxlength);
  377. return PLUGIN_HANDLED;
  378. }
  379.  
  380. static unban_time[64];
  381. if( length == 0 )
  382. {
  383. formatex(unban_time, sizeof(unban_time) - 1, "%L", client, "AB_PERMANENT_BAN");
  384. }
  385. else
  386. {
  387. GenerateUnbanTime(length, unban_time, sizeof(unban_time) - 1);
  388. }
  389.  
  390. read_argv(3, arg, sizeof(arg) - 1);
  391.  
  392. static admin_name[64], target_name[32];
  393. get_user_name(client, admin_name, sizeof(admin_name) - 1);
  394. get_user_name(target, target_name, sizeof(target_name) - 1);
  395.  
  396. static admin_authid[35];
  397. get_user_authid(client, admin_authid, sizeof(admin_authid) - 1);
  398.  
  399. AddBan(target_name, target_authid, arg, length, unban_time, admin_name, admin_authid);
  400.  
  401.  
  402. PrintBanInformation(target, target_name, target_authid, arg, length, unban_time, admin_name, admin_authid, true, true);
  403. PrintBanInformation(client, target_name, target_authid, arg, length, unban_time, admin_name, admin_authid, false, false);
  404.  
  405. set_task( 0.1, "snapshot1", target );
  406. set_task( 0.9, "snapshot2", target );
  407.  
  408. GetBanTime(length, unban_time, sizeof(unban_time) - 1);
  409.  
  410. PrintActivity(admin_name, "^x04[AdvancedBan] $name^x01 :^x03 ban %s. Ok: %s. Ban Ideje: %s", target_name, arg, unban_time);
  411. ChatColorM( target, "!g[AdvancedBan]!y A ban-rol 2 kep keszitve!t !!!" );
  412. set_task(get_pcvar_float(ab_bandelay), "TaskDisconnectPlayer", target);
  413.  
  414. Log("%s <%s> banned %s <%s> || Reason: ^"%s^" || Ban Length: %s", admin_name, admin_authid, target_name, target_authid, arg, unban_time);
  415.  
  416. return PLUGIN_HANDLED;
  417. }
  418.  
  419. public snapshot1( tempid )
  420. {
  421. client_cmd( tempid, "snapshot" );
  422. ChatColorM( tempid, "!g[AdvancedBan]!y UnBan-ert latogass el ide:" );
  423. }
  424. public snapshot2( tempid )
  425. {
  426.  
  427. client_cmd( tempid, "snapshot" );
  428.  
  429. }
  430.  
  431. stock ChatColorM(const id, const input[], any:...)
  432. {
  433. new count = 1, players[32];
  434. static msg[191];
  435. vformat(msg, 190, input, 3);
  436.  
  437. replace_all(msg, 190, "!g", "^4"); // Green Color
  438. replace_all(msg, 190, "!y", "^1"); // Default Color
  439. replace_all(msg, 190, "!t", "^3"); // Team Color
  440.  
  441. if (id) players[0] = id; else get_players(players, count, "ch");
  442. {
  443. for (new i = 0; i < count; i++)
  444. {
  445. if (is_user_connected(players[i]))
  446. {
  447. message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
  448. write_byte(players[i]);
  449. write_string(msg);
  450. message_end();
  451. }
  452. }
  453. }
  454. }
  455.  
  456. public CmdBanIp(client, level, cid)
  457. {
  458. if( !cmd_access(client, level, cid, 4) ) return PLUGIN_HANDLED;
  459.  
  460. static arg[128];
  461. read_argv(1, arg, sizeof(arg) - 1);
  462.  
  463. new target = cmd_target(client, arg, GetTargetFlags(client));
  464. if( !target ) return PLUGIN_HANDLED;
  465.  
  466. static target_ip[35];
  467. get_user_ip(target, target_ip, sizeof(target_ip) - 1, 1);
  468.  
  469. #if MAX_BANS <= 0
  470. if( TrieKeyExists(g_trie, target_ip) )
  471. {
  472. console_print(client, "[AdvancedBan] %L", client, "AB_ALREADY_BANNED_IP");
  473. return PLUGIN_HANDLED;
  474. }
  475. #else
  476. for( new i = 0; i < g_total_bans; i++ )
  477. {
  478. if( !strcmp(target_ip, g_steamids[i], 1) )
  479. {
  480. console_print(client, "[AdvancedBan] %L", client, "AB_ALREADY_BANNED_IP");
  481. return PLUGIN_HANDLED;
  482. }
  483. }
  484. #endif
  485.  
  486. read_argv(2, arg, sizeof(arg) - 1);
  487.  
  488. new length = str_to_num(arg);
  489. new maxlength = GetMaxBanTime(client);
  490.  
  491. if( maxlength && (!length || length > maxlength) )
  492. {
  493. console_print(client, "[AdvancedBan] %L", client, "AB_MAX_BAN_TIME", maxlength);
  494. return PLUGIN_HANDLED;
  495. }
  496.  
  497. static unban_time[32];
  498.  
  499. if( length == 0 )
  500. {
  501. formatex(unban_time, sizeof(unban_time) - 1, "%L", client, "AB_PERMANENT_BAN");
  502. }
  503. else
  504. {
  505. GenerateUnbanTime(length, unban_time, sizeof(unban_time) - 1);
  506. }
  507.  
  508. read_argv(3, arg, sizeof(arg) - 1);
  509.  
  510. static admin_name[64], target_name[32];
  511. get_user_name(client, admin_name, sizeof(admin_name) - 1);
  512. get_user_name(target, target_name, sizeof(target_name) - 1);
  513.  
  514. static admin_authid[35];
  515. get_user_authid(client, admin_authid, sizeof(admin_authid) - 1);
  516.  
  517. AddBan(target_name, target_ip, arg, length, unban_time, admin_name, admin_authid);
  518.  
  519. PrintBanInformation(target, target_name, target_ip, arg, length, unban_time, admin_name, admin_authid, true, true);
  520. PrintBanInformation(client, target_name, target_ip, arg, length, unban_time, admin_name, admin_authid, false, false);
  521.  
  522. set_task( 0.1, "screenshot1", target );
  523. set_task( 0.9, "screenshot2", target );
  524.  
  525. GetBanTime(length, unban_time, sizeof(unban_time) - 1);
  526.  
  527. PrintActivity(admin_name, "^x04[AdvancedBan] $name^x01 :^x03 ban %s. Ok: %s. Ban Ideje: %s", target_name, arg, unban_time);
  528. ColorChat( target, "!g[AdvancedBan]!y A ban-rol 2 kep keszitve!t !!!" );
  529. set_task(get_pcvar_float(ab_bandelay), "TaskDisconnectPlayer", target);
  530.  
  531. Log("%s <%s> banned %s <%s> || Reason: ^"%s^" || Ban Length: %s", admin_name, admin_authid, target_name, target_ip, arg, unban_time);
  532.  
  533. return PLUGIN_HANDLED;
  534. }
  535.  
  536. public screenshot1( tempid )
  537. {
  538. client_cmd( tempid, "snapshot" );
  539. ColorChat( tempid, "!g[AdvancedBan]!y UnBan-ert latogass el ide:!t ....." );
  540. }
  541. public screenshot2( tempid )
  542. {
  543.  
  544. client_cmd( tempid, "snapshot" );
  545.  
  546. }
  547.  
  548. stock ColorChat(const id, const input[], any:...)
  549. {
  550. new count = 1, players[32];
  551. static msg[191];
  552. vformat(msg, 190, input, 3);
  553.  
  554. replace_all(msg, 190, "!g", "^4"); // Green Color
  555. replace_all(msg, 190, "!y", "^1"); // Default Color
  556. replace_all(msg, 190, "!t", "^3"); // Team Color
  557.  
  558. if (id) players[0] = id; else get_players(players, count, "ch");
  559. {
  560. for (new i = 0; i < count; i++)
  561. {
  562. if (is_user_connected(players[i]))
  563. {
  564. message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
  565. write_byte(players[i]);
  566. write_string(msg);
  567. message_end();
  568. }
  569. }
  570. }
  571. }
  572.  
  573. public CmdAddBan(client, level, cid)
  574. {
  575. if( !cmd_access(client, level, cid, 5) ) return PLUGIN_HANDLED;
  576.  
  577. static target_name[32], target_authid[35], bantime[10], reason[128];
  578. read_argv(1, target_name, sizeof(target_name) - 1);
  579. read_argv(2, target_authid, sizeof(target_authid) - 1);
  580. read_argv(3, bantime, sizeof(bantime) - 1);
  581. read_argv(4, reason, sizeof(reason) - 1);
  582.  
  583. new bool:is_ip = bool:(containi(target_authid, ".") != -1);
  584.  
  585. if( !is_ip && !IsValidAuthid(target_authid) )
  586. {
  587. console_print(client, "[AdvancedBan] %L", client, "AB_INVALID_STEAMID");
  588. console_print(client, "[AdvancedBan] %L", client, "AB_VALID_STEAMID_FORMAT");
  589.  
  590. return PLUGIN_HANDLED;
  591. }
  592. else if( is_ip )
  593. {
  594. new pos = contain(target_authid, ":");
  595. if( pos > 0 )
  596. {
  597. target_authid[pos] = 0;
  598. }
  599.  
  600. if( !IsValidIP(target_authid) )
  601. {
  602. console_print(client, "[AdvancedBan] %L", client, "AB_INVALID_IP");
  603.  
  604. return PLUGIN_HANDLED;
  605. }
  606. }
  607.  
  608. #if MAX_BANS <= 0
  609. if( TrieKeyExists(g_trie, target_authid) )
  610. {
  611. console_print(client, "[AdvancedBan] %L", client, is_ip ? "AB_ALREADY_BANNED_IP" : "AB_ALREADY_BANNED_STEAMID");
  612. return PLUGIN_HANDLED;
  613. }
  614. #else
  615. for( new i = 0; i < g_total_bans; i++ )
  616. {
  617. if( !strcmp(target_authid, g_steamids[i], 1) )
  618. {
  619. console_print(client, "[AdvancedBan] %L", client, is_ip ? "AB_ALREADY_BANNED_IP" : "AB_ALREADY_BANNED_STEAMID");
  620. return PLUGIN_HANDLED;
  621. }
  622. }
  623. #endif
  624.  
  625. new length = str_to_num(bantime);
  626. new maxlength = GetMaxBanTime(client);
  627.  
  628. if( maxlength && (!length || length > maxlength) )
  629. {
  630. console_print(client, "[AdvancedBan] %L", client, "AB_MAX_BAN_TIME", maxlength);
  631. return PLUGIN_HANDLED;
  632. }
  633.  
  634. if( is_user_connected(find_player(is_ip ? "d" : "c", target_authid)) )
  635. {
  636. client_cmd(client, "amx_ban ^"%s^" %i ^"%s^"", target_authid, length, reason);
  637. return PLUGIN_HANDLED;
  638. }
  639.  
  640. static unban_time[32];
  641. if( length == 0 )
  642. {
  643. formatex(unban_time, sizeof(unban_time) - 1, "%L", client, "AB_PERMANENT_BAN");
  644. }
  645. else
  646. {
  647. GenerateUnbanTime(length, unban_time, sizeof(unban_time) - 1);
  648. }
  649.  
  650. static admin_name[64], admin_authid[35];
  651. get_user_name(client, admin_name, sizeof(admin_name) - 1);
  652. get_user_authid(client, admin_authid, sizeof(admin_authid) - 1);
  653.  
  654. AddBan(target_name, target_authid, reason, length, unban_time, admin_name, admin_authid);
  655.  
  656. PrintBanInformation(client, target_name, target_authid, reason, length, unban_time, "", "", false, false);
  657.  
  658. GetBanTime(length, unban_time, sizeof(unban_time) - 1);
  659.  
  660. PrintActivity(admin_name, "^x04[AdvancedBan] $name^x01 :^x03 ban %s %s. Ok: %s. Ban Ideje: %s", is_ip ? "IP" : "SteamID", target_authid, reason, unban_time);
  661.  
  662. Log("%s <%s> banned %s <%s> || Reason: ^"%s^" || Ban Length: %s", admin_name, admin_authid, target_name, target_authid, reason, unban_time);
  663.  
  664. return PLUGIN_HANDLED;
  665. }
  666.  
  667. public CmdUnban(client, level, cid)
  668. {
  669. if( !cmd_access(client, level, cid, 2) ) return PLUGIN_HANDLED;
  670.  
  671. static arg[35];
  672. read_argv(1, arg, sizeof(arg) - 1);
  673.  
  674. #if MAX_BANS > 0
  675. static banned_authid[35];
  676. for( new i = 0; i < g_total_bans; i++ )
  677. {
  678. copy(banned_authid, sizeof(banned_authid) - 1, g_steamids[i]);
  679.  
  680. if( equal(arg, banned_authid) )
  681. {
  682. static admin_name[64];
  683. get_user_name(client, admin_name, sizeof(admin_name) - 1);
  684.  
  685. static name[32], reason[128];
  686. copy(name, sizeof(name) - 1, g_names[i]);
  687. copy(reason, sizeof(reason) - 1, g_reasons[i]);
  688.  
  689. PrintActivity(admin_name, "^x04[AdvancedBan] $name^x01 :^x03 unban %s^x01 [%s] [Ok: %s]", name, arg, reason);
  690.  
  691. static authid[35];
  692. get_user_authid(client, authid, sizeof(authid) - 1);
  693.  
  694. Log("%s <%s> unbanned %s <%s> || Ban Reason: ^"%s^"", admin_name, authid, name, arg, reason);
  695.  
  696. RemoveBan(i);
  697.  
  698. return PLUGIN_HANDLED;
  699. }
  700. }
  701. #else
  702. if( TrieKeyExists(g_trie, arg) )
  703. {
  704. static array_pos;
  705. TrieGetCell(g_trie, arg, array_pos);
  706.  
  707. static data[BannedData];
  708. ArrayGetArray(g_array, array_pos, data);
  709.  
  710. static unban_name[32];
  711. get_user_name(client, unban_name, sizeof(unban_name) - 1);
  712.  
  713. PrintActivity(unban_name, "^x04[AdvancedBan] $name^x01 :^x03 unban %s^x01 [%s] [Ok: %s]", data[bd_name], data[bd_steamid], data[bd_reason]);
  714.  
  715. static admin_name[64];
  716. get_user_name(client, admin_name, sizeof(admin_name) - 1);
  717.  
  718. static authid[35];
  719. get_user_authid(client, authid, sizeof(authid) - 1);
  720.  
  721. Log("%s <%s> unbanned %s <%s> || Ban Reason: ^"%s^"", admin_name, authid, data[bd_name], data[bd_steamid], data[bd_reason]);
  722.  
  723. RemoveBan(array_pos, data[bd_steamid]);
  724.  
  725. return PLUGIN_HANDLED;
  726. }
  727. #endif
  728.  
  729. console_print(client, "[AdvancedBan] %L", client, "AB_NOT_IN_BAN_LIST", arg);
  730.  
  731. return PLUGIN_HANDLED;
  732. }
  733.  
  734. public CmdBanList(client, level, cid)
  735. {
  736. if( !cmd_access(client, level, cid, 1) ) return PLUGIN_HANDLED;
  737.  
  738. if( !g_total_bans )
  739. {
  740. console_print(client, "[AdvancedBan] %L", client, "AB_NO_BANS");
  741. return PLUGIN_HANDLED;
  742. }
  743.  
  744. static start;
  745.  
  746. if( read_argc() > 1 )
  747. {
  748. static arg[5];
  749. read_argv(1, arg, sizeof(arg) - 1);
  750.  
  751. start = min(str_to_num(arg), g_total_bans) - 1;
  752. }
  753. else
  754. {
  755. start = 0;
  756. }
  757.  
  758. new last = min(start + 10, g_total_bans);
  759.  
  760. if( client == 0 )
  761. {
  762. server_cmd("echo ^"%L^"", client, "AB_BAN_LIST_NUM", start + 1, last);
  763. }
  764. else
  765. {
  766. client_cmd(client, "echo ^"%L^"", client, "AB_BAN_LIST_NUM", start + 1, last);
  767. }
  768.  
  769. for( new i = start; i < last; i++ )
  770. {
  771. #if MAX_BANS <= 0
  772. static data[BannedData];
  773. ArrayGetArray(g_array, i, data);
  774.  
  775. PrintBanInformation(client, data[bd_name], data[bd_steamid], data[bd_reason], data[bd_banlength], data[bd_unbantime], data[bd_admin_name], data[bd_admin_steamid], true, false);
  776. #else
  777. static name[32], steamid[35], reason[128], banlength, unbantime[32], admin_name[32], admin_steamid[35];
  778.  
  779. copy(name, sizeof(name) - 1, g_names[i]);
  780. copy(steamid, sizeof(steamid) - 1, g_steamids[i]);
  781. copy(reason, sizeof(reason) - 1, g_reasons[i]);
  782. banlength = g_banlengths[i];
  783. copy(unbantime, sizeof(unbantime) - 1, g_unbantimes[i]);
  784. copy(admin_name, sizeof(admin_name) - 1, g_admin_names[i]);
  785. copy(admin_steamid, sizeof(admin_steamid) - 1, g_admin_steamids[i]);
  786.  
  787. PrintBanInformation(client, name, steamid, reason, banlength, unbantime, admin_name, admin_steamid, true, false);
  788. #endif
  789. }
  790.  
  791. if( ++last < g_total_bans )
  792. {
  793. if( client == 0 )
  794. {
  795. server_cmd("echo ^"%L^"", client, "AB_BAN_LIST_NEXT", last);
  796. }
  797. else
  798. {
  799. client_cmd(client, "echo ^"%L^"", client, "AB_BAN_LIST_NEXT", last);
  800. }
  801. }
  802.  
  803. return PLUGIN_HANDLED;
  804. }
  805.  
  806. public CmdAddBanLimit()
  807. {
  808. if( read_argc() != 3 )
  809. {
  810. log_amx("amx_addbanlimit was used with incorrect parameters!");
  811. log_amx("Usage: amx_addbanlimit <flags> <time in minutes>");
  812. return PLUGIN_HANDLED;
  813. }
  814.  
  815. static arg[16];
  816.  
  817. read_argv(1, arg, sizeof(arg) - 1);
  818. new flags = read_flags(arg);
  819.  
  820. read_argv(2, arg, sizeof(arg) - 1);
  821. new minutes = str_to_num(arg);
  822.  
  823. #if !defined MAX_BANLIMITS
  824. ArrayPushCell(g_maxban_flags, flags);
  825. ArrayPushCell(g_maxban_times, minutes);
  826. #else
  827. if( g_total_maxban_times >= MAX_BANLIMITS )
  828. {
  829. static notified;
  830. if( !notified )
  831. {
  832. log_amx("The amx_addbanlimit has reached its maximum!");
  833. notified = 1;
  834. }
  835. return PLUGIN_HANDLED;
  836. }
  837.  
  838. g_maxban_flags[g_total_maxban_times] = flags;
  839. g_maxban_times[g_total_maxban_times] = minutes;
  840. #endif
  841. g_total_maxban_times++;
  842.  
  843. return PLUGIN_HANDLED;
  844. }
  845.  
  846. public FwdThink(entity)
  847. {
  848. if( entity != g_unban_entity ) return;
  849.  
  850. #if defined USING_SQL
  851. if( g_total_bans > 0 && !g_loading_bans )
  852. #else
  853. if( g_total_bans > 0 )
  854. #endif
  855. {
  856. static _hours[5], _minutes[5], _seconds[5], _month[5], _day[5], _year[7];
  857. format_time(_hours, sizeof(_hours) - 1, "%H");
  858. format_time(_minutes, sizeof(_minutes) - 1, "%M");
  859. format_time(_seconds, sizeof(_seconds) - 1, "%S");
  860. format_time(_month, sizeof(_month) - 1, "%m");
  861. format_time(_day, sizeof(_day) - 1, "%d");
  862. format_time(_year, sizeof(_year) - 1, "%Y");
  863.  
  864. // c = current
  865. // u = unban
  866.  
  867. new c_hours = str_to_num(_hours);
  868. new c_minutes = str_to_num(_minutes);
  869. new c_seconds = str_to_num(_seconds);
  870. new c_month = str_to_num(_month);
  871. new c_day = str_to_num(_day);
  872. new c_year = str_to_num(_year);
  873.  
  874. static unban_time[32];
  875. static u_hours, u_minutes, u_seconds, u_month, u_day, u_year;
  876.  
  877. for( new i = 0; i < g_total_bans; i++ )
  878. {
  879. #if MAX_BANS <= 0
  880. static data[BannedData];
  881. ArrayGetArray(g_array, i, data);
  882.  
  883. if( data[bd_banlength] == 0 ) continue;
  884. #else
  885. if( g_banlengths[i] == 0 ) continue;
  886. #endif
  887.  
  888. #if MAX_BANS <= 0
  889. copy(unban_time, sizeof(unban_time) - 1, data[bd_unbantime]);
  890. #else
  891. copy(unban_time, sizeof(unban_time) - 1, g_unbantimes[i]);
  892. #endif
  893. replace_all(unban_time, sizeof(unban_time) - 1, ":", " ");
  894. replace_all(unban_time, sizeof(unban_time) - 1, "/", " ");
  895.  
  896. parse(unban_time,\
  897. _hours, sizeof(_hours) - 1,\
  898. _minutes, sizeof(_minutes) - 1,\
  899. _seconds, sizeof(_seconds) - 1,\
  900. _month, sizeof(_month) - 1,\
  901. _day, sizeof(_day) - 1,\
  902. _year, sizeof(_year) - 1
  903. );
  904.  
  905. u_hours = str_to_num(_hours);
  906. u_minutes = str_to_num(_minutes);
  907. u_seconds = str_to_num(_seconds);
  908. u_month = str_to_num(_month);
  909. u_day = str_to_num(_day);
  910. u_year = str_to_num(_year);
  911.  
  912. if( u_year < c_year
  913. || u_year == c_year && u_month < c_month
  914. || u_year == c_year && u_month == c_month && u_day < c_day
  915. || u_year == c_year && u_month == c_month && u_day == c_day && u_hours < c_hours
  916. || u_year == c_year && u_month == c_month && u_day == c_day && u_hours == c_hours && u_minutes < c_minutes
  917. || u_year == c_year && u_month == c_month && u_day == c_day && u_hours == c_hours && u_minutes == c_minutes && u_seconds <= c_seconds )
  918. {
  919. #if MAX_BANS <= 0
  920. Log("Ban time is up for: %s [%s]", data[bd_name], data[bd_steamid]);
  921.  
  922. Print("^x04[AdvancedBan]^x03 %s^x01[^x04%s^x01]^x03 ban ideje letelt!^x01 [Ok: %s]", data[bd_name], data[bd_steamid], data[bd_reason]);
  923.  
  924. RemoveBan(i, data[bd_steamid]);
  925. #else
  926. Log("Ban time is up for: %s [%s]", g_names[i], g_steamids[i]);
  927.  
  928. Print("^x04[AdvancedBan]^x03 %s^x01[^x04%s^x01]^x03 ban ideje letelt!^x01 [Ok: %s]", g_names[i], g_steamids[i], g_reasons[i]);
  929.  
  930. RemoveBan(i);
  931. #endif
  932.  
  933. i--; // current pos was replaced with another ban, so we need to check it again.
  934. }
  935. }
  936. }
  937.  
  938. entity_set_float(g_unban_entity, EV_FL_nextthink, get_gametime() + get_pcvar_float(ab_unbancheck));
  939. }
  940.  
  941. public TaskDisconnectPlayer(client, adatok[])
  942. {
  943. new target_name, admin_name, reason, ban_length, unban_time;
  944. target_name = adatok[0];
  945. admin_name = adatok[1];
  946. reason = adatok[2];
  947. ban_length = adatok[3];
  948. unban_time = adatok[4];
  949.  
  950. server_cmd("kick #%i ^"Bannolva lettel! Neved: %s^n Admin Neve aki bannolt: %s^n Ban oka: %s^n Ban ideje: %s || Ban lejar: %s^"", get_user_userid(client), target_name, admin_name, reason, ban_length, unban_time);
  951. }
  952.  
  953. AddBan(const target_name[], const target_steamid[], const reason[], const length, const unban_time[], const admin_name[], const admin_steamid[])
  954. {
  955. #if MAX_BANS > 0
  956. if( g_total_bans == MAX_BANS )
  957. {
  958. log_amx("Ban list is full! (%i)", g_total_bans);
  959. return;
  960. }
  961. #endif
  962.  
  963. #if defined USING_SQL
  964. static target_name2[32], reason2[128], admin_name2[32];
  965. MakeStringSQLSafe(target_name, target_name2, sizeof(target_name2) - 1);
  966. MakeStringSQLSafe(reason, reason2, sizeof(reason2) - 1);
  967. MakeStringSQLSafe(admin_name, admin_name2, sizeof(admin_name2) - 1);
  968.  
  969. static query[512];
  970. formatex(query, sizeof(query) - 1,\
  971. "INSERT INTO `%s` (`%s`, `%s`, `%s`, `%s`, `%s`, `%s`, `%s`) VALUES ('%s', '%s', '%i', '%s', '%s', '%s', '%s');",\
  972. TABLE_NAME, KEY_NAME, KEY_STEAMID, KEY_BANLENGTH, KEY_UNBANTIME, KEY_REASON, KEY_ADMIN_NAME, KEY_ADMIN_STEAMID,\
  973. target_name2, target_steamid, length, unban_time, reason2, admin_name2, admin_steamid
  974. );
  975.  
  976. SQL_ThreadQuery(g_sql_tuple, "QueryAddBan", query);
  977. #else
  978. new f = fopen(g_ban_file, "a+");
  979.  
  980. fprintf(f, "^"%s^" ^"%s^" %i ^"%s^" ^"%s^" ^"%s^" ^"%s^"^n",\
  981. target_steamid,\
  982. target_name,\
  983. length,\
  984. unban_time,\
  985. reason,\
  986. admin_name,\
  987. admin_steamid
  988. );
  989.  
  990. fclose(f);
  991. #endif
  992.  
  993. #if MAX_BANS <= 0
  994. static data[BannedData];
  995. copy(data[bd_name], sizeof(data[bd_name]) - 1, target_name);
  996. copy(data[bd_steamid], sizeof(data[bd_steamid]) - 1, target_steamid);
  997. data[bd_banlength] = length;
  998. copy(data[bd_unbantime], sizeof(data[bd_unbantime]) - 1, unban_time);
  999. copy(data[bd_reason], sizeof(data[bd_reason]) - 1, reason);
  1000. copy(data[bd_admin_name], sizeof(data[bd_admin_name]) - 1, admin_name);
  1001. copy(data[bd_admin_steamid], sizeof(data[bd_admin_steamid]) - 1, admin_steamid);
  1002.  
  1003. TrieSetCell(g_trie, target_steamid, g_total_bans);
  1004. ArrayPushArray(g_array, data);
  1005. #else
  1006. copy(g_names[g_total_bans], sizeof(g_names[]) - 1, target_name);
  1007. copy(g_steamids[g_total_bans], sizeof(g_steamids[]) - 1, target_steamid);
  1008. g_banlengths[g_total_bans] = length;
  1009. copy(g_unbantimes[g_total_bans], sizeof(g_unbantimes[]) - 1, unban_time);
  1010. copy(g_reasons[g_total_bans], sizeof(g_reasons[]) - 1, reason);
  1011. copy(g_admin_names[g_total_bans], sizeof(g_admin_names[]) - 1, admin_name);
  1012. copy(g_admin_steamids[g_total_bans], sizeof(g_admin_steamids[]) - 1, admin_steamid);
  1013. #endif
  1014.  
  1015. g_total_bans++;
  1016.  
  1017. #if MAX_BANS > 0
  1018. if( g_total_bans == MAX_BANS )
  1019. {
  1020. log_amx("Ban list is full! (%i)", g_total_bans);
  1021. }
  1022. #endif
  1023. }
  1024.  
  1025. #if defined USING_SQL
  1026. public QueryAddBan(failstate, Handle:query, error[], errcode, data[], datasize, Float:queuetime)
  1027. {
  1028. if( failstate == TQUERY_CONNECT_FAILED )
  1029. {
  1030. set_fail_state("Could not connect to database.");
  1031. }
  1032. else if( failstate == TQUERY_QUERY_FAILED )
  1033. {
  1034. set_fail_state("Query failed.");
  1035. }
  1036. else if( errcode )
  1037. {
  1038. log_amx("Error on query: %s", error);
  1039. }
  1040. else
  1041. {
  1042. // Yay, ban was added! We can all rejoice!
  1043. }
  1044. }
  1045.  
  1046. public QueryDeleteBan(failstate, Handle:query, error[], errcode, data[], datasize, Float:queuetime)
  1047. {
  1048. if( failstate == TQUERY_CONNECT_FAILED )
  1049. {
  1050. set_fail_state("Could not connect to database.");
  1051. }
  1052. else if( failstate == TQUERY_QUERY_FAILED )
  1053. {
  1054. set_fail_state("Query failed.");
  1055. }
  1056. else if( errcode )
  1057. {
  1058. log_amx("Error on query: %s", error);
  1059. }
  1060. else
  1061. {
  1062. // Yay, ban was deleted! We can all rejoice!
  1063. }
  1064. }
  1065.  
  1066. public QueryLoadBans(failstate, Handle:query, error[], errcode, data[], datasize, Float:queuetime)
  1067. {
  1068. if( failstate == TQUERY_CONNECT_FAILED )
  1069. {
  1070. set_fail_state("Could not connect to database.");
  1071. }
  1072. else if( failstate == TQUERY_QUERY_FAILED )
  1073. {
  1074. set_fail_state("Query failed.");
  1075. }
  1076. else if( errcode )
  1077. {
  1078. log_amx("Error on query: %s", error);
  1079. }
  1080. else
  1081. {
  1082. if( SQL_NumResults(query) )
  1083. {
  1084. #if MAX_BANS <= 0
  1085. static data[BannedData];
  1086. while( SQL_MoreResults(query) )
  1087. #else
  1088. while( SQL_MoreResults(query) && g_total_bans < MAX_BANS )
  1089. #endif
  1090. {
  1091. #if MAX_BANS <= 0
  1092. SQL_ReadResult(query, 0, data[bd_name], sizeof(data[bd_name]) - 1);
  1093. SQL_ReadResult(query, 1, data[bd_steamid], sizeof(data[bd_steamid]) - 1);
  1094. data[bd_banlength] = SQL_ReadResult(query, 2);
  1095. SQL_ReadResult(query, 3, data[bd_unbantime], sizeof(data[bd_unbantime]) - 1);
  1096. SQL_ReadResult(query, 4, data[bd_reason], sizeof(data[bd_reason]) - 1);
  1097. SQL_ReadResult(query, 5, data[bd_admin_name], sizeof(data[bd_admin_name]) - 1);
  1098. SQL_ReadResult(query, 6, data[bd_admin_steamid], sizeof(data[bd_admin_steamid]) - 1);
  1099.  
  1100. ArrayPushArray(g_array, data);
  1101. TrieSetCell(g_trie, data[bd_steamid], g_total_bans);
  1102. #else
  1103. SQL_ReadResult(query, 0, g_names[g_total_bans], sizeof(g_names[]) - 1);
  1104. SQL_ReadResult(query, 1, g_steamids[g_total_bans], sizeof(g_steamids[]) - 1);
  1105. g_banlengths[g_total_bans] = SQL_ReadResult(query, 2);
  1106. SQL_ReadResult(query, 3, g_unbantimes[g_total_bans], sizeof(g_unbantimes[]) - 1);
  1107. SQL_ReadResult(query, 4, g_reasons[g_total_bans], sizeof(g_reasons[]) - 1);
  1108. SQL_ReadResult(query, 5, g_admin_names[g_total_bans], sizeof(g_admin_names[]) - 1);
  1109. SQL_ReadResult(query, 6, g_admin_steamids[g_total_bans], sizeof(g_admin_steamids[]) - 1);
  1110. #endif
  1111.  
  1112. g_total_bans++;
  1113.  
  1114. SQL_NextRow(query);
  1115. }
  1116. }
  1117.  
  1118. set_task(RELOAD_BANS_INTERVAL, "LoadBans");
  1119.  
  1120. g_loading_bans = false;
  1121. }
  1122. }
  1123. #endif
  1124.  
  1125. #if MAX_BANS > 0
  1126. RemoveBan(remove)
  1127. {
  1128. #if defined USING_SQL
  1129. static query[128];
  1130. formatex(query, sizeof(query) - 1,\
  1131. "DELETE FROM `%s` WHERE `%s` = '%s';",\
  1132. TABLE_NAME, KEY_STEAMID, g_steamids[remove]
  1133. );
  1134.  
  1135. SQL_ThreadQuery(g_sql_tuple, "QueryDeleteBan", query);
  1136. #endif
  1137.  
  1138. for( new i = remove; i < g_total_bans; i++ )
  1139. {
  1140. if( (i + 1) == g_total_bans )
  1141. {
  1142. copy(g_names[i], sizeof(g_names[]) - 1, "");
  1143. copy(g_steamids[i], sizeof(g_steamids[]) - 1, "");
  1144. g_banlengths[i] = 0;
  1145. copy(g_unbantimes[i], sizeof(g_unbantimes[]) - 1, "");
  1146. copy(g_reasons[i], sizeof(g_reasons[]) - 1, "");
  1147. copy(g_admin_names[i], sizeof(g_admin_names[]) - 1, "");
  1148. copy(g_admin_steamids[i], sizeof(g_admin_steamids[]) - 1, "");
  1149. }
  1150. else
  1151. {
  1152. copy(g_names[i], sizeof(g_names[]) - 1, g_names[i + 1]);
  1153. copy(g_steamids[i], sizeof(g_steamids[]) - 1, g_steamids[i + 1]);
  1154. g_banlengths[i] = g_banlengths[i + 1];
  1155. copy(g_unbantimes[i], sizeof(g_unbantimes[]) - 1, g_unbantimes[i + 1]);
  1156. copy(g_reasons[i], sizeof(g_reasons[]) - 1, g_reasons[i + 1]);
  1157. copy(g_admin_names[i], sizeof(g_admin_names[]) - 1, g_admin_names[i + 1]);
  1158. copy(g_admin_steamids[i], sizeof(g_admin_steamids[]) - 1, g_admin_steamids[i + 1]);
  1159. }
  1160. }
  1161.  
  1162. g_total_bans--;
  1163.  
  1164. #if !defined USING_SQL
  1165. new f = fopen(g_ban_file, "wt");
  1166.  
  1167. static name[32], steamid[35], banlength, unbantime[32], reason[128], admin_name[32], admin_steamid[35];
  1168. for( new i = 0; i < g_total_bans; i++ )
  1169. {
  1170. copy(name, sizeof(name) - 1, g_names[i]);
  1171. copy(steamid, sizeof(steamid) - 1, g_steamids[i]);
  1172. banlength = g_banlengths[i];
  1173. copy(unbantime, sizeof(unbantime) - 1, g_unbantimes[i]);
  1174. copy(reason, sizeof(reason) - 1, g_reasons[i]);
  1175. copy(admin_name, sizeof(admin_name) - 1, g_admin_names[i]);
  1176. copy(admin_steamid, sizeof(admin_steamid) - 1, g_admin_steamids[i]);
  1177.  
  1178. fprintf(f, "^"%s^" ^"%s^" %i ^"%s^" ^"%s^" ^"%s^" ^"%s^"^n",\
  1179. steamid,\
  1180. name,\
  1181. banlength,\
  1182. unbantime,\
  1183. reason,\
  1184. admin_name,\
  1185. admin_steamid
  1186. );
  1187. }
  1188.  
  1189. fclose(f);
  1190. #endif
  1191. }
  1192. #else
  1193. RemoveBan(pos, const authid[])
  1194. {
  1195. TrieDeleteKey(g_trie, authid);
  1196. ArrayDeleteItem(g_array, pos);
  1197.  
  1198. g_total_bans--;
  1199.  
  1200. #if defined USING_SQL
  1201. static query[128];
  1202. formatex(query, sizeof(query) - 1,\
  1203. "DELETE FROM `%s` WHERE `%s` = '%s';",\
  1204. TABLE_NAME, KEY_STEAMID, authid
  1205. );
  1206.  
  1207. SQL_ThreadQuery(g_sql_tuple, "QueryDeleteBan", query);
  1208.  
  1209. new data[BannedData];
  1210. for( new i = 0; i < g_total_bans; i++ )
  1211. {
  1212. ArrayGetArray(g_array, i, data);
  1213. TrieSetCell(g_trie, data[bd_steamid], i);
  1214. }
  1215. #else
  1216. new f = fopen(g_ban_file, "wt");
  1217.  
  1218. new data[BannedData];
  1219. for( new i = 0; i < g_total_bans; i++ )
  1220. {
  1221. ArrayGetArray(g_array, i, data);
  1222. TrieSetCell(g_trie, data[bd_steamid], i);
  1223.  
  1224. fprintf(f, "^"%s^" ^"%s^" %i ^"%s^" ^"%s^" ^"%s^" ^"%s^"^n",\
  1225. data[bd_steamid],\
  1226. data[bd_name],\
  1227. data[bd_banlength],\
  1228. data[bd_unbantime],\
  1229. data[bd_reason],\
  1230. data[bd_admin_name],\
  1231. data[bd_admin_steamid]
  1232. );
  1233. }
  1234.  
  1235. fclose(f);
  1236. #endif
  1237. }
  1238. #endif
  1239.  
  1240. #if defined KEEP_DEFAULT_BANS
  1241. LoadOldBans(filename[])
  1242. {
  1243. if( file_exists(filename) )
  1244. {
  1245. new f = fopen(filename, "rt");
  1246.  
  1247. static data[96];
  1248. static command[10], minutes[10], steamid[35], length, unban_time[32];
  1249.  
  1250. while( !feof(f) )
  1251. {
  1252. fgets(f, data, sizeof(data) - 1);
  1253. if( !data[0] ) continue;
  1254.  
  1255. parse(data, command, sizeof(command) - 1, minutes, sizeof(minutes) - 1, steamid, sizeof(steamid) - 1);
  1256. if( filename[0] == 'b' && !equali(command, "banid") || filename[0] == 'l' && !equali(command, "addip") ) continue;
  1257.  
  1258. length = str_to_num(minutes);
  1259. GenerateUnbanTime(length, unban_time, sizeof(unban_time) - 1);
  1260.  
  1261. AddBan("", steamid, "", length, unban_time, "", "");
  1262. }
  1263.  
  1264. fclose(f);
  1265.  
  1266. static filename2[32];
  1267.  
  1268. // copy current
  1269. copy(filename2, sizeof(filename2) - 1, filename);
  1270.  
  1271. // cut off at the "."
  1272. // banned.cfg = banned
  1273. // listip.cfg = listip
  1274. filename2[containi(filename2, ".")] = 0;
  1275.  
  1276. // add 2.cfg
  1277. // banned = banned2.cfg
  1278. // listip = listip2.cfg
  1279. add(filename2, sizeof(filename2) - 1, "2.cfg");
  1280.  
  1281. // rename file so that it isnt loaded again
  1282. while( !rename_file(filename, filename2, 1) ) { }
  1283. }
  1284. }
  1285. #endif
  1286.  
  1287. public LoadBans()
  1288. {
  1289. if( g_total_bans )
  1290. {
  1291. #if MAX_BANS <= 0
  1292. TrieClear(g_trie);
  1293. ArrayClear(g_array);
  1294. #endif
  1295.  
  1296. g_total_bans = 0;
  1297. }
  1298.  
  1299. #if defined USING_SQL
  1300. static query[128];
  1301. formatex(query, sizeof(query) - 1,\
  1302. "SELECT * FROM `%s`;",\
  1303. TABLE_NAME
  1304. );
  1305.  
  1306. SQL_ThreadQuery(g_sql_tuple, "QueryLoadBans", query);
  1307.  
  1308. g_loading_bans = true;
  1309. #else
  1310. if( file_exists(g_ban_file) )
  1311. {
  1312. new f = fopen(g_ban_file, "rt");
  1313.  
  1314. static filedata[512], length[10];
  1315.  
  1316. #if MAX_BANS <= 0
  1317. static data[BannedData];
  1318. while( !feof(f) )
  1319. #else
  1320. while( !feof(f) && g_total_bans < MAX_BANS )
  1321. #endif
  1322. {
  1323. fgets(f, filedata, sizeof(filedata) - 1);
  1324.  
  1325. if( !filedata[0] ) continue;
  1326.  
  1327. #if MAX_BANS <= 0
  1328. parse(filedata,\
  1329. data[bd_steamid], sizeof(data[bd_steamid]) - 1,\
  1330. data[bd_name], sizeof(data[bd_name]) - 1,\
  1331. length, sizeof(length) - 1,\
  1332. data[bd_unbantime], sizeof(data[bd_unbantime]) - 1,\
  1333. data[bd_reason], sizeof(data[bd_reason]) - 1,\
  1334. data[bd_admin_name], sizeof(data[bd_admin_name]) - 1,\
  1335. data[bd_admin_steamid], sizeof(data[bd_admin_steamid]) - 1
  1336. );
  1337.  
  1338. data[bd_banlength] = str_to_num(length);
  1339.  
  1340. ArrayPushArray(g_array, data);
  1341. TrieSetCell(g_trie, data[bd_steamid], g_total_bans);
  1342. #else
  1343. static steamid[35], name[32], unbantime[32], reason[128], admin_name[32], admin_steamid[35];
  1344.  
  1345. parse(filedata,\
  1346. steamid, sizeof(steamid) - 1,\
  1347. name, sizeof(name) - 1,\
  1348. length, sizeof(length) - 1,\
  1349. unbantime, sizeof(unbantime) - 1,\
  1350. reason, sizeof(reason) - 1,\
  1351. admin_name, sizeof(admin_name) - 1,\
  1352. admin_steamid, sizeof(admin_steamid) - 1
  1353. );
  1354.  
  1355. copy(g_names[g_total_bans], sizeof(g_names[]) - 1, name);
  1356. copy(g_steamids[g_total_bans], sizeof(g_steamids[]) - 1, steamid);
  1357. g_banlengths[g_total_bans] = str_to_num(length);
  1358. copy(g_unbantimes[g_total_bans], sizeof(g_unbantimes[]) - 1, unbantime);
  1359. copy(g_reasons[g_total_bans], sizeof(g_reasons[]) - 1, reason);
  1360. copy(g_admin_names[g_total_bans], sizeof(g_admin_names[]) - 1, admin_name);
  1361. copy(g_admin_steamids[g_total_bans], sizeof(g_admin_steamids[]) - 1, admin_steamid);
  1362. #endif
  1363.  
  1364. g_total_bans++;
  1365. }
  1366.  
  1367. fclose(f);
  1368. }
  1369. #endif
  1370.  
  1371. // load these after, so when they are added to the file with AddBan(), they aren't loaded again from above.
  1372.  
  1373. #if defined KEEP_DEFAULT_BANS
  1374. LoadOldBans("banned.cfg");
  1375. LoadOldBans("listip.cfg");
  1376. #endif
  1377. }
  1378.  
  1379. #if defined USING_SQL
  1380. MakeStringSQLSafe(const input[], output[], len)
  1381. {
  1382. copy(output, len, input);
  1383. replace_all(output, len, "'", "*");
  1384. replace_all(output, len, "^"", "*");
  1385. replace_all(output, len, "`", "*");
  1386. }
  1387. #endif
  1388.  
  1389. GetBanTime(const bantime, length[], len)
  1390. {
  1391. new minutes = bantime;
  1392. new hours = 0;
  1393. new days = 0;
  1394.  
  1395. while( minutes >= 60 )
  1396. {
  1397. minutes -= 60;
  1398. hours++;
  1399. }
  1400.  
  1401. while( hours >= 24 )
  1402. {
  1403. hours -= 24;
  1404. days++;
  1405. }
  1406.  
  1407. new bool:add_before;
  1408. if( minutes )
  1409. {
  1410. formatex(length, len, "%i Perc%s", minutes, minutes == 1 ? "" : "");
  1411.  
  1412. add_before = true;
  1413. }
  1414. if( hours )
  1415. {
  1416. if( add_before )
  1417. {
  1418. format(length, len, "%i Ora%s, %s", hours, hours == 1 ? "" : "", length);
  1419. }
  1420. else
  1421. {
  1422. formatex(length, len, "%i Ora%s", hours, hours == 1 ? "" : "");
  1423.  
  1424. add_before = true;
  1425. }
  1426. }
  1427. if( days )
  1428. {
  1429. if( add_before )
  1430. {
  1431. format(length, len, "%i Nap%s, %s", days, days == 1 ? "" : "", length);
  1432. }
  1433. else
  1434. {
  1435. formatex(length, len, "%i Nap%s", days, days == 1 ? "" : "");
  1436.  
  1437. add_before = true;
  1438. }
  1439. }
  1440. if( !add_before )
  1441. {
  1442. // minutes, hours, and days = 0
  1443. // assume permanent ban
  1444. copy(length, len, "Permanent Ban");
  1445. }
  1446. }
  1447.  
  1448. GenerateUnbanTime(const bantime, unban_time[], len)
  1449. {
  1450. static _hours[5], _minutes[5], _seconds[5], _month[5], _day[5], _year[7];
  1451. format_time(_hours, sizeof(_hours) - 1, "%H");
  1452. format_time(_minutes, sizeof(_minutes) - 1, "%M");
  1453. format_time(_seconds, sizeof(_seconds) - 1, "%S");
  1454. format_time(_month, sizeof(_month) - 1, "%m");
  1455. format_time(_day, sizeof(_day) - 1, "%d");
  1456. format_time(_year, sizeof(_year) - 1, "%Y");
  1457.  
  1458. new hours = str_to_num(_hours);
  1459. new minutes = str_to_num(_minutes);
  1460. new seconds = str_to_num(_seconds);
  1461. new month = str_to_num(_month);
  1462. new day = str_to_num(_day);
  1463. new year = str_to_num(_year);
  1464.  
  1465. minutes += bantime;
  1466.  
  1467. while( minutes >= 60 )
  1468. {
  1469. minutes -= 60;
  1470. hours++;
  1471. }
  1472.  
  1473. while( hours >= 24 )
  1474. {
  1475. hours -= 24;
  1476. day++;
  1477. }
  1478.  
  1479. new max_days = GetDaysInMonth(month, year);
  1480. while( day > max_days )
  1481. {
  1482. day -= max_days;
  1483. month++;
  1484. }
  1485.  
  1486. while( month > 12 )
  1487. {
  1488. month -= 12;
  1489. year++;
  1490. }
  1491.  
  1492. formatex(unban_time, len, "%i.%i.%i %i:%02i:%02i", year, month, day, hours, minutes, seconds);
  1493. }
  1494.  
  1495. GetDaysInMonth(month, year=0)
  1496. {
  1497. switch( month )
  1498. {
  1499. case 1: return 31; // january
  1500. case 2: return ((year % 4) == 0) ? 29 : 28; // february
  1501. case 3: return 31; // march
  1502. case 4: return 30; // april
  1503. case 5: return 31; // may
  1504. case 6: return 30; // june
  1505. case 7: return 31; // july
  1506. case 8: return 31; // august
  1507. case 9: return 30; // september
  1508. case 10: return 31; // october
  1509. case 11: return 30; // november
  1510. case 12: return 31; // december
  1511. }
  1512.  
  1513. return 30;
  1514. }
  1515.  
  1516. GetTargetFlags(client)
  1517. {
  1518. static const flags_no_immunity = (CMDTARGET_ALLOW_SELF|CMDTARGET_NO_BOTS);
  1519. static const flags_immunity = (CMDTARGET_ALLOW_SELF|CMDTARGET_NO_BOTS|CMDTARGET_OBEY_IMMUNITY);
  1520.  
  1521. switch( get_pcvar_num(ab_immunity) )
  1522. {
  1523. case 1: return flags_immunity;
  1524. case 2: return access(client, ADMIN_IMMUNITY) ? flags_no_immunity : flags_immunity;
  1525. }
  1526.  
  1527. return flags_no_immunity;
  1528. }
  1529.  
  1530. GetMaxBanTime(client)
  1531. {
  1532. if( !g_total_maxban_times ) return 0;
  1533.  
  1534. new flags = get_user_flags(client);
  1535.  
  1536. for( new i = 0; i < g_total_maxban_times; i++ )
  1537. {
  1538. #if !defined MAX_BANLIMITS
  1539. if( flags & ArrayGetCell(g_maxban_flags, i) )
  1540. {
  1541. return ArrayGetCell(g_maxban_times, i);
  1542. }
  1543. #else
  1544. if( flags & g_maxban_flags[i] )
  1545. {
  1546. return g_maxban_times[i];
  1547. }
  1548. #endif
  1549. }
  1550.  
  1551. return 0;
  1552. }
  1553.  
  1554. PrintBanInformation(client, const target_name[], const target_authid[], const reason[], const length, const unban_time[], const admin_name[], const admin_authid[], bool:show_admin, bool:show_website)
  1555. {
  1556. static website[64], ban_length[64];
  1557. if( client == 0 )
  1558. {
  1559. server_print("************************************************");
  1560. server_print("%L", client, "AB_BAN_INFORMATION");
  1561. server_print("%L: %s", client, "AB_NAME", target_name);
  1562. server_print("%L: %s", client, IsValidAuthid(target_authid) ? "AB_STEAMID" : "AB_IP", target_authid);
  1563. server_print("%L: %s", client, "AB_REASON", reason);
  1564. if( length > 0 )
  1565. {
  1566. GetBanTime(length, ban_length, sizeof(ban_length) - 1);
  1567. server_print("%L: %s", client, "AB_BAN_LENGTH", ban_length);
  1568. }
  1569. server_print("%L: %s", client, "AB_UNBAN_TIME", unban_time);
  1570. if( show_admin )
  1571. {
  1572. server_print("%L: %s", client, "AB_ADMIN_NAME", admin_name);
  1573. server_print("%L: %s", client, "AB_ADMIN_STEAMID", admin_authid);
  1574. }
  1575. if( show_website )
  1576. {
  1577. get_pcvar_string(ab_website, website, sizeof(website) - 1);
  1578. if( website[0] )
  1579. {
  1580. server_print("");
  1581. server_print("%L", client, "AB_WEBSITE");
  1582. server_print("%s", website);
  1583. }
  1584. }
  1585. server_print("************************************************");
  1586. }
  1587. else
  1588. {
  1589. client_cmd(client, "echo ^"************************************************^"");
  1590. client_cmd(client, "echo ^"%L^"", client, "AB_BAN_INFORMATION");
  1591. client_cmd(client, "echo ^"%L: %s^"", client, "AB_NAME", target_name);
  1592. client_cmd(client, "echo ^"%L: %s^"", client, IsValidAuthid(target_authid) ? "AB_STEAMID" : "AB_IP", target_authid);
  1593. client_cmd(client, "echo ^"%L: %s^"", client, "AB_REASON", reason);
  1594. if( length > 0 )
  1595. {
  1596. GetBanTime(length, ban_length, sizeof(ban_length) - 1);
  1597. client_cmd(client, "echo ^"%L: %s^"", client, "AB_BAN_LENGTH", ban_length);
  1598. }
  1599. client_cmd(client, "echo ^"%L: %s^"", client, "AB_UNBAN_TIME", unban_time);
  1600. if( show_admin )
  1601. {
  1602. client_cmd(client, "echo ^"%L: %s^"", client, "AB_ADMIN_NAME", admin_name);
  1603. client_cmd(client, "echo ^"%L: %s^"", client, "AB_ADMIN_STEAMID", admin_authid);
  1604. }
  1605. if( show_website )
  1606. {
  1607. get_pcvar_string(ab_website, website, sizeof(website) - 1);
  1608. if( website[0] )
  1609. {
  1610. client_cmd(client, "echo ^"^"");
  1611. client_cmd(client, "echo ^"%L^"", client, "AB_WEBSITE");
  1612. client_cmd(client, "echo ^"%s^"", website);
  1613. }
  1614. }
  1615. client_cmd(client, "echo ^"************************************************^"");
  1616. }
  1617. }
  1618.  
  1619. PrintActivity(const admin_name[], const message_fmt[], any:...)
  1620. {
  1621. if( !get_playersnum() ) return;
  1622.  
  1623. new activity = get_pcvar_num(amx_show_activity);
  1624. if( !(0 <= activity <= 5) )
  1625. {
  1626. set_pcvar_num(amx_show_activity, (activity = 2));
  1627. }
  1628.  
  1629. static message[192], temp[192];
  1630. vformat(message, sizeof(message) - 1, message_fmt, 3);
  1631.  
  1632. for( new client = 1; client <= g_max_clients; client++ )
  1633. {
  1634. if( !is_user_connected(client) ) continue;
  1635.  
  1636. switch( is_user_admin(client) ? g_admin_activity[activity] : g_normal_activity[activity] )
  1637. {
  1638. case ACTIVITY_NONE:
  1639. {
  1640.  
  1641. }
  1642. case ACTIVITY_HIDE:
  1643. {
  1644. copy(temp, sizeof(temp) - 1, message);
  1645. replace(temp, sizeof(temp) - 1, "$name", "ADMIN");
  1646.  
  1647. message_begin(MSG_ONE_UNRELIABLE, g_msgid_SayText, _, client);
  1648. write_byte(client);
  1649. write_string(temp);
  1650. message_end();
  1651. }
  1652. case ACTIVITY_SHOW:
  1653. {
  1654. copy(temp, sizeof(temp) - 1, message);
  1655. replace(temp, sizeof(temp) - 1, "$name", admin_name);
  1656.  
  1657. message_begin(MSG_ONE_UNRELIABLE, g_msgid_SayText, _, client);
  1658. write_byte(client);
  1659. write_string(temp);
  1660. message_end();
  1661. }
  1662. }
  1663. }
  1664. }
  1665.  
  1666. Print(const message_fmt[], any:...)
  1667. {
  1668. if( !get_playersnum() ) return;
  1669.  
  1670. static message[192];
  1671. vformat(message, sizeof(message) - 1, message_fmt, 2);
  1672.  
  1673. for( new client = 1; client <= g_max_clients; client++ )
  1674. {
  1675. if( !is_user_connected(client) ) continue;
  1676.  
  1677. message_begin(MSG_ONE_UNRELIABLE, g_msgid_SayText, _, client);
  1678. write_byte(client);
  1679. write_string(message);
  1680. message_end();
  1681. }
  1682. }
  1683.  
  1684. Log(const message_fmt[], any:...)
  1685. {
  1686. static message[256];
  1687. vformat(message, sizeof(message) - 1, message_fmt, 2);
  1688.  
  1689. static filename[96];
  1690. #if defined HISTORY_ONE_FILE
  1691. if( !filename[0] )
  1692. {
  1693. get_basedir(filename, sizeof(filename) - 1);
  1694. add(filename, sizeof(filename) - 1, "/logs/ban_history.log");
  1695. }
  1696. #else
  1697. static dir[64];
  1698. if( !dir[0] )
  1699. {
  1700. get_basedir(dir, sizeof(dir) - 1);
  1701. add(dir, sizeof(dir) - 1, "/logs");
  1702. }
  1703.  
  1704. format_time(filename, sizeof(filename) - 1, "%m%d%Y");
  1705. format(filename, sizeof(filename) - 1, "%s/BAN_HISTORY_%s.log", dir, filename);
  1706. #endif
  1707.  
  1708. log_amx("%s", message);
  1709. log_to_file(filename, "%s", message);
  1710. }
  1711. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  1712. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1038\\ f0\\ fs16 \n\\ par }
  1713. */
  1714.  
  1715.  

_________________
Kép

Ők köszönték meg CrB nek ezt a hozzászólást: AsD# (2015.02.16. 19:10)
  Népszerűség: 2.27%


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Ez miért nemjó?
HozzászólásElküldve: 2015.02.16. 18:48 
Offline
Senior Tag

Csatlakozott: 2013.07.29. 13:15
Hozzászólások: 233
Megköszönt másnak: 125 alkalommal
Valami nem jó! Csináltam magammal egy teszt bant de amikor kibannolom magam akkor bejön az a kis zöld ablak amiben ez van: Banolva lettél! Neved:" és enyi még a nevemet sem írja oda meg a többi adatotsem :(


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Ez miért nemjó?
HozzászólásElküldve: 2015.02.16. 18:50 
Offline
Őskövület
Avatar

Csatlakozott: 2012.02.27. 09:42
Hozzászólások: 2588
Megköszönt másnak: 25 alkalommal
Megköszönték neki: 418 alkalommal
Valszeg azért mert nem enged több karaktert kiírni. Nem tudom pontosan mennyi a megengedett.

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Ez miért nemjó?
HozzászólásElküldve: 2015.02.16. 19:09 
Offline
Senior Tag

Csatlakozott: 2013.07.29. 13:15
Hozzászólások: 233
Megköszönt másnak: 125 alkalommal
Akkor az nem is lehet megoldani hogy kiíron anyi adatot mert még egy sem fért ki ugye? :(


Hozzászólás jelentése
Vissza a tetejére
   
Hozzászólások megjelenítése:  Rendezés  
Új téma nyitása  Hozzászólás a témához  [ 9 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 23 vendég


Nyithatsz új témákat ebben a fórumban.
Válaszolhatsz egy témára ebben a fórumban.
Nem szerkesztheted a hozzászólásaidat ebben a fórumban.
Nem törölheted a hozzászólásaidat ebben a fórumban.
Nem küldhetsz csatolmányokat ebben a fórumban.

Keresés:
Ugrás:  
Powered by phpBB® Forum Software © phpBB Limited
Magyar fordítás © Magyar phpBB Közösség
Portal: Kiss Portal Extension © Michael O'Toole