Ban system?

Hey AGAIN people - xD

I want to get all the players on the server displayed on a list. And from here be able to target them (to do things like freeze, ban and kick etc.)
How?!


(User was banned for this post ("undescriptive thread title" - Gran PC))

[LUA]
player.GetAll()
[/LUA]

This returns a table of all players on the server.

[lua]for k, v in pairs(player.GetAll())
[/lua]

etc…

But how would I display them in a list, and specify things like names.
For use in things like player specific commands etc.

Is the table called players? If so I’d assume you can Msg(Player[k])?

Wait, what?

If you want to see the list you can use Msg() to display it in the console I believe. If player is a table then you can do player[k] or key and player[k].Nick() to display the name. Something like that.

The player bit in player.GetAll() is a call to the player library.

[lua]
for k, ply in pairs( player.GetAll() ) do
print( ply:Name() )
end
[/lua]

I feel like you may be significantly out of your depth here, Kayvoo…

Kayvoo why not just use one of the admin mods available? (ulx, exsto)

He wants to make his own.

Okay people. This really helped a lot. But the main thing I want is the list of players to be displayed on a Derma list. And then some kind of interaction with them - so I can target specific ones as entities - and then teleport, set health etc.

**EDIT: ** Also… what is that “k” in the for loop? I know that “ply” or ‘the second variable’ is the current player that the loop is running. But what is “k”? and does it have to be “k”?

Sorry to say it but if you don’t even know how to display some names on a list, then maybe you haven’t looked enough around the wiki(s)

(a hint: DListView)

This is more what I am looking for. Silly me thought I had to use DLabel like 9001 times.
Ty ducky.

Now any ideas on how to interact with the selected player from the list? Like ban, kick, health etc.?

I am using: http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index64cf.html

Try something like this:

A bring up a context menu with that (http://wiki.garrysmod.com/page/Global/DermaMenu).