AdminsOnline

Approved AdminsOnline 2.0

No permission to download
Skippi submitted a new resource:

AdminsOnline - Player can type "/admins" and see list of admins online.



Read more about this resource...
Approved, but I think there is a problem: (You are using Dats to add, and DataStore to remove the player.

function On_PlayerConnected(Player){
if(Player.Admin){
Data.AddTableValue('adminlist', Player.Name, Player);
}
}

function On_PlayerDisconnected(Player){
DataStore.Remove('adminlist', Player.Name);
}
 
also, the player can't be .Admin when it just connected, Player.Admin is true when the player is logged into rcon
 
also, the player can't be .Admin when it just connected, Player.Admin is true when the player is logged into rcon
Player.Admin flag gets received if he has the RCON flag in the XML file, or logged in. He can be admin, or I don't know what do you mean about it, since you can send a message to the Player like:

JavaScript:
function On_PlayerConnected(Player){
       if(Player.Admin){
                 Player.Message(wwdwdwd.....
       }
}

When i was testing i know i received these messages. (Could be wrong tho)
 
Player.Admin flag gets received if he has the RCON flag in the XML file, or logged in. He can be admin, or I don't know what do you mean about it, since you can send a message to the Player like:

JavaScript:
function On_PlayerConnected(Player){
       if(Player.Admin){
                 Player.Message(wwdwdwd.....
       }
}

When i was testing i know i received these messages. (Could be wrong tho)
yep, that's a rustpp thing, but in this case he should mention that rustpp is needed, and admins must have rcon flag
 
Approved, but I think there is a problem: (You are using Dats to add, and DataStore to remove the player.

function On_PlayerConnected(Player){
if(Player.Admin){
Data.AddTableValue('adminlist', Player.Name, Player);
}
}

function On_PlayerDisconnected(Player){
DataStore.Remove('adminlist', Player.Name);
}
I guess it is this one
http://fougerite.com/resources/lists-for-devs.36/
 
O.o what's the purpose of that? Storing non-serializable data(fougerite.player) in the ds is not too safe and also you have Server.Players and PlayerClient.All properties (safer, faster)
 
if you have players like moderators and you want them on the list aswell you could add there steam id
then your not forced to give them full admin access (rcon)

Code:
    function On_PlayerConnected(Player){
    if(Player.Admin || Player.SteamID == "7656565656656") {
    Data.AddTableValue('adminlist', Player.Name, Player);
    }
    }
 
if you have players like moderators and you want them on the list aswell you could add there steam id
then your not forced to give them full admin access (rcon)

Code:
    function On_PlayerConnected(Player){
    if(Player.Admin || Player.SteamID == "7656565656656") {
    Data.AddTableValue('adminlist', Player.Name, Player);
    }
    }
That looks bad. You could simply do a new function and check the id.

JavaScript:
function isModerator(id) {
if (DataStore.Get("Moderators", id) == "yes"){
return true;
}
return false;
}

Then you could add a simple command to add/remove ids to that section in datastore and use the function rather than writing all ids.

JavaScript:
function On_Command(Player, cmd, args) {
if (Player.Admin && args.Length == 1) {
  switch (cmd) {
   case "addmod":
    DataStore.Add("Moderators", args[0], "yes");
    Player.Message("Player with the id " + args[0] + " added to moderators");
    break;

   case "delmod":
     DataStore.Remove("Moderators", args[0]);
     Player.Message("Player with the id " + args[0] + " removed from moderators");
     break;
  }
}
}

Then you can easily do :

JavaScript:
function On_PlayerConnected(Player) {
if (Player.Admin || isModerator(Player.SteamID) {
//Whatever code goes on here
}
}

I hope it helps !
 
you can store values in the datastore as boolean:
JavaScript:
function On_Command(Player, cmd, args){
    if(Player.Admin&& args.Length==1){
        switch(cmd){
         case"addmod":
            DataStore.Add("Moderators", args[0],true);
            Player.Message("Player with the id "+ args[0]+" added to moderators");
            break;

        case"delmod":
            DataStore.Remove("Moderators", args[0]);
            Player.Message("Player with the id "+ args[0]+" removed from moderators");
            break;
        }
    }
}

function isModerator(steamid){
    return DataStore.Get("Moderators", steamid) ? true : false;
/*
// or if you prefer:
    if(DataStore.Get("Moderators", steamid))
        return true;
    return false;
*/
}

a boolean takes less space then a string and faster to compare ( yeah, I know... it's micro-optimization :D )
 
Kinda old, here is a "modern" version.

Save It as AdminsOnline.py
Python:
__author__ = 'DreTaX'
__version__ = '1.0'

import clr

clr.AddReferenceByPartialName("Fougerite")
import Fougerite

class AdminsOnline:

    def isMod(self, id):
        if DataStore.ContainsKey("Moderators", id):
            return True
        return False

    def On_Command(self, Player, cmd, args):
        if cmd == "admins":
            Mods = ""
            Adms = ""
            for x in Server.Players:
                if x.Admin:
                    Adms = Adms + x.Name + ", "
                elif self.isMod(x.SteamID):
                    Mods = Mods + x.Name + ", "
            Player.MessageFrom("AdminsOnline", Adms)
            Player.MessageFrom("ModeratorsOnline", Mods)
 
  • Like
Reactions: Jakkee
Kinda old, here is a "modern" version.

Save It as AdminsOnline.py
Python:
__author__ = 'DreTaX'
__version__ = '1.0'

import clr

clr.AddReferenceByPartialName("Fougerite")
import Fougerite

class AdminsOnline:

    def isMod(self, id):
        if DataStore.ContainsKey("Moderators", id):
            return True
        return False

    def On_Command(self, Player, cmd, args):
        if cmd == "admins":
            Mods = ""
            Adms = ""
            for x in Server.Players:
                if x.Admin:
                    Adms = Adms + x.Name + ", "
                elif self.isMod(x.SteamID):
                    Mods = Mods + x.Name + ", "
            Player.MessageFrom("AdminsOnline", Adms)
            Player.MessageFrom("ModeratorsOnline", Mods)
add if no admins say:
No admins Online