If it's of any interest to you, I was able to accomplish this without any source modifications.
I created a script function and named it
groupid2name. For the sake of keeping things relevant, I used group names and IDs in correspondence to those in
conf/groups.conf.
function script groupid2name { switch(getarg(0)) { case 0: return "Player"; case 1: return "Super Player"; case 2: return "Support"; case 3: return "Script Manager"; case 4: return "Event Manager"; case 10: return "Law Enforcement"; case 99: return "Admin"; default: return "Undefined Group"; }}
This function can now be called upon from any script with
groupid2name(<parameter>
. Whisper anything to
npc:test_gid2name to test this script.
- script test_gid2name -1,{ OnWhisperGlobal: message strcharinfo(0), "Your group name is: "+ groupid2name(getgroupid()); end;}
The only limitation to this is that you will have to manually adjust the group names yourself. Despite that, the strength in this is that it eliminates the need to make source and conf modifications; in a way, it allows for dynamic group name changes without needing to directly modify
conf/groups.conf. Updating is a snap too, as it's simply a matter of overwriting the old function.
Edits:
Added extra line-spacing because I'm tedious like that. c:
Added
default label in the switch, in the event someone has an undefined group ID.