From 983d87e44356c4cfc8f8908ec365006323a4dbe0 Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Sat, 27 Jul 2013 16:24:03 +0100 Subject: Added correct core plugin --- MCServer/Plugins/Core/web_playerlist.lua | 38 ++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 MCServer/Plugins/Core/web_playerlist.lua (limited to 'MCServer/Plugins/Core/web_playerlist.lua') diff --git a/MCServer/Plugins/Core/web_playerlist.lua b/MCServer/Plugins/Core/web_playerlist.lua new file mode 100644 index 000000000..6ac25db86 --- /dev/null +++ b/MCServer/Plugins/Core/web_playerlist.lua @@ -0,0 +1,38 @@ +function HandleRequest_PlayerList( Request ) + local World = cRoot:Get():GetDefaultWorld() + local Content = "" + + if( Request.Params["playerlist-kick"] ~= nil ) then + local KickPlayerName = Request.Params["playerlist-kick"] + local FoundPlayerCallback = function( Player ) + if( Player:GetName() == KickPlayerName ) then + Player:GetClientHandle():Kick("You were kicked from the game!") + Content = Content .. "

" .. KickPlayerName .. " has been kicked from the game!

" + end + end + if( World:DoWithPlayer( KickPlayerName, FoundPlayerCallback ) == false ) then + Content = Content .. "

Could not find player " .. KickPlayerName .. " !

" + end + end + + Content = Content .. "

Connected Players: " .. World:GetNumPlayers() .. "

" + Content = Content .. "" + + local PlayerNum = 0 + local AddPlayerToTable = function( Player ) + PlayerNum = PlayerNum + 1 + Content = Content .. "" + Content = Content .. "" + Content = Content .. "" + Content = Content .. "" + Content = Content .. "" + end + cRoot:Get():ForEachPlayer( AddPlayerToTable ) + + if( PlayerNum == 0 ) then + Content = Content .. "" + end + Content = Content .. "
" .. PlayerNum .. "." .. Player:GetName() .. "Kick
None
" + Content = Content .. "
" + return Content +end \ No newline at end of file -- cgit v1.2.3