diff options
author | Jesusaves <cpntb1@ymail.com> | 2024-06-01 14:34:13 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2024-06-01 14:34:13 -0300 |
commit | c0f0ce386045ae952f8b75c345d2590c067278c0 (patch) | |
tree | b28366e187b0b27f6f2ca398deea7e10751c467b | |
parent | dbbb00b0b2743ca819b7662140473c5dc92a3e6c (diff) | |
download | serverdata-c0f0ce386045ae952f8b75c345d2590c067278c0.tar.gz serverdata-c0f0ce386045ae952f8b75c345d2590c067278c0.tar.bz2 serverdata-c0f0ce386045ae952f8b75c345d2590c067278c0.tar.xz serverdata-c0f0ce386045ae952f8b75c345d2590c067278c0.zip |
Improve @gm command security on forks
-rw-r--r-- | npc/commands/super-menu.txt | 25 | ||||
-rw-r--r-- | npc/functions/permissions.txt | 10 | ||||
-rw-r--r-- | npc/scripts.conf | 2 |
3 files changed, 23 insertions, 14 deletions
diff --git a/npc/commands/super-menu.txt b/npc/commands/super-menu.txt index 7ae8c206e..59598681b 100644 --- a/npc/commands/super-menu.txt +++ b/npc/commands/super-menu.txt @@ -82,35 +82,34 @@ OnGM: } .@auth=true; // NOTE: Pihro and Pyndragon do not have player chars - // FIXME: Use account ID over char name (multi-server stable) // Administration - if (strcharinfo(0) == "Jesusalva") { // 0005 + if (check_nickid("Jesusalva", "0005")) { setgroupid(99); - } else if (strcharinfo(0) == "Saulc") { // 0004 + } else if (check_nickid("Saulc", "0004")) { setgroupid(99); // Game Masters - } else if (strcharinfo(0) == "ThinkSome") { // 0817 + } else if (check_nickid("ThinkSome", "0817")) { setgroupid(80); - } else if (strcharinfo(0) == "demure") { // 0777 + } else if (check_nickid("demure", "0777")) { setgroupid(80); - } else if (strcharinfo(0) == "jak1") { // 0002 + } else if (check_nickid("jak1", "0002")) { setgroupid(80); // Game Officers - } else if (strcharinfo(0) == "seeds") { // 0409 + } else if (check_nickid("seeds", "0409")) { setgroupid(60); - } else if (strcharinfo(0) == "kytty") { // 0606 + } else if (check_nickid("kytty", "0606")) { setgroupid(60); - } else if (strcharinfo(0) == "cuoco") { // 0620 + } else if (check_nickid("cuoco", "0620")) { setgroupid(60); // Support Staff - } else if (strcharinfo(0) == "Ledmitz") { // 0585 + } else if (check_nickid("Ledmitz", "0585")) { setgroupid((debug ? 5 : 2)); - } else if (strcharinfo(0) == "Meway") { // 1078 + } else if (check_nickid("Meway", "1078")) { setgroupid((debug ? 5 : 2)); - } else if (strcharinfo(0) == "HoraK") { // 0008 + } else if (check_nickid("HoraK", "0008")) { setgroupid((debug ? 5 : 2)); - } else if (strcharinfo(0) == "Reid") { // 0741 + } else if (check_nickid("Reid", "0741")) { setgroupid((debug ? 5 : 2)); // Test Server grants } else if (debug && getgroupid() == 1) { diff --git a/npc/functions/permissions.txt b/npc/functions/permissions.txt index 2838f7a92..c9539aacb 100644 --- a/npc/functions/permissions.txt +++ b/npc/functions/permissions.txt @@ -23,3 +23,13 @@ function script is_staff { function script is_sponsor { return (getgmlevel()); } + +// Used internally by @gm +function script check_nickid { + .@n$ = getarg(0); + .@i$ = getarg(1); + if (strcharinfo(0) != .@n$) return false; + if (debug || $@GM_OVERRIDE) return true; + if (compare(str(getcharid(3)), .@i$)) return true; + return false; +} diff --git a/npc/scripts.conf b/npc/scripts.conf index ab2a6f850..79a81df81 100644 --- a/npc/scripts.conf +++ b/npc/scripts.conf @@ -1,8 +1,8 @@ // This is the main script import file // Critical functions -"npc/functions/permissions.txt", "npc/functions/string.txt", +"npc/functions/permissions.txt", "npc/functions/main.txt", "npc/functions/array.txt", "npc/functions/bitwise.txt", |