AdminsOnline

Approved AdminsOnline 2.0

No permission to download

DreTaX

Probably knows the answer...
Administrator
Jun 29, 2014
4,086
4,767
113
At your house.
github.com
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);
}
 

balu92

Moderator
Moderator
Jul 11, 2014
338
75
28
33
also, the player can't be .Admin when it just connected, Player.Admin is true when the player is logged into rcon
 

DreTaX

Probably knows the answer...
Administrator
Jun 29, 2014
4,086
4,767
113
At your house.
github.com
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)
 

balu92

Moderator
Moderator
Jul 11, 2014
338
75
28
33
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
 

DreTaX

Probably knows the answer...
Administrator
Jun 29, 2014
4,086
4,767
113
At your house.
github.com
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/
 

balu92

Moderator
Moderator
Jul 11, 2014
338
75
28
33
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)
 

ggblade

Member
Member
Aug 14, 2014
29
0
6
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);
    }
    }
 

Snake

Moderator
Moderator
Jul 13, 2014
288
174
28
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 !
 

balu92

Moderator
Moderator
Jul 11, 2014
338
75
28
33
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 )
 

DreTaX

Probably knows the answer...
Administrator
Jun 29, 2014
4,086
4,767
113
At your house.
github.com
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

mohammadreza.h1381

Member
Member
May 8, 2017
129
2
18
35
Parts Unknown
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