ID:139524
 
Code:
        MGM_GMs_list()
set desc = "() Read the list of all GMs' keys"
set category = "GM"
usr<<"<FONT COLOR=red>Server information</FONT>: Ingame made GM's and Admins"
if(GMs.len)
usr << "<b>GMs:</b>"
for(var/X in GMs)
usr << "--> [X]"
if(MGMs.len)
usr << "<b>Admin Lvl 1:</b>"
for(var/X in MGMs)
usr << "--> [X]"
if(Admins.len)
usr << "<b>Admin Lvl 2:</b>"
for(var/X in Admins)
usr << "--> [X]"
if(!GMs.len && !Admins.len)
usr << "There are no recorded GMs or Admins."


Problem description:
Excuse me but I need some help, I cant get this to work properly...What im trying to do is get it to say
GMs:
-->(GM Staff)
-->(GM Staff)
Admin Lvl 1:
-->(Admin Staff)
-->(Admin Staff)
and so on...
but when go on and click 'MGM GMs list' it only shows the GMs. Thankyou for your time :).




In all honesty, that's not a very good way to run the administrative system. If I were to try and perform something like this, the best way in my opinion would be like this:

mob
var
admin = null
admin
verb
Check_Admins()
set category = "Admin"
src<<"Current administrator's online..."
for(var/client/C in world)
if(!C)
src<<"There are currently no admins online"
return
else if(C.mob.admin) src<<"[src] ([src.admin])"
In response to DarkeWarrior
DarkeWarrior wrote:
In all honesty, that's not a very good way to run the administrative system. If I were to try and perform something like this, the best way in my opinion would be like this:

> mob
> var
> admin = null
> admin
> verb
> Check_Admins()
> set category = "Admin"
> src<<"Current administrator's online..."
> for(var/client/C in world)
> if(!C)
> src<<"There are currently no admins online"
> return
> else if(C.mob.admin) src<<"[src] ([src.admin])"
>


The if(!C) is completely useless here, the for() already makes sure there is a C.
In response to DarkeWarrior
DarkeWarrior wrote:
In all honesty, that's not a very good way to run the administrative system. If I were to try and perform something like this, the best way in my opinion would be like this:

Which would do nothing for telling you about administrators that are offline, which could be done if you keep track of them in for example a list rather than a variable on their character (which is what the OP appears to be doing).
Are you sure there is actually anything in the other lists?

The following is a slight modification that will either list what is in the list, or tell you there is nothing in it.

MGM_GMs_list()
set desc = "() Read the list of all GMs' keys"
set category = "GM"
usr<<"<FONT COLOR=red>Server information</FONT>: Ingame made GM's and Admins"
usr << "<b>GMs:</b>"
if(GMs.len)
for(var/X in GMs)
usr << "--> [X]"
else
usr << "--> None"
usr << "<b>Admin Lvl 1:</b>"
if(MGMs.len)
for(var/X in MGMs)
usr << "--> [X]"
else
usr << "--> None"
usr << "<b>Admin Lvl 2:</b>"
if(Admins.len)
for(var/X in Admins)
usr << "--> [X]"
else
usr << "--> None"
In response to DarkeWarrior
Determining admin status through a mob variable is highly unsafe and frankly, silly from a design standpoint. Consider savefiles and what might happen in the case of mob switching.
In response to DarkeWarrior
Storing in it a mob var does not give you access to it when its offline, unless you go savefile digging.
In response to Toadfish
I think saving it at all puts it at risk. I prefer to hardcode all the "admins" or whatever, and keep it that way. You shouldn't be adding members to your staff at runtime.

var/list/admins = list("Spunky_Girl"/*=1*/)

client/verb/who()
for(var/client/c)
if(c.key in admins)
//whatever

You could do an associated value after every key for "different levels of admin" if you'd like.
In response to Spunky_Girl
There is no reason properly saving a list of staff members would put you at risk (would a text file of keys put you at risk?), and it is necessary for some areas of server management. A host should be able to appoint admins to his server (not necessarily at runtime) without access to the source code. But I'm not really sure why you're telling me this, Spunky_Girl?
(Regarding savefiles, I wasn't talking about security risks - although there may be some - but rather that admin status would be associated only with one mob, rather than the appointed key, without going savefile hunting. More annoying still is the case where the character with admin=1 gets deleted.)
In response to Toadfish
Sorry, I come from a different background here on BYOND where the host is almost never the "owner" of the game so-to-speak. The host is just a person who is keeping the game live, so others may join. There is no need to hardcode "host powers" since the host already has so much power to reboot/take down/make live/ban people/whatever with the game. If the host just so happens to be the "game owner" then of course he/she will have the ability to appoint new admins and such.

My point being, that if the person hosting the game, is not the game owner, and the game uses savefiles for holding admin info, then the host could easily edit the savefile and appoint whoever he likes as game owner, admin, etc.
In response to Spunky_Girl
I suppose you have a point, but I'm not sure it's relevant to my original post at all, which was criticism and not proposal of a different system. If I mentioned savefiles it is because I made no assumptions as to what kind of game this is (which you shouldn't, either). What confuses me is how the fact that some games may not want savefiles relates to the idea that, should someone using DarkeWarrior's system want to use savefiles, he would have a difficult time doing so.
In response to Toadfish
I probably misinterpreted your post then. >.< Sorry. I'm unfamiliar with DarkeWarrior's system, so I have no idea what you're referring to when you mention it.
In response to Spunky_Girl
No need to apologise. You can find the system I mentioned in DarkeWarrior's post here (take note you can always see which post I was responding to by clicking the "Parent ID" link to the top right of my forum post).
In response to Toadfish
Oh, hello. Him. x.x Didn't bother looking at his name haha