· 5 years ago · Mar 04, 2020, 09:40 PM
1// vim: set ts=4 sw=4 tw=99 noet:
2//
3// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
4// Copyright (C) The AMX Mod X Development Team.
5//
6// This software is licensed under the GNU General Public License, version 3 or higher.
7// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
8// https://alliedmods.net/amxmodx-license
9
10//
11// Admin Base Plugin
12//
13
14// Uncomment for SQL version
15// #define USING_SQL
16
17#include <amxmodx>
18#include <amxmisc>
19#if defined USING_SQL
20#include <sqlx>
21#endif
22
23//new Vector:AdminList;
24
25new AdminCount;
26
27new PLUGINNAME[] = "AMX Mod X"
28
29#define ADMIN_LOOKUP (1<<0)
30#define ADMIN_NORMAL (1<<1)
31#define ADMIN_STEAM (1<<2)
32#define ADMIN_IPADDR (1<<3)
33#define ADMIN_NAME (1<<4)
34
35new bool:g_CaseSensitiveName[MAX_PLAYERS + 1];
36
37// pcvars
38new amx_mode;
39new amx_password_field;
40new amx_default_access;
41
42public plugin_init()
43{
44#if defined USING_SQL
45 register_plugin("Admin Base (SQL)", AMXX_VERSION_STR, "AMXX Dev Team")
46#else
47 register_plugin("Admin Base", AMXX_VERSION_STR, "AMXX Dev Team")
48#endif
49 register_dictionary("admin.txt")
50 register_dictionary("common.txt")
51 amx_mode=register_cvar("amx_mode", "1", FCVAR_PROTECTED)
52 amx_password_field=register_cvar("amx_password_field", "_pw", FCVAR_PROTECTED)
53 amx_default_access=register_cvar("amx_default_access", "", FCVAR_PROTECTED)
54
55 register_cvar("amx_vote_ratio", "0.02")
56 register_cvar("amx_vote_time", "10")
57 register_cvar("amx_vote_answers", "1")
58 register_cvar("amx_vote_delay", "60")
59 register_cvar("amx_last_voting", "0")
60 register_cvar("amx_show_activity", "2", FCVAR_PROTECTED)
61 register_cvar("amx_votekick_ratio", "0.40")
62 register_cvar("amx_voteban_ratio", "0.40")
63 register_cvar("amx_votemap_ratio", "0.40")
64
65 set_cvar_float("amx_last_voting", 0.0)
66
67#if defined USING_SQL
68 register_srvcmd("amx_sqladmins", "adminSql")
69 register_cvar("amx_sql_table", "admins", FCVAR_PROTECTED)
70#endif
71 register_cvar("amx_sql_host", "127.0.0.1", FCVAR_PROTECTED)
72 register_cvar("amx_sql_user", "root", FCVAR_PROTECTED)
73 register_cvar("amx_sql_pass", "", FCVAR_PROTECTED)
74 register_cvar("amx_sql_db", "amx", FCVAR_PROTECTED)
75 register_cvar("amx_sql_type", "mysql", FCVAR_PROTECTED)
76 register_cvar("amx_sql_timeout", "60", FCVAR_PROTECTED)
77
78 register_concmd("amx_reloadadmins", "cmdReload", ADMIN_CFG)
79 register_concmd("amx_addadmin", "addadminfn", ADMIN_RCON, "<playername|auth> <accessflags> [password] [authtype] - add specified player as an admin to users.ini")
80
81 remove_user_flags(0, read_flags("z")) // Remove 'user' flag from server rights
82
83 new configsDir[64]
84 get_configsdir(configsDir, charsmax(configsDir))
85
86 server_cmd("exec %s/sql.cfg", configsDir)
87
88 // Create a vector of 5 cells to store the info.
89 //AdminList=vector_create(5);
90
91
92#if defined USING_SQL
93 server_cmd("amx_sqladmins")
94#else
95 format(configsDir, 63, "%s/users.ini", configsDir)
96 loadSettings(configsDir) // Load admins accounts
97#endif
98}
99public client_connect(id)
100{
101 g_CaseSensitiveName[id] = false;
102}
103public addadminfn(id, level, cid)
104{
105 if (!cmd_access(id, level, cid, 3))
106 return PLUGIN_HANDLED
107
108 new idtype = ADMIN_STEAM | ADMIN_LOOKUP
109
110 if (read_argc() >= 5)
111 {
112 new t_arg[16]
113 read_argv(4, t_arg, charsmax(t_arg))
114
115 if (equali(t_arg, "steam") || equali(t_arg, "steamid") || equali(t_arg, "auth"))
116 {
117 idtype = ADMIN_STEAM
118 }
119 else if (equali(t_arg, "ip"))
120 {
121 idtype = ADMIN_IPADDR
122 }
123 else if (equali(t_arg, "name") || equali(t_arg, "nick"))
124 {
125 idtype = ADMIN_NAME
126
127 if (equali(t_arg, "name"))
128 idtype |= ADMIN_LOOKUP
129 } else {
130 console_print(id, "[%s] Unknown id type ^"%s^", use one of: steamid, ip, name", PLUGINNAME, t_arg)
131 return PLUGIN_HANDLED
132 }
133 }
134
135 new arg[33]
136 read_argv(1, arg, charsmax(arg))
137 new player = -1
138
139 if (idtype & ADMIN_STEAM)
140 {
141 if (containi(arg, "STEAM_0:") == -1)
142 {
143 idtype |= ADMIN_LOOKUP
144 player = cmd_target(id, arg, CMDTARGET_ALLOW_SELF | CMDTARGET_NO_BOTS)
145 } else {
146 new _steamid[44]
147 static _players[MAX_PLAYERS], _num, _pv
148 get_players(_players, _num)
149 for (new _i=0; _i<_num; _i++)
150 {
151 _pv = _players[_i]
152 get_user_authid(_pv, _steamid, charsmax(_steamid))
153 if (!_steamid[0])
154 continue
155 if (equal(_steamid, arg))
156 {
157 player = _pv
158 break
159 }
160 }
161 if (player < 1)
162 {
163 idtype &= ~ADMIN_LOOKUP
164 }
165 }
166 }
167 else if (idtype & ADMIN_NAME)
168 {
169 player = cmd_target(id, arg, CMDTARGET_ALLOW_SELF | CMDTARGET_NO_BOTS)
170
171 if (player)
172 idtype |= ADMIN_LOOKUP
173 else
174 idtype &= ~ADMIN_LOOKUP
175 }
176 else if (idtype & ADMIN_IPADDR)
177 {
178 new len = strlen(arg)
179 new dots, chars
180
181 for (new i = 0; i < len; i++)
182 {
183 if (arg[i] == '.')
184 {
185 if (!chars || chars > 3)
186 break
187
188 if (++dots > 3)
189 break
190
191 chars = 0
192 } else {
193 chars++
194 }
195
196 if (dots != 3 || !chars || chars > 3)
197 {
198 idtype |= ADMIN_LOOKUP
199 player = find_player("dh", arg)
200 }
201 }
202 }
203
204 if (idtype & ADMIN_LOOKUP && !player)
205 {
206 console_print(id, "%L", id, "CL_NOT_FOUND")
207 return PLUGIN_HANDLED
208 }
209
210 new flags[64]
211 read_argv(2, flags, charsmax(flags))
212
213 new password[64]
214 if (read_argc() >= 4) {
215 read_argv(3, password, charsmax(password))
216 }
217
218 new auth[33]
219 new Comment[MAX_NAME_LENGTH]; // name of player to pass to comment field
220 if (idtype & ADMIN_LOOKUP)
221 {
222 get_user_name(player, Comment, charsmax(Comment))
223 if (idtype & ADMIN_STEAM)
224 {
225 get_user_authid(player, auth, charsmax(auth))
226 }
227 else if (idtype & ADMIN_IPADDR)
228 {
229 get_user_ip(player, auth, charsmax(auth), 1)
230 }
231 else if (idtype & ADMIN_NAME)
232 {
233 get_user_name(player, auth, charsmax(auth))
234 }
235 } else {
236 copy(auth, charsmax(auth), arg)
237 }
238
239 new type[16], len
240
241 if (idtype & ADMIN_STEAM)
242 len += format(type[len], charsmax(type) - len, "c")
243 else if (idtype & ADMIN_IPADDR)
244 len += format(type[len], charsmax(type) - len, "d")
245
246 if (strlen(password) > 0)
247 len += format(type[len], charsmax(type) - len, "a")
248 else
249 len += format(type[len], charsmax(type) - len, "e")
250
251 AddAdmin(id, auth, flags, password, type, Comment)
252 cmdReload(id, ADMIN_CFG, 0)
253
254 if (player > 0)
255 {
256 new name[MAX_NAME_LENGTH]
257 get_user_info(player, "name", name, charsmax(name))
258 accessUser(player, name)
259 }
260
261 return PLUGIN_HANDLED
262}
263
264AddAdmin(id, auth[], accessflags[], password[], flags[], comment[]="")
265{
266#if defined USING_SQL
267 new error[128], errno
268
269 new Handle:info = SQL_MakeStdTuple()
270 new Handle:sql = SQL_Connect(info, errno, error, charsmax(error))
271
272 if (sql == Empty_Handle)
273 {
274 server_print("[AMXX] %L", LANG_SERVER, "SQL_CANT_CON", error)
275 //backup to users.ini
276#endif
277 // Make sure that the users.ini file exists.
278 new configsDir[64]
279 get_configsdir(configsDir, charsmax(configsDir))
280 format(configsDir, charsmax(configsDir), "%s/users.ini", configsDir)
281
282 if (!file_exists(configsDir))
283 {
284 console_print(id, "[%s] File ^"%s^" doesn't exist.", PLUGINNAME, configsDir)
285 return
286 }
287
288 // Make sure steamid isn't already in file.
289 new line = 0, textline[256], len
290 const SIZE = 63
291 new line_steamid[SIZE + 1], line_password[SIZE + 1], line_accessflags[SIZE + 1], line_flags[SIZE + 1], parsedParams
292
293 // <name|ip|steamid> <password> <access flags> <account flags>
294 while ((line = read_file(configsDir, line, textline, charsmax(textline), len)))
295 {
296 if (len == 0 || equal(textline, ";", 1))
297 continue // comment line
298
299 parsedParams = parse(textline, line_steamid, SIZE, line_password, SIZE, line_accessflags, SIZE, line_flags, SIZE)
300
301 if (parsedParams != 4)
302 continue // Send warning/error?
303
304 if (containi(line_flags, flags) != -1 && equal(line_steamid, auth))
305 {
306 console_print(id, "[%s] %s already exists!", PLUGINNAME, auth)
307 return
308 }
309 }
310
311 // If we came here, steamid doesn't exist in users.ini. Add it.
312 new linetoadd[512]
313
314 if (comment[0]==0)
315 {
316 formatex(linetoadd, charsmax(linetoadd), "^r^n^"%s^" ^"%s^" ^"%s^" ^"%s^"", auth, password, accessflags, flags)
317 }
318 else
319 {
320 formatex(linetoadd, charsmax(linetoadd), "^r^n^"%s^" ^"%s^" ^"%s^" ^"%s^" ; %s", auth, password, accessflags, flags, comment)
321 }
322 console_print(id, "Adding:^n%s", linetoadd)
323
324 if (!write_file(configsDir, linetoadd))
325 console_print(id, "[%s] Failed writing to %s!", PLUGINNAME, configsDir)
326#if defined USING_SQL
327 }
328
329 new table[32]
330
331 get_cvar_string("amx_sql_table", table, charsmax(table))
332
333 new Handle:query = SQL_PrepareQuery(sql, "SELECT * FROM `%s` WHERE (`auth` = '%s')", table, auth)
334
335 if (!SQL_Execute(query))
336 {
337 SQL_QueryError(query, error, charsmax(error))
338 server_print("[AMXX] %L", LANG_SERVER, "SQL_CANT_LOAD_ADMINS", error)
339 console_print(id, "[AMXX] %L", LANG_SERVER, "SQL_CANT_LOAD_ADMINS", error)
340 } else if (SQL_NumResults(query)) {
341 console_print(id, "[%s] %s already exists!", PLUGINNAME, auth)
342 } else {
343 console_print(id, "Adding to database:^n^"%s^" ^"%s^" ^"%s^" ^"%s^"", auth, password, accessflags, flags)
344
345 SQL_QueryAndIgnore(sql, "REPLACE INTO `%s` (`auth`, `password`, `access`, `flags`) VALUES ('%s', '%s', '%s', '%s')", table, auth, password, accessflags, flags)
346 }
347
348 SQL_FreeHandle(query)
349 SQL_FreeHandle(sql)
350 SQL_FreeHandle(info)
351#endif
352
353}
354
355loadSettings(szFilename[])
356{
357 new File=fopen(szFilename,"r");
358
359 if (File)
360 {
361 new Text[512];
362 new Flags[32];
363 new Access[32]
364 new AuthData[44];
365 new Password[32];
366
367 while (!feof(File))
368 {
369 fgets(File, Text, charsmax(Text));
370
371 trim(Text);
372
373 // comment
374 if (Text[0]==';')
375 {
376 continue;
377 }
378
379 Flags[0]=0;
380 Access[0]=0;
381 AuthData[0]=0;
382 Password[0]=0;
383
384 // not enough parameters
385 if (parse(Text,AuthData,charsmax(AuthData),Password,charsmax(Password),Access,charsmax(Access),Flags,charsmax(Flags)) < 2)
386 {
387 continue;
388 }
389
390 admins_push(AuthData,Password,read_flags(Access),read_flags(Flags));
391
392 AdminCount++;
393 }
394
395 fclose(File);
396 }
397
398 if (AdminCount == 1)
399 {
400 server_print("[AMXX] %L", LANG_SERVER, "LOADED_ADMIN");
401 }
402 else
403 {
404 server_print("[AMXX] %L", LANG_SERVER, "LOADED_ADMINS", AdminCount);
405 }
406
407 return 1;
408}
409
410#if defined USING_SQL
411public adminSql()
412{
413 new table[32], error[128], type[12], errno
414
415 new Handle:info = SQL_MakeStdTuple()
416 new Handle:sql = SQL_Connect(info, errno, error, charsmax(error))
417
418 get_cvar_string("amx_sql_table", table, charsmax(table))
419
420 SQL_GetAffinity(type, charsmax(type))
421
422 if (sql == Empty_Handle)
423 {
424 server_print("[AMXX] %L", LANG_SERVER, "SQL_CANT_CON", error)
425
426 //backup to users.ini
427 new configsDir[64]
428
429 get_configsdir(configsDir, charsmax(configsDir))
430 format(configsDir, charsmax(configsDir), "%s/users.ini", configsDir)
431 loadSettings(configsDir) // Load admins accounts
432
433 return PLUGIN_HANDLED
434 }
435
436 new Handle:query
437
438 if (equali(type, "sqlite"))
439 {
440 if (!sqlite_TableExists(sql, table))
441 {
442 SQL_QueryAndIgnore(sql, "CREATE TABLE %s ( auth TEXT NOT NULL DEFAULT '', password TEXT NOT NULL DEFAULT '', access TEXT NOT NULL DEFAULT '', flags TEXT NOT NULL DEFAULT '' )", table)
443 }
444
445 query = SQL_PrepareQuery(sql, "SELECT auth, password, access, flags FROM %s", table)
446 } else {
447 SQL_QueryAndIgnore(sql, "CREATE TABLE IF NOT EXISTS `%s` ( `auth` VARCHAR( 32 ) NOT NULL, `password` VARCHAR( 32 ) NOT NULL, `access` VARCHAR( 32 ) NOT NULL, `flags` VARCHAR( 32 ) NOT NULL ) COMMENT = 'AMX Mod X Admins'", table)
448 query = SQL_PrepareQuery(sql,"SELECT `auth`,`password`,`access`,`flags` FROM `%s`", table)
449 }
450
451 if (!SQL_Execute(query))
452 {
453 SQL_QueryError(query, error, charsmax(error))
454 server_print("[AMXX] %L", LANG_SERVER, "SQL_CANT_LOAD_ADMINS", error)
455 } else if (!SQL_NumResults(query)) {
456 server_print("[AMXX] %L", LANG_SERVER, "NO_ADMINS")
457 } else {
458
459 AdminCount = 0
460
461 /** do this incase people change the query order and forget to modify below */
462 new qcolAuth = SQL_FieldNameToNum(query, "auth")
463 new qcolPass = SQL_FieldNameToNum(query, "password")
464 new qcolAccess = SQL_FieldNameToNum(query, "access")
465 new qcolFlags = SQL_FieldNameToNum(query, "flags")
466
467 new AuthData[44];
468 new Password[44];
469 new Access[32];
470 new Flags[32];
471
472 while (SQL_MoreResults(query))
473 {
474 SQL_ReadResult(query, qcolAuth, AuthData, charsmax(AuthData));
475 SQL_ReadResult(query, qcolPass, Password, charsmax(Password));
476 SQL_ReadResult(query, qcolAccess, Access, charsmax(Access));
477 SQL_ReadResult(query, qcolFlags, Flags, charsmax(Flags));
478
479 admins_push(AuthData,Password,read_flags(Access),read_flags(Flags));
480
481 ++AdminCount;
482 SQL_NextRow(query)
483 }
484
485 if (AdminCount == 1)
486 {
487 server_print("[AMXX] %L", LANG_SERVER, "SQL_LOADED_ADMIN")
488 }
489 else
490 {
491 server_print("[AMXX] %L", LANG_SERVER, "SQL_LOADED_ADMINS", AdminCount)
492 }
493
494 SQL_FreeHandle(query)
495 SQL_FreeHandle(sql)
496 SQL_FreeHandle(info)
497 }
498
499 return PLUGIN_HANDLED
500}
501#endif
502
503public cmdReload(id, level, cid)
504{
505 if (!cmd_access(id, level, cid, 1))
506 return PLUGIN_HANDLED
507
508 //strip original flags (patch submitted by mrhunt)
509 remove_user_flags(0, read_flags("z"))
510
511 admins_flush();
512
513#if !defined USING_SQL
514 new filename[128]
515
516 get_configsdir(filename, charsmax(filename))
517 format(filename, charsmax(filename), "%s/users.ini", filename)
518
519 AdminCount = 0;
520 loadSettings(filename); // Re-Load admins accounts
521
522 if (id != 0)
523 {
524 if (AdminCount == 1)
525 {
526 console_print(id, "[AMXX] %L", LANG_SERVER, "LOADED_ADMIN");
527 }
528 else
529 {
530 console_print(id, "[AMXX] %L", LANG_SERVER, "LOADED_ADMINS", AdminCount);
531 }
532 }
533#else
534 AdminCount = 0
535 adminSql()
536
537 if (id != 0)
538 {
539 if (AdminCount == 1)
540 console_print(id, "[AMXX] %L", LANG_SERVER, "SQL_LOADED_ADMIN")
541 else
542 console_print(id, "[AMXX] %L", LANG_SERVER, "SQL_LOADED_ADMINS", AdminCount)
543 }
544#endif
545
546 new players[MAX_PLAYERS], num, pv
547 new name[MAX_NAME_LENGTH]
548 get_players(players, num)
549 for (new i=0; i<num; i++)
550 {
551 pv = players[i]
552 get_user_name(pv, name, charsmax(name))
553 accessUser(pv, name)
554 }
555
556 return PLUGIN_HANDLED
557}
558
559getAccess(id, name[], authid[], ip[], password[])
560{
561 new index = -1
562 new result = 0
563
564 static Count;
565 static Flags;
566 static Access;
567 static AuthData[44];
568 static Password[32];
569
570 g_CaseSensitiveName[id] = false;
571
572 Count=admins_num();
573 for (new i = 0; i < Count; ++i)
574 {
575 Flags=admins_lookup(i,AdminProp_Flags);
576 admins_lookup(i,AdminProp_Auth,AuthData,charsmax(AuthData));
577
578 if (Flags & FLAG_AUTHID)
579 {
580 if (equal(authid, AuthData))
581 {
582 index = i
583 break
584 }
585 }
586 else if (Flags & FLAG_IP)
587 {
588 new c = strlen(AuthData)
589
590 if (AuthData[c - 1] == '.') /* check if this is not a xxx.xxx. format */
591 {
592 if (equal(AuthData, ip, c))
593 {
594 index = i
595 break
596 }
597 } /* in other case an IP must just match */
598 else if (equal(ip, AuthData))
599 {
600 index = i
601 break
602 }
603 }
604 else
605 {
606 if (Flags & FLAG_CASE_SENSITIVE)
607 {
608 if (Flags & FLAG_TAG)
609 {
610 if (contain(name, AuthData) != -1)
611 {
612 index = i
613 g_CaseSensitiveName[id] = true
614 break
615 }
616 }
617 else if (equal(name, AuthData))
618 {
619 index = i
620 g_CaseSensitiveName[id] = true
621 break
622 }
623 }
624 else
625 {
626 if (Flags & FLAG_TAG)
627 {
628 if (containi(name, AuthData) != -1)
629 {
630 index = i
631 break
632 }
633 }
634 else if (equali(name, AuthData))
635 {
636 index = i
637 break
638 }
639 }
640 }
641 }
642
643 if (index != -1)
644 {
645 Access=admins_lookup(index,AdminProp_Access);
646
647 if (Flags & FLAG_NOPASS)
648 {
649 result |= 8
650 new sflags[32]
651
652 get_flags(Access, sflags, charsmax(sflags))
653 set_user_flags(id, Access)
654
655 log_amx("Login: ^"%s<%d><%s><>^" became an admin (account ^"%s^") (access ^"%s^") (address ^"%s^")", name, get_user_userid(id), authid, AuthData, sflags, ip)
656 }
657 else
658 {
659
660 admins_lookup(index,AdminProp_Password,Password,charsmax(Password));
661
662 if (equal(password, Password))
663 {
664 result |= 12
665 set_user_flags(id, Access)
666
667 new sflags[32]
668 get_flags(Access, sflags, charsmax(sflags))
669
670 log_amx("Login: ^"%s<%d><%s><>^" became an admin (account ^"%s^") (access ^"%s^") (address ^"%s^")", name, get_user_userid(id), authid, AuthData, sflags, ip)
671 }
672 else
673 {
674 result |= 1
675
676 if (Flags & FLAG_KICK)
677 {
678 result |= 2
679 log_amx("Login: ^"%s<%d><%s><>^" kicked due to invalid password (account ^"%s^") (address ^"%s^")", name, get_user_userid(id), authid, AuthData, ip)
680 }
681 }
682 }
683 }
684 else if (get_pcvar_float(amx_mode) == 2.0)
685 {
686 result |= 2
687 }
688 else
689 {
690 new defaccess[32]
691
692 get_pcvar_string(amx_default_access, defaccess, charsmax(defaccess))
693
694 if (!strlen(defaccess))
695 {
696 copy(defaccess, charsmax(defaccess), "z")
697 }
698
699 new idefaccess = read_flags(defaccess)
700
701 if (idefaccess)
702 {
703 result |= 8
704 set_user_flags(id, idefaccess)
705 }
706 }
707
708 return result
709}
710
711accessUser(id, name[] = "")
712{
713 remove_user_flags(id)
714
715 new userip[32], userauthid[32], password[32], passfield[32], username[MAX_NAME_LENGTH]
716
717 get_user_ip(id, userip, charsmax(userip), 1)
718 get_user_authid(id, userauthid, charsmax(userauthid))
719
720 if (name[0])
721 {
722 copy(username, charsmax(username), name)
723 }
724 else
725 {
726 get_user_name(id, username, charsmax(username))
727 }
728
729 get_pcvar_string(amx_password_field, passfield, charsmax(passfield))
730 get_user_info(id, passfield, password, charsmax(password))
731
732 new result = getAccess(id, username, userauthid, userip, password)
733
734 if (result & 1)
735 {
736 engclient_print(id, engprint_console, "* %L", id, "INV_PAS")
737 }
738
739 if (result & 2)
740 {
741 server_cmd("kick #%d ^"%L^"", get_user_userid(id), id, "NO_ENTRY")
742 return PLUGIN_HANDLED
743 }
744
745 if (result & 4)
746 {
747 engclient_print(id, engprint_console, "* %L", id, "PAS_ACC")
748 }
749
750 if (result & 8)
751 {
752 engclient_print(id, engprint_console, "* %L", id, "PRIV_SET")
753 }
754
755 return PLUGIN_CONTINUE
756}
757
758public client_infochanged(id)
759{
760 if (!is_user_connected(id) || !get_pcvar_num(amx_mode))
761 {
762 return PLUGIN_CONTINUE
763 }
764
765 new newname[MAX_NAME_LENGTH], oldname[MAX_NAME_LENGTH]
766
767 get_user_name(id, oldname, charsmax(oldname))
768 get_user_info(id, "name", newname, charsmax(newname))
769
770 if (g_CaseSensitiveName[id])
771 {
772 if (!equal(newname, oldname))
773 {
774 accessUser(id, newname)
775 }
776 }
777 else
778 {
779 if (!equali(newname, oldname))
780 {
781 accessUser(id, newname)
782 }
783 }
784 return PLUGIN_CONTINUE
785}
786
787public client_authorized(id)
788 return get_pcvar_num(amx_mode) ? accessUser(id) : PLUGIN_CONTINUE
789
790public client_putinserver(id)
791{
792 if (!is_dedicated_server() && id == 1)
793 return get_pcvar_num(amx_mode) ? accessUser(id) : PLUGIN_CONTINUE
794
795 return PLUGIN_CONTINUE
796}