Now we have a /lusers command in chat ;)

This commit is contained in:
Jonatan Pålsson 2011-02-20 01:58:48 +01:00
parent 67567fe263
commit 507081c234
3 changed files with 17 additions and 6 deletions

View file

@ -50,7 +50,9 @@ do_stuff(Command, Args, Player, Table) ->
"uname" ->
Uname = os:cmd("uname -a"),
ggs_player:notify(Player, server, Uname);
"lusers" ->
{ok, Players} = ggs_table:get_player_list(Table),
ggs_player:notify(Player, server,io_lib:format("~p\n",[Players]));
Other ->
ggs_player:notify(Player, server, "I don't know that command..\n")
end.

View file

@ -6,7 +6,7 @@
%% gen_server callbacks
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
terminate/2, code_change/3, notify_all_players/2, notify_game/3,
add_player/2]).
add_player/2, get_player_list/1]).
-record(state, { token, players, socket, game_vm } ).
@ -39,6 +39,10 @@ add_player(Table, Player) ->
remove_player(Table, Player) ->
call(Table, {remove_player, Player}).
%% @doc Get a list of all player processes attached to this table
get_player_list(Table) ->
gen_server:call(Table, get_player_list).
% @doc stops the table process
stop(Table) ->
gen_server:cast(Table, stop).